diff --git a/Alpha_wrap_3/examples/Alpha_wrap_3/mixed_inputs_wrap.cpp b/Alpha_wrap_3/examples/Alpha_wrap_3/mixed_inputs_wrap.cpp index eca3fa1654e..be64a8febbd 100644 --- a/Alpha_wrap_3/examples/Alpha_wrap_3/mixed_inputs_wrap.cpp +++ b/Alpha_wrap_3/examples/Alpha_wrap_3/mixed_inputs_wrap.cpp @@ -25,8 +25,6 @@ using Mesh = CGAL::Surface_mesh; int main(int argc, char** argv) { - std::cout.precision(17); - // Read the inputs const std::string ts_filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/armadillo.off"); // triangle soup const std::string ss_filename = (argc > 2) ? argv[2] : CGAL::data_file_path("images/420.polylines.txt"); // segment soup diff --git a/Alpha_wrap_3/examples/Alpha_wrap_3/point_set_wrap.cpp b/Alpha_wrap_3/examples/Alpha_wrap_3/point_set_wrap.cpp index feaa9c804af..8742a2a2001 100644 --- a/Alpha_wrap_3/examples/Alpha_wrap_3/point_set_wrap.cpp +++ b/Alpha_wrap_3/examples/Alpha_wrap_3/point_set_wrap.cpp @@ -8,8 +8,6 @@ #include #include -namespace AW3 = CGAL::Alpha_wraps_3; - using K = CGAL::Exact_predicates_inexact_constructions_kernel; using Point_3 = K::Point_3; @@ -18,8 +16,6 @@ using Mesh = CGAL::Surface_mesh; int main(int argc, char** argv) { - std::cout.precision(17); - // Read the input const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("points_3/oni.pwn"); std::cout << "Reading " << filename << "..." << std::endl; diff --git a/Alpha_wrap_3/examples/Alpha_wrap_3/triangle_mesh_wrap.cpp b/Alpha_wrap_3/examples/Alpha_wrap_3/triangle_mesh_wrap.cpp index 5aa8deeb4de..00e2e4fd9fc 100644 --- a/Alpha_wrap_3/examples/Alpha_wrap_3/triangle_mesh_wrap.cpp +++ b/Alpha_wrap_3/examples/Alpha_wrap_3/triangle_mesh_wrap.cpp @@ -9,7 +9,6 @@ #include #include -namespace AW3 = CGAL::Alpha_wraps_3; namespace PMP = CGAL::Polygon_mesh_processing; using K = CGAL::Exact_predicates_inexact_constructions_kernel; @@ -19,8 +18,6 @@ using Mesh = CGAL::Surface_mesh; int main(int argc, char** argv) { - std::cout.precision(17); - // Read the input const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/armadillo.off"); std::cout << "Reading " << filename << "..." << std::endl; diff --git a/Alpha_wrap_3/examples/Alpha_wrap_3/wrap_from_cavity.cpp b/Alpha_wrap_3/examples/Alpha_wrap_3/wrap_from_cavity.cpp index 2eb3f9c4155..1c1d6c7b3d7 100644 --- a/Alpha_wrap_3/examples/Alpha_wrap_3/wrap_from_cavity.cpp +++ b/Alpha_wrap_3/examples/Alpha_wrap_3/wrap_from_cavity.cpp @@ -8,7 +8,6 @@ #include #include -namespace AW3 = CGAL::Alpha_wraps_3; namespace PMP = CGAL::Polygon_mesh_processing; using K = CGAL::Exact_predicates_inexact_constructions_kernel; @@ -18,8 +17,6 @@ using Mesh = CGAL::Surface_mesh; int main(int argc, char** argv) { - std::cout.precision(17); - // Read the input const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/armadillo.off"); std::cout << "Reading " << filename << "..." << std::endl; diff --git a/Documentation/doc/Documentation/Tutorials/Tutorial_reconstruction.txt b/Documentation/doc/Documentation/Tutorials/Tutorial_reconstruction.txt index 4ec56ab4be3..8fbc5618881 100644 --- a/Documentation/doc/Documentation/Tutorials/Tutorial_reconstruction.txt +++ b/Documentation/doc/Documentation/Tutorials/Tutorial_reconstruction.txt @@ -290,7 +290,7 @@ by the user at runtime with the second argument. \section TutorialsReconstruction_pipeline Full Pipeline Images -The following figure an example of a full reconstruction pipeline +The following figures show a full reconstruction pipeline applied to a bear statue (courtesy _EPFL Computer Graphics and Geometry Laboratory_ \cgalCite{cgal:e-esmr}). Two mesh processing algorithms (hole filling and isotropic remeshing) are also applied diff --git a/Installation/cmake/modules/FindTBB.cmake b/Installation/cmake/modules/FindTBB.cmake index 8b7aa08a92b..4e808b39eee 100644 --- a/Installation/cmake/modules/FindTBB.cmake +++ b/Installation/cmake/modules/FindTBB.cmake @@ -1,3 +1,5 @@ +# Copy of https://github.com/NVIDIA/thrust/blob/9f1cddc62b1bebbaeb8d07d4476c285be5aa0adc/thrust/cmake/FindTBB.cmake +# # - Find ThreadingBuildingBlocks include dirs and libraries # Use this module by invoking find_package with the form: # find_package(TBB @@ -11,6 +13,7 @@ # malloc proxy # TBB::tbb - imported target for the TBB library # +# TBB_VERSION - Product Version Number ("MAJOR.MINOR") # TBB_VERSION_MAJOR - Major Product Version Number # TBB_VERSION_MINOR - Minor Product Version Number # TBB_INTERFACE_VERSION - Engineering Focused Version Number @@ -107,48 +110,48 @@ endfunction() # Do the final processing for the package find. #=============================================== macro(findpkg_finish PREFIX TARGET_NAME) - # skip if already processed during this run - if (NOT ${PREFIX}_FOUND) - if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY) - set(${PREFIX}_FOUND TRUE) - set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR}) - set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY}) - else () - if (${PREFIX}_FIND_REQUIRED AND NOT ${PREFIX}_FIND_QUIETLY) - message(FATAL_ERROR "Required library ${PREFIX} not found.") - endif () - endif () - - if (NOT TARGET "TBB::${TARGET_NAME}") - if (${PREFIX}_LIBRARY_RELEASE) - tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release) - endif () - if (${PREFIX}_LIBRARY_DEBUG) - tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug) - endif () - add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}") - if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${real_release}" - IMPORTED_LOCATION_DEBUG "${real_debug}" - IMPORTED_LOCATION_RELEASE "${real_release}") - elseif (${PREFIX}_LIBRARY_RELEASE) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${real_release}") - elseif (${PREFIX}_LIBRARY_DEBUG) - set_target_properties(TBB::${TARGET_NAME} PROPERTIES - IMPORTED_LOCATION "${real_debug}") - endif () - endif () - - #mark the following variables as internal variables - mark_as_advanced(${PREFIX}_INCLUDE_DIR - ${PREFIX}_LIBRARY - ${PREFIX}_LIBRARY_DEBUG - ${PREFIX}_LIBRARY_RELEASE) + if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY) + set(${PREFIX}_FOUND TRUE) + set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR}) + set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY}) + else () + if (${PREFIX}_FIND_REQUIRED) + message(FATAL_ERROR "Required library ${PREFIX} not found.") + elseif (NOT ${PREFIX}_FIND_QUIETLY) + message("Library ${PREFIX} not found.") + endif() + return() endif () + + if (NOT TARGET "TBB::${TARGET_NAME}") + if (${PREFIX}_LIBRARY_RELEASE) + tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release) + endif () + if (${PREFIX}_LIBRARY_DEBUG) + tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug) + endif () + add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}") + if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + IMPORTED_LOCATION "${real_release}" + IMPORTED_LOCATION_DEBUG "${real_debug}" + IMPORTED_LOCATION_RELEASE "${real_release}") + elseif (${PREFIX}_LIBRARY_RELEASE) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + IMPORTED_LOCATION "${real_release}") + elseif (${PREFIX}_LIBRARY_DEBUG) + set_target_properties(TBB::${TARGET_NAME} PROPERTIES + IMPORTED_LOCATION "${real_debug}") + endif () + endif () + + #mark the following variables as internal variables + mark_as_advanced(${PREFIX}_INCLUDE_DIR + ${PREFIX}_LIBRARY + ${PREFIX}_LIBRARY_DEBUG + ${PREFIX}_LIBRARY_RELEASE) endmacro() #=============================================== @@ -188,6 +191,10 @@ endmacro() #============================================================================= # Now to actually find TBB # + +# Get path, convert backslashes as ${ENV_${var}} +getenv_path(TBB_ROOT) + #start with looking for TBB_DIR and TBB_ROOT if((TBB_ROOT OR "$ENV{TBB_ROOT}" OR "$ENV{TBB_DIR}" ) AND NOT TBB_FOUND) find_package(TBB QUIET NO_MODULE NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH) @@ -202,9 +209,6 @@ if(TBB_FOUND) return() endif()#TBB_FOUND -# Get path, convert backslashes as ${ENV_${var}} -getenv_path(TBB_ROOT) - if(NOT ENV_TBB_ROOT) getenv_path(TBBROOT) set(ENV_TBB_ROOT ${ENV_TBBROOT}) @@ -253,8 +257,26 @@ if (WIN32 AND MSVC) set(COMPILER_PREFIX "vc11") elseif(MSVC_VERSION EQUAL 1800) set(COMPILER_PREFIX "vc12") - elseif(MSVC_VERSION EQUAL 1900) + elseif(MSVC_VERSION GREATER_EQUAL 1900 AND MSVC_VERSION LESS_EQUAL 1939) + # 1900-1925 actually spans three Visual Studio versions: + # 1900 = VS 14.0 (v140 toolset) a.k.a. MSVC 2015 + # 1910-1919 = VS 15.0 (v141 toolset) a.k.a. MSVC 2017 + # 1920-1929 = VS 16.0 (v142 toolset) a.k.a. MSVC 2019 + # 1930-1939 = VS 17.0 (v143 toolset) a.k.a. MSVC 2022 + # + # But these are binary compatible and TBB's open source distribution only + # ships a single vs14 lib (as of 2020.0) set(COMPILER_PREFIX "vc14") + else() + # The next poor soul who finds themselves having to decode visual studio + # version conventions may find these helpful: + # - https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html + # - https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering + message(AUTHOR_WARNING + "Unrecognized MSVC version (${MSVC_VERSION}). " + "Please update FindTBB.cmake. " + "Some TBB_* CMake variables may need to be set manually." + ) endif () # for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path @@ -351,7 +373,6 @@ endforeach () set(TBB_LIBRARY_NAMES tbb) get_debug_names(TBB_LIBRARY_NAMES) - find_path(TBB_INCLUDE_DIR NAMES tbb/tbb.h PATHS ${TBB_INC_SEARCH_PATH}) @@ -411,12 +432,18 @@ findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy) #============================================================================= -#parse all the version numbers from tbb +# Parse all the version numbers from tbb. if(NOT TBB_VERSION) + if(EXISTS "${TBB_INCLUDE_DIR}/tbb/version.h") + # The newer oneTBB provides tbb/version.h but no tbb/tbb_stddef.h. + set(version_file "${TBB_INCLUDE_DIR}/tbb/version.h") + else() + # Older TBB provides tbb/tbb_stddef.h but no tbb/version.h. + set(version_file "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h") + endif() - #only read the start of the file - file(STRINGS - "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h" + file(STRINGS + "${version_file}" TBB_VERSION_CONTENTS REGEX "VERSION") @@ -436,4 +463,5 @@ if(NOT TBB_VERSION) ".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}") + set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}") endif() diff --git a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/tutorial_example.cpp b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/tutorial_example.cpp index b67e90210b5..4f23a1eaf55 100644 --- a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/tutorial_example.cpp +++ b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/tutorial_example.cpp @@ -210,7 +210,7 @@ int main(int argc, char*argv[]) for (Point_set::Index idx : points) f << points.point (idx) << std::endl; for (const auto& facet : CGAL::make_range (reconstruct.facets_begin(), reconstruct.facets_end())) - f << "3 "<< facet << std::endl; + f << "3 "<< facet[0] << " " << facet[1] << " " << facet[2] << std::endl; f.close (); //! [Output scale space] diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/angle_and_area_smoothing.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/angle_and_area_smoothing.h index 03e9103df9e..e51999b9c54 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/angle_and_area_smoothing.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/angle_and_area_smoothing.h @@ -31,9 +31,9 @@ namespace Polygon_mesh_processing { /*! * \ingroup PMP_meshing_grp * -* \short smooths a triangulated region of a polygon mesh. +* \brief smooths a triangulated region of a polygon mesh. * -* This function attempts to make the triangle angle and area distributions as uniform as possible +* This function aims to make the triangle angle and area distributions as uniform as possible * by moving (non-constrained) vertices. * * Angle-based smoothing does not change the combinatorial information of the mesh. Area-based smoothing @@ -329,13 +329,33 @@ void angle_and_area_smoothing(const FaceRange& faces, } } -///\cond SKIP_IN_MANUAL +/*! +* \ingroup PMP_meshing_grp +* +* \brief smooths a polygon mesh. +* +* This function aims to make the triangle angle and area distributions as uniform as possible +* by moving (non-constrained) vertices. +* +* Angle-based smoothing does not change the combinatorial information of the mesh. Area-based smoothing +* might change the combinatorial information, unless specified otherwise. It is also possible +* to make the smoothing algorithm "safer" by rejecting moves that, when applied, would worsen the +* quality of the mesh, e.g. that would decrease the value of the smallest angle around a vertex or +* create self-intersections. +* +* Optionally, the points are reprojected after each iteration. +* +* See the overload which takes a face range as additonal parameter for a comprehensive description +* of the parameters. +*/ template void angle_and_area_smoothing(TriangleMesh& tmesh, const CGAL_NP_CLASS& np = parameters::default_values()) { angle_and_area_smoothing(faces(tmesh), tmesh, np); } + +///\cond SKIP_IN_MANUAL template void angles_evaluation(TriangleMesh& tmesh, GeomTraits traits, Stream& output) { diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index 89a3cd82904..c27ae2bda3a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1051,16 +1051,18 @@ public: previous_bitvalue[2] = is_patch_inside_tm1.test(patch_id_q1); previous_bitvalue[3] = is_patch_inside_tm1.test(patch_id_q2); -#ifndef CGAL_NDEBUG +/* + // Note that this code is commented as impossible_operation flag could be set thanks to + // another polyline and such a `continue` would make us miss it. if (is_tm1_closed && is_tm2_closed) { - if (!patch_status_was_not_already_set[0] && - !patch_status_was_not_already_set[1] && - !patch_status_was_not_already_set[2] && - !patch_status_was_not_already_set[3]) - continue; // all patches were already classified, no need to redo it + if (!patch_status_was_not_already_set[0] && + !patch_status_was_not_already_set[1] && + !patch_status_was_not_already_set[2] && + !patch_status_was_not_already_set[3]) + continue; // all patches were already classified, no need to redo it } -#endif +*/ // check incompatibility of patch classifications auto inconsistent_classification = [&]() @@ -1084,6 +1086,25 @@ public: } return false; }; +#ifndef CGAL_NDEBUG + auto debug_check_consistency = [&]() + { + if (!used_to_clip_a_surface && !used_to_classify_patches) + { + CGAL_assertion( patch_status_was_not_already_set[0] || (previous_bitvalue[0]==is_patch_inside_tm2[patch_id_p1]) ); + CGAL_assertion( patch_status_was_not_already_set[1] || (previous_bitvalue[1]==is_patch_inside_tm2[patch_id_p2]) ); + CGAL_assertion( patch_status_was_not_already_set[2] || (previous_bitvalue[2]==is_patch_inside_tm1[patch_id_q1]) ); + CGAL_assertion( patch_status_was_not_already_set[3] || (previous_bitvalue[3]==is_patch_inside_tm1[patch_id_q2]) ); + } + }; + is_patch_inside_tm2.reset(patch_id_p1); + is_patch_inside_tm2.reset(patch_id_p2); + is_patch_inside_tm1.reset(patch_id_q1); + is_patch_inside_tm1.reset(patch_id_q2); +#else + auto debug_check_consistency = [&](){}; + +#endif //indicates that patch status will be updated patch_status_not_set_tm1.reset(patch_id_p1); @@ -1140,6 +1161,7 @@ public: if ( q2_is_between_p1p2 ) is_patch_inside_tm1.set(patch_id_q2); //case 1 else is_patch_inside_tm2.set(patch_id_p2); //case 2 if (inconsistent_classification()) return; + debug_check_consistency(); continue; } else{ @@ -1171,6 +1193,7 @@ public: is_patch_inside_tm2.set(patch_id_p2); } //else case 4 if (inconsistent_classification()) return; + debug_check_consistency(); continue; } else @@ -1202,6 +1225,7 @@ public: is_patch_inside_tm2.set(patch_id_p1); } // else case 6 if (inconsistent_classification()) return; + debug_check_consistency(); continue; } else{ @@ -1231,6 +1255,7 @@ public: if ( q1_is_between_p1p2 ) is_patch_inside_tm1.set(patch_id_q1); //case 7 else is_patch_inside_tm2.set(patch_id_p1); //case 8 if (inconsistent_classification()) return; + debug_check_consistency(); continue; } } @@ -1393,13 +1418,7 @@ public: } } if (inconsistent_classification()) return; - if (!used_to_clip_a_surface && !used_to_classify_patches) - { - CGAL_assertion( patch_status_was_not_already_set[0] || previous_bitvalue[0]==is_patch_inside_tm2[patch_id_p1] ); - CGAL_assertion( patch_status_was_not_already_set[1] || previous_bitvalue[1]==is_patch_inside_tm2[patch_id_p2] ); - CGAL_assertion( patch_status_was_not_already_set[2] || previous_bitvalue[2]==is_patch_inside_tm1[patch_id_q1] ); - CGAL_assertion( patch_status_was_not_already_set[3] || previous_bitvalue[3]==is_patch_inside_tm1[patch_id_q2] ); - } + debug_check_consistency(); } } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h index 06ddc868f0d..98a80e05a8e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h @@ -42,6 +42,8 @@ template class Refine_Polyhedron_3 { //// typedefs typedef typename boost::property_traits::value_type Point_3; + typedef typename boost::property_traits::reference Point_3_ref; + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; @@ -88,7 +90,6 @@ private: bool relax(halfedge_descriptor h) { #ifdef CGAL_PMP_REFINE_DEBUG_PP - typedef typename boost::property_traits::reference Point_3_ref; Point_3_ref p = get(vpmap, source(h,pmesh)); Point_3_ref q = get(vpmap, target(h,pmesh)); Point_3_ref r = get(vpmap, target(next(h,pmesh),pmesh)); @@ -227,7 +228,7 @@ private: const std::set& interior_map, bool accept_internal_facets) { - const Point_3& vp = get(vpmap, vh); + const Point_3_ref vp = get(vpmap, vh); Halfedge_around_target_circulator circ(halfedge(vh,pmesh),pmesh), done(circ); int deg = 0; double sum = 0; @@ -239,7 +240,7 @@ private: { continue; } // which means current edge is an interior edge and should not be included in scale attribute calculation } - const Point_3& vq = get(vpmap, target(opposite(*circ,pmesh),pmesh)); + const Point_3_ref vq = get(vpmap, target(opposite(*circ,pmesh),pmesh)); sum += to_double(CGAL::approximate_sqrt(CGAL::squared_distance(vp, vq))); ++deg; } while(++circ != done); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h index 2d5d92374ba..956262a6413 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h @@ -1666,7 +1666,7 @@ locate_with_AABB_tree(const typename internal::Location_traits::const_type VertexPointMap; typedef internal::Point_to_Point_3_VPM WrappedVPM; - const Point_3& p3 = P_to_P3()(p); + const Point_3 p3 = P_to_P3()(p); typename AABB_tree::Point_and_primitive_id result = tree.closest_point_and_primitive(p3); typedef typename GetGeomTraits::type Geom_traits; @@ -1763,7 +1763,7 @@ locate(const typename internal::Location_traits:: AABB_tree tree; build_AABB_tree(tm, tree, parameters::vertex_point_map(wrapped_vpm)); - const Point_3& p3 = P_to_P3()(p); + const Point_3 p3 = P_to_P3()(p); return locate_with_AABB_tree(p3, tree, tm, parameters::vertex_point_map(wrapped_vpm)); } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h index ac5a340d816..468896b5a98 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h @@ -857,34 +857,38 @@ centroid(const TriangleMesh& tmesh, Vpm vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(CGAL::vertex_point, tmesh)); - typedef typename GetGeomTraits::type Kernel; - typedef typename Kernel::Point_3 Point_3; + typedef typename GetGeomTraits::type Kernel; + Kernel k = choose_parameter(get_parameter(np, internal_np::geom_traits)); + + typedef typename Kernel::FT FT; + typedef typename boost::property_traits::reference Point_3_ref; typedef typename Kernel::Vector_3 Vector_3; + typedef typename Kernel::Construct_translated_point_3 Construct_translated_point_3; typedef typename Kernel::Construct_vector_3 Construct_vector_3; typedef typename Kernel::Construct_normal_3 Construct_normal_3; typedef typename Kernel::Compute_scalar_product_3 Scalar_product; typedef typename Kernel::Construct_scaled_vector_3 Scale; typedef typename Kernel::Construct_sum_of_vectors_3 Sum; + typedef typename boost::graph_traits::face_descriptor face_descriptor; - typedef typename Kernel::FT FT; FT volume = 0; Vector_3 centroid(NULL_VECTOR); - Construct_translated_point_3 point; - Construct_vector_3 vector; - Construct_normal_3 normal; - Scalar_product scalar_product; - Scale scale; - Sum sum; + Construct_translated_point_3 point = k.construct_translated_point_3_object(); + Construct_vector_3 vector = k.construct_vector_3_object(); + Construct_normal_3 normal = k.construct_normal_3_object(); + Scalar_product scalar_product = k.compute_scalar_product_3_object(); + Scale scale = k.construct_scaled_vector_3_object(); + Sum sum = k.construct_sum_of_vectors_3_object(); for(face_descriptor fd : faces(tmesh)) { - const Point_3& p = get(vpm, target(halfedge(fd, tmesh), tmesh)); - const Point_3& q = get(vpm, target(next(halfedge(fd, tmesh), tmesh), tmesh)); - const Point_3& r = get(vpm, target(prev(halfedge(fd, tmesh), tmesh), tmesh)); + const Point_3_ref p = get(vpm, target(halfedge(fd, tmesh), tmesh)); + const Point_3_ref q = get(vpm, target(next(halfedge(fd, tmesh), tmesh), tmesh)); + const Point_3_ref r = get(vpm, target(prev(halfedge(fd, tmesh), tmesh), tmesh)); Vector_3 vp = vector(ORIGIN, p), vq = vector(ORIGIN, q), vr = vector(ORIGIN, r); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h index 798499f430b..40f480cbb7c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h @@ -483,7 +483,7 @@ struct Filter_wrapper_for_cap_needle_removal link_faces; collect_link_faces(e, link_faces); - Functor f = std::move(m_make_envelope(link_faces)); + Functor f = m_make_envelope(link_faces); Base base(m_tm, m_vpm, f); return base.collapse(e); } diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/run_test_corefinement_bool_op_full.sh b/Polygon_mesh_processing/test/Polygon_mesh_processing/run_test_corefinement_bool_op_full.sh index 2cea97cfb6b..bf9b24931ba 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/run_test_corefinement_bool_op_full.sh +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/run_test_corefinement_bool_op_full.sh @@ -14,6 +14,8 @@ for i in `seq 1 $k`; do ri=`echo $files | awk '{print $5}'` rm=`echo $files | awk '{print $6}'` rmr=`echo $files | awk '{print $7}'` + f1=`eval echo $f1` + f2=`eval echo $f2` echo -n "==== " $f1 $f2 " " if (./test_corefinement_bool_op $f1 $f2 ALL $ru $ri $rm $rmr|| false ) > /dev/null 2>&1; then diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd index c11009e6559..cc4c42e04cd 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd @@ -1,3 +1,21 @@ ${CGAL_DATA_DIR}/meshes/elephant.off ${CGAL_DATA_DIR}/meshes/sphere.off ALL 1 1 1 1 ${CGAL_DATA_DIR}/meshes/open_cube.off data-coref/incompatible_with_open_cube.off ALL 0 0 0 0 data-coref/floating_squares.off data-coref/hexa.off ALL 1 1 1 1 +data-coref/star_tgt1-0.off data-coref/star_tgt2-0.off ALL 1 1 1 0 +data-coref/star_tgt1-0.off data-coref/star_tgt2-1.off ALL 1 1 1 0 +data-coref/star_tgt1-0.off data-coref/star_tgt2-2.off ALL 0 1 1 1 +data-coref/star_tgt1-0.off data-coref/star_tgt2-3.off ALL 1 1 1 0 +data-coref/star_tgt1-0.off data-coref/star_tgt2-4.off ALL 0 1 1 1 +data-coref/star_tgt1-0.off data-coref/star_tgt2-5.off ALL 1 1 1 0 +data-coref/star_tgt1-1.off data-coref/star_tgt2-0.off ALL 1 1 1 0 +data-coref/star_tgt1-1.off data-coref/star_tgt2-1.off ALL 1 1 1 0 +data-coref/star_tgt1-1.off data-coref/star_tgt2-2.off ALL 0 1 1 1 +data-coref/star_tgt1-1.off data-coref/star_tgt2-3.off ALL 1 1 1 0 +data-coref/star_tgt1-1.off data-coref/star_tgt2-4.off ALL 0 1 1 1 +data-coref/star_tgt1-1.off data-coref/star_tgt2-5.off ALL 1 1 1 0 +data-coref/star_tgt1-2.off data-coref/star_tgt2-0.off ALL 1 1 1 0 +data-coref/star_tgt1-2.off data-coref/star_tgt2-1.off ALL 1 1 1 0 +data-coref/star_tgt1-2.off data-coref/star_tgt2-2.off ALL 0 1 1 1 +data-coref/star_tgt1-2.off data-coref/star_tgt2-3.off ALL 1 1 1 1 +data-coref/star_tgt1-2.off data-coref/star_tgt2-4.off ALL 0 1 1 1 +data-coref/star_tgt1-2.off data-coref/star_tgt2-5.off ALL 1 1 1 1 diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op_full.cmd b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op_full.cmd index db4bb33152d..f506d796e9f 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op_full.cmd +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op_full.cmd @@ -29,21 +29,3 @@ data-coref/cube_meshed.off data-coref/cube.off ALL 1 1 1 1 data-coref/cube.off data-coref/cube_interior_tgt.off ALL 1 1 1 1 data-coref/cube.off data-coref/edge_tangent_to_cube.off ALL 1 1 0 1 data-coref/cube_dig.off data-coref/wedge.off ALL 1 1 1 1 -data-coref/star_tgt1-0.off data-coref/star_tgt2-0.off ALL 1 1 1 0 -data-coref/star_tgt1-0.off data-coref/star_tgt2-1.off ALL 1 1 1 0 -data-coref/star_tgt1-0.off data-coref/star_tgt2-2.off ALL 0 1 1 1 -data-coref/star_tgt1-0.off data-coref/star_tgt2-3.off ALL 1 1 1 0 -data-coref/star_tgt1-0.off data-coref/star_tgt2-4.off ALL 0 1 1 1 -data-coref/star_tgt1-0.off data-coref/star_tgt2-5.off ALL 1 1 1 0 -data-coref/star_tgt1-1.off data-coref/star_tgt2-0.off ALL 1 1 1 0 -data-coref/star_tgt1-1.off data-coref/star_tgt2-1.off ALL 1 1 1 0 -data-coref/star_tgt1-1.off data-coref/star_tgt2-2.off ALL 0 1 1 1 -data-coref/star_tgt1-1.off data-coref/star_tgt2-3.off ALL 1 1 1 0 -data-coref/star_tgt1-1.off data-coref/star_tgt2-4.off ALL 0 1 1 1 -data-coref/star_tgt1-1.off data-coref/star_tgt2-5.off ALL 1 1 1 0 -data-coref/star_tgt1-2.off data-coref/star_tgt2-0.off ALL 1 1 1 0 -data-coref/star_tgt1-2.off data-coref/star_tgt2-1.off ALL 1 1 1 0 -data-coref/star_tgt1-2.off data-coref/star_tgt2-2.off ALL 0 1 1 1 -data-coref/star_tgt1-2.off data-coref/star_tgt2-3.off ALL 1 1 1 1 -data-coref/star_tgt1-2.off data-coref/star_tgt2-4.off ALL 0 1 1 1 -data-coref/star_tgt1-2.off data-coref/star_tgt2-5.off ALL 1 1 1 1 diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index b797ecf7a70..39c537dea5b 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -3191,8 +3191,8 @@ void MainWindow::on_actionSa_ve_Scene_as_Script_triggered() tr("Enter the name of your scene file.")); if(path.isEmpty()) return; - if(!path.contains("Polyhedron_demo_")) - path.prepend("Polyhedron_demo_"); + if(!path.contains("/tmp/Polyhedron_demo_")) + path.prepend("/tmp/Polyhedron_demo_"); try{ ssh_session session = nullptr; bool res = establish_ssh_session_from_agent(session, diff --git a/Polyhedron/demo/Polyhedron/Use_ssh.cpp b/Polyhedron/demo/Polyhedron/Use_ssh.cpp index 965abf23024..a4495160fbc 100644 --- a/Polyhedron/demo/Polyhedron/Use_ssh.cpp +++ b/Polyhedron/demo/Polyhedron/Use_ssh.cpp @@ -26,6 +26,10 @@ #include #include + +#include +#include + bool test_result(int res) { switch(res){ @@ -240,21 +244,22 @@ bool push_file(ssh_session &session, const char* dest_path, const char* filepath) { + std::size_t processed = 0; + sftp_file sftpfile; //copy a file - ssh_scp scp = ssh_scp_new( - session, SSH_SCP_WRITE | SSH_SCP_RECURSIVE, "/tmp"); - if (scp == nullptr) + sftp_session sftp = sftp_new(session); + if (sftp == nullptr) { - std::cerr<<"Error allocating scp session: %s\n" + std::cerr<<"Error allocating sftp session:\n" << ssh_get_error(session)< timespan(size); - std::this_thread::sleep_for(timespan); - if (res != SSH_OK) + while ( size > 0 ) { - std::cerr<< "Can't write to remote file: %s\n" - << ssh_get_error(session)< 16384) + s = 16384; + res = sftp_write(sftpfile, buffer.data() + processed, s); + if ( res < 0) + { + std::cerr<< "Can't write data to file:\n" + << ssh_get_error(session)< buffer; - - ssh_scp scp = ssh_scp_new( - session, SSH_SCP_READ | SSH_SCP_RECURSIVE, from_path); - if (scp == nullptr) + sftp_file sftpfile; + sftp_session sftp = sftp_new(session); + if (sftp == nullptr) { - std::cerr<<"Error allocating scp session: %s\n" + std::cerr<<"Error allocating sftp session:\n" << ssh_get_error(session)<size; buffer.resize(size); - if(ssh_scp_accept_request(scp) != SSH_OK) + while ( size > 0 ) { - std::cerr<< "Could not accept request."< 16384) + s = 16384; + res = sftp_read(sftpfile, buffer.data() + processed, s); + if ( res < 0) { - std::cerr<< "Error receiving file data: %s\n"<< ssh_get_error(session)<size; std::ofstream file(to_path, std::ios::binary |std::ios::trunc); if(!file.write(buffer.data(), size)) { std::cerr<<"Error while writing file."<\n_"; write_c3t3_points(os,tr,V); // fills V if the mode is BINARY write_cells(os,c3t3,V); - for(std::size_t i = 0; i< attributes.size(); ++i) + for(std::size_t i = 0; i< attributes.size(); ++i) { switch(attributes[i].second.which()){ case 0: write_attributes(os, *boost::get* >(attributes[i].second)); @@ -345,6 +345,8 @@ void output_to_vtu_with_attributes(std::ostream& os, write_attributes(os, *boost::get* >(attributes[i].second)); break; } + } + os << "\n\n"; } os << "\n"; } diff --git a/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/examples.txt b/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/examples.txt index 2446884a162..4f96d83d450 100644 --- a/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/examples.txt +++ b/Scale_space_reconstruction_3/doc/Scale_space_reconstruction_3/examples.txt @@ -1,5 +1,6 @@ /*! \example Scale_space_reconstruction_3/scale_space.cpp +\example Scale_space_reconstruction_3/scale_space_sm.cpp \example Scale_space_reconstruction_3/scale_space_incremental.cpp \example Scale_space_reconstruction_3/scale_space_manifold.cpp \example Scale_space_reconstruction_3/scale_space_advancing_front.cpp diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt index 8a7397b76d3..f08b349b318 100644 --- a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/CMakeLists.txt @@ -19,6 +19,8 @@ include(CGAL_Eigen3_support) if(TARGET CGAL::Eigen3_support) create_single_source_cgal_program("scale_space.cpp") target_link_libraries(scale_space PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("scale_space_sm.cpp") + target_link_libraries(scale_space_sm PUBLIC CGAL::Eigen3_support) create_single_source_cgal_program("scale_space_incremental.cpp") target_link_libraries(scale_space_incremental PUBLIC CGAL::Eigen3_support) create_single_source_cgal_program("scale_space_manifold.cpp") diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_incremental.cpp b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_incremental.cpp index 7164d7aa376..bb0f308b034 100644 --- a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_incremental.cpp +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_incremental.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -16,19 +17,6 @@ typedef Reconstruction::Point Point; typedef Reconstruction::Facet_const_iterator Facet_iterator; -// function for writing the reconstruction output in the off format -void dump_reconstruction(const Reconstruction& reconstruct, std::string name) -{ - std::ofstream output(name.c_str()); - output << "OFF " << reconstruct.number_of_points() << " " - << reconstruct.number_of_facets() << " 0\n"; - - std::copy(reconstruct.points_begin(), - reconstruct.points_end(), - std::ostream_iterator(output,"\n")); - for( Facet_iterator it = reconstruct.facets_begin(); it != reconstruct.facets_end(); ++it ) - output << "3 " << *it << std::endl; -} int main(int argc, char* argv[]) { @@ -70,14 +58,18 @@ int main(int argc, char* argv[]) if (i == 0) { std::cout << "First reconstruction done." << std::endl; - // Write the reconstruction. - dump_reconstruction(reconstruct, "reconstruction1.off"); + CGAL::IO::write_OFF("reconstruction1.off", + reconstruct.points(), + reconstruct.facets(), + CGAL::parameters::stream_precision(17)); } else { std::cout << "Second reconstruction done." << std::endl; - // Write the reconstruction. - dump_reconstruction(reconstruct, "reconstruction2.off"); + CGAL::IO::write_OFF("reconstruction2.off", + reconstruct.points(), + reconstruct.facets(), + CGAL::parameters::stream_precision(17)); } } diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_manifold.cpp b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_manifold.cpp index 0344b6454a5..61fb8efb57a 100644 --- a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_manifold.cpp +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_manifold.cpp @@ -21,7 +21,7 @@ typedef Mesher::Facet_const_iterator Mesher_iterator; typedef CGAL::Timer Timer; int main(int argc, char* argv[]) { - // Read the dat + // Read the data std::string fname = argc==1?CGAL::data_file_path("points_3/kitten.off"):argv[1]; std::cerr << "Reading " << std::flush; @@ -49,22 +49,18 @@ int main(int argc, char* argv[]) { reconstruct.reconstruct_surface(mesher); std::cerr << "Reconstruction done in " << t.time() << " sec." << std::endl; - t.reset(); + std::ofstream out("out.off"); // Write the reconstruction. for(Facet_iterator it = reconstruct.facets_begin(); it != reconstruct.facets_end(); ++it ) - out << "3 "<< *it << '\n'; // We write a '3' in front so that it can be assembled into an OFF file - - std::cerr << "Writing result in " << t.time() << " sec." << std::endl; - + // We write a '3' in front so that it can be assembled into an OFF file + out << "3 " << (*it)[0] << " " << (*it)[1] << " " << (*it)[2] << '\n'; out.close(); - t.reset(); std::ofstream garbage("garbage.off"); // Write facets that were removed to force manifold output for(Mesher_iterator it = mesher.garbage_begin(); it != mesher.garbage_end(); ++it ) - garbage << "3 "<< *it << '\n'; // We write a '3' in front so that it can be assembled into an OFF file - std::cerr << "Writing garbage facets in " << t.time() << " sec." << std::endl; + garbage << "3 " << (*it)[0] << " " << (*it)[1] << " " << (*it)[2] << '\n'; std::cerr << "Done." << std::endl; diff --git a/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_sm.cpp b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_sm.cpp new file mode 100644 index 00000000000..a562362bfcf --- /dev/null +++ b/Scale_space_reconstruction_3/examples/Scale_space_reconstruction_3/scale_space_sm.cpp @@ -0,0 +1,73 @@ +#include + +#include + +#include +#include +#include +#include + +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; + +typedef CGAL::Scale_space_surface_reconstruction_3< Kernel > Reconstruction; +typedef CGAL::Scale_space_reconstruction_3::Weighted_PCA_smoother< Kernel > Smoother; +typedef CGAL::Scale_space_reconstruction_3::Alpha_shape_mesher< Kernel > Mesher; + +typedef Reconstruction::Point Point; +typedef Reconstruction::Facet_const_iterator Facet_iterator; + +typedef CGAL::Surface_mesh Surface_mesh; +typedef boost::graph_traits::vertex_descriptor vertex_descriptor; + +int main(int argc, char* argv[]) { + // Read the data + std::string fname = argc==1?CGAL::data_file_path("points_3/kitten.off"):argv[1]; + + std::cerr << "Reading " << std::flush; + std::vector points; + if(!CGAL::IO::read_points(fname, std::back_inserter(points))) + { + std::cerr << "Error: cannot read file" << std::endl; + return EXIT_FAILURE; + } + + std::cerr << "done: " << points.size() << " points." << std::endl; + + // Construct the mesh in a scale space. + Reconstruction reconstruct(points.begin(), points.end() ); + Smoother smoother(10, 200 ); + reconstruct.increase_scale(4, smoother); + + Mesher mesher(smoother.squared_radius(), + false, // Do not separate shells + true // Force manifold output + ); + reconstruct.reconstruct_surface(mesher); + + Reconstruction::Point_range smoothed(reconstruct.points()); + Reconstruction::Facet_range polygons(reconstruct.facets()); + + CGAL::Polygon_mesh_processing::orient_polygon_soup(smoothed, polygons); + + Surface_mesh mesh; + CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(smoothed, polygons, mesh); + + // Also store the input points as vertex property + Surface_mesh::Property_map original; + bool created; + boost::tie(original, created) = mesh.add_property_map("v:original"); + assert(created); + + int i = 0; + for(auto v : vertices(mesh)){ + put(original, v, points[i++]); + } + + + std::cerr << "Done." << std::endl; + + return EXIT_SUCCESS; +} diff --git a/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h b/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h index 47410046e0e..d84d5842c2f 100644 --- a/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h +++ b/Scale_space_reconstruction_3/include/CGAL/Scale_space_surface_reconstruction_3.h @@ -53,21 +53,23 @@ public: typedef std::array Facet; ///< defines a facet of the surface (triple of point indices). #ifdef DOXYGEN_RUNNING + typedef unspecified_type Point_range; ///< defines a range points. typedef unspecified_type Point_iterator; ///< defines an iterator over the points. typedef const unspecified_type Point_const_iterator; ///< defines a constant iterator over the points. #else - typedef typename std::vector Point_vector; - typedef typename Point_vector::iterator Point_iterator; - typedef typename Point_vector::const_iterator Point_const_iterator; + typedef typename std::vector Point_range; + typedef typename Point_range::iterator Point_iterator; + typedef typename Point_range::const_iterator Point_const_iterator; #endif #ifdef DOXYGEN_RUNNING + typedef unspecified_type Facet_range; ///< defines a range of facets typedef unspecified_type Facet_iterator; ///< defines an iterator over the facets. typedef const unspecified_type Facet_const_iterator; ///< defines a constant iterator over the facets. #else - typedef typename std::vector Facet_vector; - typedef typename Facet_vector::iterator Facet_iterator; - typedef typename Facet_vector::const_iterator Facet_const_iterator; + typedef typename std::vector Facet_range; + typedef typename Facet_range::iterator Facet_iterator; + typedef typename Facet_range::const_iterator Facet_const_iterator; #endif // Default algorithms used (same as in old API) @@ -76,8 +78,8 @@ public: private: - Point_vector m_points; - Facet_vector m_facets; + Point_range m_points; + Facet_range m_facets; FT m_internal_squared_radius; // For backward compatibility @@ -233,6 +235,9 @@ public: /// gives the number of points of the surface. std::size_t number_of_points() const { return m_points.size(); } + /// gives the range of points + const Point_range& points() const { return m_points; } + /// gives an iterator to the first point at the current scale. /** \warning Changes to the scale-space do not cause an automatic update to * the surface. @@ -254,6 +259,9 @@ public: /// gives the number of facets of the surface. std::size_t number_of_facets() const { return m_facets.size(); } + /// gives the range of facets + const Facet_range& facets() const { return m_facets; } + /// gives an iterator to the first triple in the surface. /** \warning Changes to the surface may change its topology. */ @@ -292,16 +300,4 @@ std::ostream& operator<< (std::ostream& os, const CGAL::Scale_space_surface_reco } // namespace CGAL -template< typename T > -std::ostream& -operator<<( std::ostream& os, const std::array< T, 3 >& t ) { - return os << t[0] << " " << t[1] << " " << t[2]; -} - -template< typename T > -std::istream& -operator>>( std::istream& is, std::array< T, 3 >& t ) { - return is >> get<0>(t) >> get<1>(t) >> get<2>(t); -} - #endif // CGAL_SCALE_SPACE_SURFACE_RECONSTRUCTION_3_H diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt index 31c3939c926..7ca5146ab1f 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt @@ -306,7 +306,7 @@ int r = edge_collapse(surface_mesh, stop_predicate, .edge_is_border_map(ebmap) .get_cost(cf) .get_placement(pf) - .filter(filter + .filter(filter) .visitor(vis)); \endcode diff --git a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp index 9b492a82213..99bf18bc2ec 100644 --- a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp +++ b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp @@ -13,8 +13,6 @@ #include #include -#include - #include #include diff --git a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere.cpp b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere.cpp index 05a9135b26c..01a32e9e9a6 100644 --- a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere.cpp +++ b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere.cpp @@ -36,7 +36,7 @@ int main(int, char**) std::cout << "It has:\n"; std::cout << dtos.number_of_vertices() << " vertices\n"; std::cout << dtos.number_of_edges() << " edges\n"; - std::cout << dtos.number_of_faces() << " solid faces\n"; + std::cout << dtos.number_of_solid_faces() << " solid faces\n"; std::cout << dtos.number_of_ghost_faces() << " ghost faces\n" << std::endl; } diff --git a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_geo.cpp b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_geo.cpp index f2dcb474906..23bed505d5b 100644 --- a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_geo.cpp +++ b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_geo.cpp @@ -54,7 +54,7 @@ int main(int argc, char** argv) DToS2 dtos(points.begin(), points.end(), traits); std::cout << dtos.number_of_vertices() << " vertices" << std::endl; - std::cout << dtos.number_of_faces() << " solid faces" << std::endl; + std::cout << dtos.number_of_solid_faces() << " solid faces" << std::endl; std::cout << dtos.number_of_ghost_faces() << " ghost faces" << std::endl; CGAL::IO::write_OFF("result.off", dtos, CGAL::parameters::stream_precision(17)); diff --git a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_proj.cpp b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_proj.cpp index 814c36b7089..3dafdcf9bca 100644 --- a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_proj.cpp +++ b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_proj.cpp @@ -3,8 +3,6 @@ #include #include -#include - typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Projection_on_sphere_traits_3 Traits; @@ -36,7 +34,7 @@ int main(int, char**) std::cout << "The triangulation now has dimension: " << dtos.dimension() << " and\n"; std::cout << dtos.number_of_vertices() << " vertices" << std::endl; std::cout << dtos.number_of_edges() << " edges" << std::endl; - std::cout << dtos.number_of_faces() << " solid faces" << std::endl; + std::cout << dtos.number_of_solid_faces() << " solid faces" << std::endl; std::cout << dtos.number_of_ghost_faces() << " ghost faces" << std::endl; } diff --git a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_range.cpp b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_range.cpp index c6c433f824c..682eb394ffe 100644 --- a/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_range.cpp +++ b/Triangulation_on_sphere_2/examples/Triangulation_on_sphere_2/triang_on_sphere_range.cpp @@ -38,7 +38,7 @@ int main(int argc, char** argv) DToS2 dtos(points.begin(), points.end(), traits); std::cout << dtos.number_of_vertices() << " vertices" << std::endl; - std::cout << dtos.number_of_faces() << " solid faces" << std::endl; + std::cout << dtos.number_of_solid_faces() << " solid faces" << std::endl; CGAL::IO::write_OFF("result.off", dtos, CGAL::parameters::stream_precision(17)); diff --git a/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_2.h b/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_2.h index a447bc7e335..b235ad31d47 100644 --- a/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_2.h +++ b/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_2.h @@ -27,7 +27,6 @@ #include #include -#include #include #include