From 2260c4fab3756034d8fd80b1bbd7f079cae0b698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 3 Feb 2023 10:39:58 +0100 Subject: [PATCH 001/139] more than one curve can be on the left of an event with overlapping curves on the right --- .../Surface_sweep_2/Surface_sweep_2_impl.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h index de98db8e9a0..41d96180310 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h @@ -110,19 +110,28 @@ void Surface_sweep_2::_handle_left_curves() this->m_currentEvent->push_back_curve_to_right(sc); } else { - this->m_currentEvent->push_back_curve_to_left(sc); this->m_currentEvent->set_weak_intersection(); - this->m_visitor->update_event(this->m_currentEvent, sc); - _add_curve_to_right(this->m_currentEvent, sc); + auto status_line_it = this->m_status_line_insert_hint; + do{ + this->m_currentEvent->push_back_curve_to_left(sc); + this->m_visitor->update_event(this->m_currentEvent, sc); + _add_curve_to_right(this->m_currentEvent, sc); + ++status_line_it; + if (status_line_it==this->m_statusLine.end()) break; + if (this->m_statusLineCurveLess(this->m_currentEvent->point(), *status_line_it)!=EQUAL) + break; + sc = *status_line_it; + } + while(true); // the loop is only needed in case there are overlapping curve in right curves } - // sc is now on the left + // some subcurves have been addded on the left CGAL_SS_PRINT_TEXT("Event after update:"); CGAL_SS_PRINT_EOL(); CGAL_SS_PRINT_EVENT_INFO(this->m_currentEvent); CGAL_SS_PRINT_EOL(); CGAL_assertion(std::distance(this->m_currentEvent->left_curves_begin(), - this->m_currentEvent->left_curves_end())==1); + this->m_currentEvent->left_curves_end())!=0); } else { // The event is not located on any subcurve. From a1ff847b6a4ec05ce40e3e24b7d38d8a87fd868e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 2 Jan 2023 08:17:16 +0100 Subject: [PATCH 002/139] add "brute-force" version of autorefine() --- .../Polygon_mesh_processing/CMakeLists.txt | 1 + .../triangle_mesh_autorefinement.cpp | 29 + .../Polygon_mesh_processing/autorefinement.h | 507 ++++++++++++++++++ .../internal/parameters_interface.h | 1 + 4 files changed, 538 insertions(+) create mode 100644 Polygon_mesh_processing/examples/Polygon_mesh_processing/triangle_mesh_autorefinement.cpp create mode 100644 Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index 192e7d29b74..e188e01e3eb 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -50,6 +50,7 @@ create_single_source_cgal_program("match_faces.cpp") create_single_source_cgal_program("cc_compatible_orientations.cpp") create_single_source_cgal_program("hausdorff_distance_remeshing_example.cpp") create_single_source_cgal_program("hausdorff_bounded_error_distance_example.cpp") +create_single_source_cgal_program("triangle_mesh_autorefinement.cpp") find_package(Eigen3 3.2.0 QUIET) #(requires 3.2.0 or greater) include(CGAL_Eigen3_support) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangle_mesh_autorefinement.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangle_mesh_autorefinement.cpp new file mode 100644 index 00000000000..65db52fef2c --- /dev/null +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangle_mesh_autorefinement.cpp @@ -0,0 +1,29 @@ +#include +#include + +#include +#include + +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; +typedef Kernel::Point_3 Point; + +typedef CGAL::Surface_mesh Mesh; + +namespace PMP = CGAL::Polygon_mesh_processing; + +int main(int argc, char** argv) +{ + Mesh mesh; + + const std::string filename = argc == 1 ? CGAL::data_file_path("meshes/elephant.off") + : std::string(argv[1]); + CGAL::IO::read_polygon_mesh(filename, mesh); + + PMP::autorefine(mesh); + + CGAL::IO::write_polygon_mesh("autorefined.off", mesh, CGAL::parameters::stream_precision(17)); + + return 0; +} diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h new file mode 100644 index 00000000000..8c34b4041d8 --- /dev/null +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -0,0 +1,507 @@ +// Copyright (c) 2023 GeometryFactory (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_POLYGON_MESH_PROCESSING_AUTOREFINEMENT_H +#define CGAL_POLYGON_MESH_PROCESSING_AUTOREFINEMENT_H + +#include + +#include +#include +#include +#include + +// output +#include +#include + +#ifndef NDEBUG +// debug +#include +#endif + +#include + +namespace CGAL { +namespace Polygon_mesh_processing { + +#ifndef DOXYGEN_RUNNING +namespace autorefine_impl { + +template +void generate_subtriangles(const typename EK::Triangle_3& t, + const std::vector& segments, + const std::vector& points, + std::vector& new_triangles) +{ + typedef CGAL::Projection_traits_3 P_traits; + // typedef CGAL::Exact_intersections_tag Itag; + typedef CGAL::No_constraint_intersection_requiring_constructions_tag Itag; + typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; + + + P_traits cdt_traits(normal(t[0], t[1], t[2])); + CDT cdt(cdt_traits); + + cdt.insert_outside_affine_hull(t[0]); + cdt.insert_outside_affine_hull(t[1]); + typename CDT::Vertex_handle v = cdt.tds().insert_dim_up(cdt.infinite_vertex(), false); + v->set_point(t[2]); + + for (const typename EK::Segment_3& s : segments) + cdt.insert_constraint(s[0], s[1]); + + for (const typename EK::Point_3& p : points) + cdt.insert(p); + + for (typename CDT::Face_handle fh : cdt.finite_face_handles()) + { + new_triangles.emplace_back(fh->vertex(0)->point(), + fh->vertex(cdt.ccw(0))->point(), + fh->vertex(cdt.cw(0))->point()); + } +} + +template +struct Intersection_visitor +{ + std::vector& all_segments_1; + std::vector& all_segments_2; + std::vector& all_points_1; + std::vector& all_points_2; + + Intersection_visitor(std::vector& all_segments_1, + std::vector& all_segments_2, + std::vector& all_points_1, + std::vector& all_points_2) + : all_segments_1(all_segments_1) + , all_segments_2(all_segments_2) + , all_points_1(all_points_1) + , all_points_2(all_points_2) + {} + + typedef void result_type; + void operator()(const typename EK::Point_3& p) + { + all_points_1.push_back(p); + all_points_2.push_back(p); + } + + void operator()(const typename EK::Segment_3& s) + { + all_segments_1.push_back(s); + all_segments_2.push_back(s); + } + + void operator()(const typename EK::Triangle_3& t) + { + for (std::size_t i=1; i<3; ++i) + { + typename EK::Segment_3 s(t[i-1], t[i]); + all_segments_1.push_back(s); + all_segments_2.push_back(s); + } + } + + void operator()(const std::vector& poly) + { + std::size_t nbp = poly.size(); + for (std::size_t i=1; i +bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, const std::vector< std::vector>>& triangles) +{ + typedef typename Kernel_traits::value_type>::type IK; + typedef boost::graph_traits Graph_traits; + typedef typename Graph_traits::face_descriptor face_descriptor; + typedef typename Graph_traits::halfedge_descriptor halfedge_descriptor; + + std::vector soup_points; + std::vector > soup_triangles; + Cartesian_converter to_exact; + std::map point_id_map; + + auto get_point_id = [&](const typename EK::Point_3& pt) + { + auto insert_res = point_id_map.insert(std::make_pair(pt, soup_points.size())); + if (insert_res.second) + soup_points.push_back(pt); + return insert_res.first->second; + }; + + for (face_descriptor f : faces(tm)) + { + int tid = get(tid_map, f); + if (tid == -1) + { + halfedge_descriptor h = halfedge(f, tm); + soup_triangles.emplace_back( + CGAL::make_array(get_point_id(to_exact(get(vpm,source(h, tm)))), + get_point_id(to_exact(get(vpm,target(h, tm)))), + get_point_id(to_exact(get(vpm,target(next(h, tm), tm))))) + ); + } + else + { + for (const typename EK::Triangle_3& t : triangles[tid]) + { + soup_triangles.emplace_back(CGAL::make_array(get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2]))); + } + } + } + + typedef Surface_mesh Exact_mesh; + Exact_mesh etm; + orient_polygon_soup(soup_points, soup_triangles); + polygon_soup_to_polygon_mesh(soup_points, soup_triangles, etm); + typename Exact_mesh::Property_map is_border_map = + etm.template add_property_map("v:is_border", false).first; + for(typename Exact_mesh::Halfedge_index h : etm.halfedges()) + { + if (CGAL::is_border(h, etm)) + is_border_map[target(h, etm)] = true; + } + + //TODO: double check me + auto skip_faces = [&](const std::pair& p) + { + typename Exact_mesh::Halfedge_index h1 = etm.halfedge(p.first), h2=etm.halfedge(p.second); + + boost::container::small_vector bv1; + if (is_border_map[source(h1, etm)]) bv1.push_back(prev(h1, etm)); + if (is_border_map[target(h1, etm)]) bv1.push_back(h1); + if (is_border_map[target(next(h1, etm), etm)]) bv1.push_back(next(h1, etm)); + if (bv1.empty()) return false; + + boost::container::small_vector bv2; + if (is_border_map[source(h2, etm)]) bv2.push_back(prev(h2, etm)); + if (is_border_map[target(h2, etm)]) bv2.push_back(h2); + if (is_border_map[target(next(h2, etm), etm)]) bv2.push_back(next(h2, etm)); + if (bv2.empty()) return false; + + //collect identical border vertices + boost::container::small_vector, 3> common; + for(typename Exact_mesh::Halfedge_index h1 : bv1) + for(typename Exact_mesh::Halfedge_index h2 : bv2) + if (etm.point(target(h1, etm))==etm.point(target(h2,etm))) + common.push_back(std::make_pair(h1,h2)); + + if (common.empty()) return false; + + switch (common.size()) + { + case 1: + { + // geometric check if the opposite segments intersect the triangles + const typename EK::Triangle_3 t1(etm.point(source(h1,etm)), + etm.point(target(h1,etm)), + etm.point(target(next(h1,etm),etm))); + const typename EK::Triangle_3 t2(etm.point(source(h2,etm)), + etm.point(target(h2,etm)), + etm.point(target(next(h2,etm),etm))); + + const typename EK::Segment_3 s1(etm.point(source(common[0].first,etm)), etm.point(target(next(common[0].first,etm),etm))); + const typename EK::Segment_3 s2(etm.point(source(common[0].second,etm)), etm.point(target(next(common[0].second,etm),etm))); + + if(do_intersect(t1, s2) || do_intersect(t2, s1)) + return false; + return true; + } + case 2: + { + // shared edge + h1 = next(common[0].first, etm) == common[1].first ? common[1].first : common[0].first; + h2 = next(common[0].second, etm) == common[1].second ? common[1].second : common[0].second; + + if ( is_border(etm.opposite(h1), etm) && + is_border(etm.opposite(h2), etm) ) + { + if( CGAL::coplanar(etm.point(source(h1,etm)), + etm.point(target(h1,etm)), + etm.point(target(etm.next(h1),etm)), + etm.point(source(h1,etm))) && + CGAL::coplanar_orientation(etm.point(source(h1,etm)), + etm.point(target(h1,etm)), + etm.point(target(etm.next(h1),etm)), + etm.point(source(h1,etm))) == CGAL::POSITIVE) + { + return false; + } + return true; + } + else + { + // TODO: 2 identical border vertices, no common edge on the boundary. Not sure what to do + return false; + } + } + default: // size == 3 + return true; + } + }; + + std::vector< std::pair > si_faces; + self_intersections(etm, + CGAL::filter_output_iterator(std::back_inserter(si_faces), + skip_faces)); + + return si_faces.empty(); +} + +} // end of autorefine_impl +#endif + +/** + * \ingroup PMP_corefinement_grp + * \link coref_def_subsec autorefines \endlink `tm`. Refines a triangle mesh + * so that no triangles intersects in their interior. + * Self-intersection edges will be marked as constrained. If an edge that was marked as + * constrained is split, its sub-edges will be marked as constrained as well. + * + * @tparam TriangleMesh a model of `HalfedgeListGraph`, `FaceListGraph`, and `MutableFaceGraph` + * @tparam NamedParameters a sequence of \ref namedparameters + * + * @param tm input triangulated surface mesh + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + * + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class} + * \cgalParamType{a class model of `PMPSelfIntersectionTraits`} + * \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} + * \cgalParamNEnd + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{vertex_point_map} + * \cgalParamDescription{a property map associating points to the vertices of `tm`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `%Point_3` as value type} + * \cgalParamDefault{`boost::get(CGAL::vertex_point, tm)`} + * \cgalParamExtra{If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` + * must be available in `TriangleMesh`.} + * \cgalParamNEnd + * + * \cgalParamNBegin{edge_is_constrained_map} + * \cgalParamDescription{a property map containing the constrained-or-not status of each edge of `tm`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%edge_descriptor` + * as key type and `bool` as value type} + * \cgalParamDefault{a constant property map returning `false` for any edge} + * \cgalParamNEnd + * + * \cgalParamNBegin{face_index_map} + * \cgalParamDescription{a property map associating to each face of `tm` a unique index between `0` and `num_faces(tm) - 1`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%face_descriptor` + * as key type and `std::size_t` as value type} + * \cgalParamDefault{an automatically indexed internal map} + * \cgalParamExtra{If the property map is writable, the indices of the faces of `tm1` and `tm2` + * will be set after the corefinement is done.} + * \cgalParamNEnd + * + * \cgalParamNBegin{visitor} + * \cgalParamDescription{a visitor used to track the creation of new faces} + * \cgalParamType{a class model of `PMPCorefinementVisitor`} + * \cgalParamDefault{`Corefinement::Default_visitor`} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + */ +template +void +autorefine( TriangleMesh& tm, + const NamedParameters& np = parameters::default_values()) +{ + //TODO: what about degenerate faces? + + using parameters::choose_parameter; + using parameters::get_parameter; + + typedef typename GetGeomTraits::type GT; + GT traits = choose_parameter(get_parameter(np, internal_np::geom_traits)); + + typedef typename GetVertexPointMap::type VPM; + VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), + get_property_map(vertex_point, tm)); + + typedef typename internal_np::Lookup_named_param_def < + internal_np::concurrency_tag_t, + NamedParameters, + Sequential_tag + > ::type Concurrency_tag; + + typedef boost::graph_traits Graph_traits; + typedef typename Graph_traits::face_descriptor face_descriptor; + typedef typename Graph_traits::halfedge_descriptor halfedge_descriptor; + typedef typename Graph_traits::vertex_descriptor vertex_descriptor; + typedef std::pair Pair_of_faces; + + std::vector si_pairs; + + // collect intersecting pairs of triangles + self_intersections(tm, std::back_inserter(si_pairs), np); + + if (si_pairs.empty()) return; + + // assign an id per triangle involved in an intersection + // + the faces involved in the intersection + typedef CGAL::dynamic_face_property_t Face_property_tag; + typedef typename boost::property_map::type Triangle_id_map; + + Triangle_id_map tid_map = get(Face_property_tag(), tm); + for (face_descriptor f : faces(tm)) + put(tid_map, f, -1); + + std::vector intersected_faces; + int tid=-1; + for (const Pair_of_faces& p : si_pairs) + { + if (get(tid_map, p.first)==-1) + { + put(tid_map, p.first, ++tid); + intersected_faces.push_back(p.first); + } + if (get(tid_map, p.second)==-1) + { + put(tid_map, p.second, ++tid); + intersected_faces.push_back(p.second); + } + } + + // init the vector of triangles used for the autorefinement of triangles + typedef CGAL::Exact_predicates_exact_constructions_kernel EK; + std::vector< std::vector > triangles(tid+1); + Cartesian_converter to_exact; + + for(face_descriptor f : intersected_faces) + { + halfedge_descriptor h = halfedge(f, tm); + triangles[get(tid_map, f)].emplace_back( + to_exact( get(vpm, source(h, tm)) ), + to_exact( get(vpm, target(h, tm)) ), + to_exact( get(vpm, target(next(h, tm), tm)) ) ); + } + + typename EK::Intersect_3 intersection = EK().intersect_3_object(); + for (const Pair_of_faces& p : si_pairs) + { + int i1 = get(tid_map, p.first), + i2 = get(tid_map, p.second); + + + std::size_t nbt_1 = triangles[i1].size(), + nbt_2 = triangles[i2].size(); + + std::vector< std::vector > all_segments_1(nbt_1); + std::vector< std::vector > all_segments_2(nbt_2); + std::vector< std::vector > all_points_1(nbt_1); + std::vector< std::vector > all_points_2(nbt_2); + + std::vector t1_subtriangles, t2_subtriangles; + for (std::size_t it1=0; it1 intersection_visitor(all_segments_1[it1], all_segments_2[it2], + all_points_1[it1], all_points_2[it2]); + + boost::apply_visitor(intersection_visitor, *inter); + } + } + } + + // now refine triangles + std::vector new_triangles; + for(std::size_t it1=0; it1(triangles[i1][it1], all_segments_1[it1], all_points_1[it1], new_triangles); + } + triangles[i1].swap(new_triangles); + new_triangles.clear(); + for(std::size_t it2=0; it2(triangles[i2][it2], all_segments_2[it2], all_points_2[it2], new_triangles); + } + triangles[i2].swap(new_triangles); + } + + CGAL_assertion( autorefine_impl::is_output_valid(tm, vpm, tid_map, triangles) ); + + // brute force output: create a soup, orient and to-mesh + // WARNING: there is no reason when using double that identical exact points are identical in double + std::vector soup_points; + std::vector > soup_triangles; + Cartesian_converter to_input; + std::map point_id_map; + + for (vertex_descriptor v : vertices(tm)) + { + if (point_id_map.insert(std::make_pair(to_exact(get(vpm,v)), soup_points.size())).second) + soup_points.push_back(get(vpm,v)); + } + + auto get_point_id = [&](const typename EK::Point_3& pt) + { + auto insert_res = point_id_map.insert(std::make_pair(pt, soup_points.size())); + if (insert_res.second) + soup_points.push_back(to_input(pt)); + return insert_res.first->second; + }; + + for (face_descriptor f : faces(tm)) + { + int tid = get(tid_map, f); + if (tid == -1) + { + halfedge_descriptor h = halfedge(f, tm); + soup_triangles.emplace_back( + CGAL::make_array(get_point_id(to_exact(get(vpm,source(h, tm)))), + get_point_id(to_exact(get(vpm,target(h, tm)))), + get_point_id(to_exact(get(vpm,target(next(h, tm), tm))))) + ); + } + else + { + for (const typename EK::Triangle_3& t : triangles[tid]) + { + soup_triangles.emplace_back(CGAL::make_array(get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2]))); + } + } + } + clear(tm); + orient_polygon_soup(soup_points, soup_triangles); + polygon_soup_to_polygon_mesh(soup_points, soup_triangles, tm); +} + +} } // end of CGAL::Polygon_mesh_processing + +#endif // CGAL_POLYGON_MESH_PROCESSING_AUTOREFINEMENT_H diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h index 5c649faa56c..7d758abc4ee 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h @@ -45,6 +45,7 @@ CGAL_add_named_parameter(implementation_tag_t, implementation_tag, implementatio CGAL_add_named_parameter(prevent_unselection_t, prevent_unselection, prevent_unselection) CGAL_add_named_parameter(verbose_t, verbose, verbose) +CGAL_add_named_parameter(concurrency_tag_t, concurrency_tag, concurrency_tag) // List of named parameters used for IO CGAL_add_named_parameter(vertex_normal_output_iterator_t, vertex_normal_output_iterator, vertex_normal_output_iterator) From b0edd90580ea3044ca3fbfe11086d5413f9338cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 2 Jan 2023 17:21:01 +0100 Subject: [PATCH 003/139] add option to directly dump the soup --- .../Polygon_mesh_processing/autorefinement.h | 149 ++++++++++-------- 1 file changed, 84 insertions(+), 65 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 8c34b4041d8..fd124bce857 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -266,67 +266,12 @@ bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, const std::vec } } // end of autorefine_impl -#endif -/** - * \ingroup PMP_corefinement_grp - * \link coref_def_subsec autorefines \endlink `tm`. Refines a triangle mesh - * so that no triangles intersects in their interior. - * Self-intersection edges will be marked as constrained. If an edge that was marked as - * constrained is split, its sub-edges will be marked as constrained as well. - * - * @tparam TriangleMesh a model of `HalfedgeListGraph`, `FaceListGraph`, and `MutableFaceGraph` - * @tparam NamedParameters a sequence of \ref namedparameters - * - * @param tm input triangulated surface mesh - * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below - * - * \cgalParamNBegin{geom_traits} - * \cgalParamDescription{an instance of a geometric traits class} - * \cgalParamType{a class model of `PMPSelfIntersectionTraits`} - * \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} - * \cgalParamNEnd - * - * \cgalNamedParamsBegin - * \cgalParamNBegin{vertex_point_map} - * \cgalParamDescription{a property map associating points to the vertices of `tm`} - * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` - * as key type and `%Point_3` as value type} - * \cgalParamDefault{`boost::get(CGAL::vertex_point, tm)`} - * \cgalParamExtra{If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` - * must be available in `TriangleMesh`.} - * \cgalParamNEnd - * - * \cgalParamNBegin{edge_is_constrained_map} - * \cgalParamDescription{a property map containing the constrained-or-not status of each edge of `tm`} - * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%edge_descriptor` - * as key type and `bool` as value type} - * \cgalParamDefault{a constant property map returning `false` for any edge} - * \cgalParamNEnd - * - * \cgalParamNBegin{face_index_map} - * \cgalParamDescription{a property map associating to each face of `tm` a unique index between `0` and `num_faces(tm) - 1`} - * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%face_descriptor` - * as key type and `std::size_t` as value type} - * \cgalParamDefault{an automatically indexed internal map} - * \cgalParamExtra{If the property map is writable, the indices of the faces of `tm1` and `tm2` - * will be set after the corefinement is done.} - * \cgalParamNEnd - * - * \cgalParamNBegin{visitor} - * \cgalParamDescription{a visitor used to track the creation of new faces} - * \cgalParamType{a class model of `PMPCorefinementVisitor`} - * \cgalParamDefault{`Corefinement::Default_visitor`} - * \cgalParamNEnd - * \cgalNamedParamsEnd - * - */ -template -void -autorefine( TriangleMesh& tm, - const NamedParameters& np = parameters::default_values()) +template +void autorefine_soup_output(const TriangleMesh& tm, + std::vector& soup_points, + std::vector >& soup_triangles, + const NamedParameters& np = parameters::default_values()) { //TODO: what about degenerate faces? @@ -336,9 +281,9 @@ autorefine( TriangleMesh& tm, typedef typename GetGeomTraits::type GT; GT traits = choose_parameter(get_parameter(np, internal_np::geom_traits)); - typedef typename GetVertexPointMap::type VPM; + typedef typename GetVertexPointMap::const_type VPM; VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), - get_property_map(vertex_point, tm)); + get_const_property_map(vertex_point, tm)); typedef typename internal_np::Lookup_named_param_def < internal_np::concurrency_tag_t, @@ -362,7 +307,7 @@ autorefine( TriangleMesh& tm, // assign an id per triangle involved in an intersection // + the faces involved in the intersection typedef CGAL::dynamic_face_property_t Face_property_tag; - typedef typename boost::property_map::type Triangle_id_map; + typedef typename boost::property_map::const_type Triangle_id_map; Triangle_id_map tid_map = get(Face_property_tag(), tm); for (face_descriptor f : faces(tm)) @@ -458,8 +403,6 @@ autorefine( TriangleMesh& tm, // brute force output: create a soup, orient and to-mesh // WARNING: there is no reason when using double that identical exact points are identical in double - std::vector soup_points; - std::vector > soup_triangles; Cartesian_converter to_input; std::map point_id_map; @@ -497,11 +440,87 @@ autorefine( TriangleMesh& tm, } } } + +} +#endif + +/** + * \ingroup PMP_corefinement_grp + * \link coref_def_subsec autorefines \endlink `tm`. Refines a triangle mesh + * so that no triangles intersects in their interior. + * Self-intersection edges will be marked as constrained. If an edge that was marked as + * constrained is split, its sub-edges will be marked as constrained as well. + * + * @tparam TriangleMesh a model of `HalfedgeListGraph`, `FaceListGraph`, and `MutableFaceGraph` + * @tparam NamedParameters a sequence of \ref namedparameters + * + * @param tm input triangulated surface mesh + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + * + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class} + * \cgalParamType{a class model of `PMPSelfIntersectionTraits`} + * \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} + * \cgalParamNEnd + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{vertex_point_map} + * \cgalParamDescription{a property map associating points to the vertices of `tm`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `%Point_3` as value type} + * \cgalParamDefault{`boost::get(CGAL::vertex_point, tm)`} + * \cgalParamExtra{If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` + * must be available in `TriangleMesh`.} + * \cgalParamNEnd + * + * \cgalParamNBegin{edge_is_constrained_map} + * \cgalParamDescription{a property map containing the constrained-or-not status of each edge of `tm`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%edge_descriptor` + * as key type and `bool` as value type} + * \cgalParamDefault{a constant property map returning `false` for any edge} + * \cgalParamNEnd + * + * \cgalParamNBegin{face_index_map} + * \cgalParamDescription{a property map associating to each face of `tm` a unique index between `0` and `num_faces(tm) - 1`} + * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%face_descriptor` + * as key type and `std::size_t` as value type} + * \cgalParamDefault{an automatically indexed internal map} + * \cgalParamExtra{If the property map is writable, the indices of the faces of `tm1` and `tm2` + * will be set after the corefinement is done.} + * \cgalParamNEnd + * + * \cgalParamNBegin{visitor} + * \cgalParamDescription{a visitor used to track the creation of new faces} + * \cgalParamType{a class model of `PMPCorefinementVisitor`} + * \cgalParamDefault{`Corefinement::Default_visitor`} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + */ +template +void +autorefine( TriangleMesh& tm, + const NamedParameters& np = parameters::default_values()) +{ + using parameters::choose_parameter; + using parameters::get_parameter; + + typedef typename GetGeomTraits::type GT; + GT traits = choose_parameter(get_parameter(np, internal_np::geom_traits)); + + std::vector soup_points; + std::vector > soup_triangles; + + autorefine_soup_output(tm, soup_points, soup_triangles, np); + clear(tm); orient_polygon_soup(soup_points, soup_triangles); polygon_soup_to_polygon_mesh(soup_points, soup_triangles, tm); } + } } // end of CGAL::Polygon_mesh_processing #endif // CGAL_POLYGON_MESH_PROCESSING_AUTOREFINEMENT_H From 47ac016af779ab6a987ee16c62bbf723bd4c182f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 2 Jan 2023 17:32:35 +0100 Subject: [PATCH 004/139] skip degenerate faces --- .../Polygon_mesh_processing/autorefinement.h | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index fd124bce857..4b7020b5615 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -125,8 +126,8 @@ struct Intersection_visitor } }; -template -bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, const std::vector< std::vector>>& triangles) +template +bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, Is_degen_map is_degen, const std::vector< std::vector>>& triangles) { typedef typename Kernel_traits::value_type>::type IK; typedef boost::graph_traits Graph_traits; @@ -148,6 +149,7 @@ bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, const std::vec for (face_descriptor f : faces(tm)) { + if (get(is_degen, f)) continue; // skip degenerate faces int tid = get(tid_map, f); if (tid == -1) { @@ -273,8 +275,6 @@ void autorefine_soup_output(const TriangleMesh& tm, std::vector >& soup_triangles, const NamedParameters& np = parameters::default_values()) { - //TODO: what about degenerate faces? - using parameters::choose_parameter; using parameters::get_parameter; @@ -304,12 +304,20 @@ void autorefine_soup_output(const TriangleMesh& tm, if (si_pairs.empty()) return; + // mark degenerate faces so that we can ignore them + typedef CGAL::dynamic_face_property_t Degen_property_tag; + typedef typename boost::property_map::const_type Is_degen_map; + Is_degen_map is_degen = get(Degen_property_tag(), tm); + + for(face_descriptor f : faces(tm)) + put(is_degen, f, is_degenerate_triangle_face(f, tm, np)); + // assign an id per triangle involved in an intersection // + the faces involved in the intersection - typedef CGAL::dynamic_face_property_t Face_property_tag; - typedef typename boost::property_map::const_type Triangle_id_map; + typedef CGAL::dynamic_face_property_t TID_property_tag; + typedef typename boost::property_map::const_type Triangle_id_map; - Triangle_id_map tid_map = get(Face_property_tag(), tm); + Triangle_id_map tid_map = get(TID_property_tag(), tm); for (face_descriptor f : faces(tm)) put(tid_map, f, -1); @@ -317,12 +325,12 @@ void autorefine_soup_output(const TriangleMesh& tm, int tid=-1; for (const Pair_of_faces& p : si_pairs) { - if (get(tid_map, p.first)==-1) + if (get(tid_map, p.first)==-1 && !get(is_degen, p.first)) { put(tid_map, p.first, ++tid); intersected_faces.push_back(p.first); } - if (get(tid_map, p.second)==-1) + if (get(tid_map, p.second)==-1 && !get(is_degen, p.second)) { put(tid_map, p.second, ++tid); intersected_faces.push_back(p.second); @@ -349,6 +357,7 @@ void autorefine_soup_output(const TriangleMesh& tm, int i1 = get(tid_map, p.first), i2 = get(tid_map, p.second); + if (i1==-1 || i2==-1) continue; //skip degenerate faces std::size_t nbt_1 = triangles[i1].size(), nbt_2 = triangles[i2].size(); @@ -399,7 +408,7 @@ void autorefine_soup_output(const TriangleMesh& tm, triangles[i2].swap(new_triangles); } - CGAL_assertion( autorefine_impl::is_output_valid(tm, vpm, tid_map, triangles) ); + CGAL_assertion( autorefine_impl::is_output_valid(tm, vpm, tid_map, is_degen, triangles) ); // brute force output: create a soup, orient and to-mesh // WARNING: there is no reason when using double that identical exact points are identical in double @@ -422,6 +431,8 @@ void autorefine_soup_output(const TriangleMesh& tm, for (face_descriptor f : faces(tm)) { + if (get(is_degen, f)) continue; //skip degenerate faces + int tid = get(tid_map, f); if (tid == -1) { @@ -440,7 +451,6 @@ void autorefine_soup_output(const TriangleMesh& tm, } } } - } #endif From 6df9926f9b6ea6553be1fbcfd1c0996e76b802f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 2 Jan 2023 17:47:04 +0100 Subject: [PATCH 005/139] add another example with soup as input --- .../Polygon_mesh_processing/CMakeLists.txt | 1 + .../soup_autorefinement.cpp | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index e188e01e3eb..d2faeb70cb2 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -51,6 +51,7 @@ create_single_source_cgal_program("cc_compatible_orientations.cpp") create_single_source_cgal_program("hausdorff_distance_remeshing_example.cpp") create_single_source_cgal_program("hausdorff_bounded_error_distance_example.cpp") create_single_source_cgal_program("triangle_mesh_autorefinement.cpp") +create_single_source_cgal_program("soup_autorefinement.cpp") find_package(Eigen3 3.2.0 QUIET) #(requires 3.2.0 or greater) include(CGAL_Eigen3_support) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp new file mode 100644 index 00000000000..fa1f5d68690 --- /dev/null +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp @@ -0,0 +1,39 @@ +#include +#include + +#include +#include +#include +#include +#include + +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; +typedef Kernel::Point_3 Point; + +typedef CGAL::Surface_mesh Mesh; + +namespace PMP = CGAL::Polygon_mesh_processing; + +int main(int argc, char** argv) +{ + const std::string filename = argc == 1 ? CGAL::data_file_path("meshes/elephant.off") + : std::string(argv[1]); + + std::vector input_points; + std::vector > input_triangles; + + CGAL::IO::read_polygon_soup(filename, input_points, input_triangles); + PMP::repair_polygon_soup(input_points, input_triangles); + + Mesh mesh; + PMP::orient_polygon_soup(input_points, input_triangles); + PMP::polygon_soup_to_polygon_mesh(input_points, input_triangles, mesh); + + PMP::autorefine(mesh); + + CGAL::IO::write_polygon_mesh("autorefined.off", mesh, CGAL::parameters::stream_precision(17)); + + return 0; +} From e1414de8d935cc5da43682c48b5419823b806c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 2 Jan 2023 18:09:26 +0100 Subject: [PATCH 006/139] add debug --- .../Polygon_mesh_processing/autorefinement.h | 46 +++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 4b7020b5615..8dd8d28fcfc 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -181,6 +181,17 @@ bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, Is_degen_map i is_border_map[target(h, etm)] = true; } +#ifdef CGAL_DEBUG_PMP_AUTOREFINE + std::cerr << std::setprecision(17); + auto verbose_fail_msg = [&](int i, const std::pair& p) + { + typename Exact_mesh::Halfedge_index h1 = halfedge(p.first, etm), h2 = halfedge(p.second, etm); + std::cerr << "DEBUG: failing at check #" << i << "\n"; + std::cerr << "DEBUG: " << etm.point(source(h1, etm)) << " " << etm.point(target(h1, etm)) << " " << etm.point(target(next(h1, etm), etm)) << " " << etm.point(source(h1, etm)) << "\n"; + std::cerr << "DEBUG: " << etm.point(source(h2, etm)) << " " << etm.point(target(h2, etm)) << " " << etm.point(target(next(h2, etm), etm)) << " " << etm.point(source(h2, etm)) << "\n"; + }; +#endif + //TODO: double check me auto skip_faces = [&](const std::pair& p) { @@ -190,13 +201,25 @@ bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, Is_degen_map i if (is_border_map[source(h1, etm)]) bv1.push_back(prev(h1, etm)); if (is_border_map[target(h1, etm)]) bv1.push_back(h1); if (is_border_map[target(next(h1, etm), etm)]) bv1.push_back(next(h1, etm)); - if (bv1.empty()) return false; + if (bv1.empty()) + { +#ifdef CGAL_DEBUG_PMP_AUTOREFINE + verbose_fail_msg(1, p); +#endif + return false; + } boost::container::small_vector bv2; if (is_border_map[source(h2, etm)]) bv2.push_back(prev(h2, etm)); if (is_border_map[target(h2, etm)]) bv2.push_back(h2); if (is_border_map[target(next(h2, etm), etm)]) bv2.push_back(next(h2, etm)); - if (bv2.empty()) return false; + if (bv2.empty()) + { +#ifdef CGAL_DEBUG_PMP_AUTOREFINE + verbose_fail_msg(2, p); +#endif + return false; + } //collect identical border vertices boost::container::small_vector, 3> common; @@ -205,7 +228,13 @@ bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, Is_degen_map i if (etm.point(target(h1, etm))==etm.point(target(h2,etm))) common.push_back(std::make_pair(h1,h2)); - if (common.empty()) return false; + if (common.empty()) + { +#ifdef CGAL_DEBUG_PMP_AUTOREFINE + verbose_fail_msg(3, p); +#endif + return false; + } switch (common.size()) { @@ -223,7 +252,12 @@ bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, Is_degen_map i const typename EK::Segment_3 s2(etm.point(source(common[0].second,etm)), etm.point(target(next(common[0].second,etm),etm))); if(do_intersect(t1, s2) || do_intersect(t2, s1)) + { +#ifdef CGAL_DEBUG_PMP_AUTOREFINE + verbose_fail_msg(4, p); +#endif return false; + } return true; } case 2: @@ -244,6 +278,9 @@ bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, Is_degen_map i etm.point(target(etm.next(h1),etm)), etm.point(source(h1,etm))) == CGAL::POSITIVE) { +#ifdef CGAL_DEBUG_PMP_AUTOREFINE + verbose_fail_msg(5, p); +#endif return false; } return true; @@ -251,6 +288,9 @@ bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, Is_degen_map i else { // TODO: 2 identical border vertices, no common edge on the boundary. Not sure what to do +#ifdef CGAL_DEBUG_PMP_AUTOREFINE + verbose_fail_msg(6, p); +#endif return false; } } From 85368c43c6258e67aca26af6985fb57884642901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 2 Jan 2023 19:38:10 +0100 Subject: [PATCH 007/139] use all vertices in the check --- .../Polygon_mesh_processing/autorefinement.h | 79 ++++++------------- 1 file changed, 23 insertions(+), 56 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 8dd8d28fcfc..fd5e7312c26 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -173,13 +173,6 @@ bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, Is_degen_map i Exact_mesh etm; orient_polygon_soup(soup_points, soup_triangles); polygon_soup_to_polygon_mesh(soup_points, soup_triangles, etm); - typename Exact_mesh::Property_map is_border_map = - etm.template add_property_map("v:is_border", false).first; - for(typename Exact_mesh::Halfedge_index h : etm.halfedges()) - { - if (CGAL::is_border(h, etm)) - is_border_map[target(h, etm)] = true; - } #ifdef CGAL_DEBUG_PMP_AUTOREFINE std::cerr << std::setprecision(17); @@ -197,41 +190,27 @@ bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, Is_degen_map i { typename Exact_mesh::Halfedge_index h1 = etm.halfedge(p.first), h2=etm.halfedge(p.second); - boost::container::small_vector bv1; - if (is_border_map[source(h1, etm)]) bv1.push_back(prev(h1, etm)); - if (is_border_map[target(h1, etm)]) bv1.push_back(h1); - if (is_border_map[target(next(h1, etm), etm)]) bv1.push_back(next(h1, etm)); - if (bv1.empty()) - { -#ifdef CGAL_DEBUG_PMP_AUTOREFINE - verbose_fail_msg(1, p); -#endif - return false; - } + boost::container::small_vector v1; + v1.push_back(prev(h1, etm)); + v1.push_back(h1); + v1.push_back(next(h1, etm)); - boost::container::small_vector bv2; - if (is_border_map[source(h2, etm)]) bv2.push_back(prev(h2, etm)); - if (is_border_map[target(h2, etm)]) bv2.push_back(h2); - if (is_border_map[target(next(h2, etm), etm)]) bv2.push_back(next(h2, etm)); - if (bv2.empty()) - { -#ifdef CGAL_DEBUG_PMP_AUTOREFINE - verbose_fail_msg(2, p); -#endif - return false; - } + boost::container::small_vector v2; + v2.push_back(prev(h2, etm)); + v2.push_back(h2); + v2.push_back(next(h2, etm)); - //collect identical border vertices + //collect identical vertices boost::container::small_vector, 3> common; - for(typename Exact_mesh::Halfedge_index h1 : bv1) - for(typename Exact_mesh::Halfedge_index h2 : bv2) + for(typename Exact_mesh::Halfedge_index h1 : v1) + for(typename Exact_mesh::Halfedge_index h2 : v2) if (etm.point(target(h1, etm))==etm.point(target(h2,etm))) common.push_back(std::make_pair(h1,h2)); if (common.empty()) { #ifdef CGAL_DEBUG_PMP_AUTOREFINE - verbose_fail_msg(3, p); + verbose_fail_msg(1, p); #endif return false; } @@ -254,7 +233,7 @@ bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, Is_degen_map i if(do_intersect(t1, s2) || do_intersect(t2, s1)) { #ifdef CGAL_DEBUG_PMP_AUTOREFINE - verbose_fail_msg(4, p); + verbose_fail_msg(2, p); #endif return false; } @@ -266,33 +245,21 @@ bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, Is_degen_map i h1 = next(common[0].first, etm) == common[1].first ? common[1].first : common[0].first; h2 = next(common[0].second, etm) == common[1].second ? common[1].second : common[0].second; - if ( is_border(etm.opposite(h1), etm) && - is_border(etm.opposite(h2), etm) ) + if( CGAL::coplanar(etm.point(source(h1,etm)), + etm.point(target(h1,etm)), + etm.point(target(etm.next(h1),etm)), + etm.point(source(h1,etm))) && + CGAL::coplanar_orientation(etm.point(source(h1,etm)), + etm.point(target(h1,etm)), + etm.point(target(etm.next(h1),etm)), + etm.point(source(h1,etm))) == CGAL::POSITIVE) { - if( CGAL::coplanar(etm.point(source(h1,etm)), - etm.point(target(h1,etm)), - etm.point(target(etm.next(h1),etm)), - etm.point(source(h1,etm))) && - CGAL::coplanar_orientation(etm.point(source(h1,etm)), - etm.point(target(h1,etm)), - etm.point(target(etm.next(h1),etm)), - etm.point(source(h1,etm))) == CGAL::POSITIVE) - { #ifdef CGAL_DEBUG_PMP_AUTOREFINE - verbose_fail_msg(5, p); -#endif - return false; - } - return true; - } - else - { - // TODO: 2 identical border vertices, no common edge on the boundary. Not sure what to do -#ifdef CGAL_DEBUG_PMP_AUTOREFINE - verbose_fail_msg(6, p); + verbose_fail_msg(3, p); #endif return false; } + return true; } default: // size == 3 return true; From 944475f169213f38a04637480f0be7aaa080b98c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 2 Jan 2023 19:38:38 +0100 Subject: [PATCH 008/139] triangulate input faces --- .../examples/Polygon_mesh_processing/soup_autorefinement.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp index fa1f5d68690..8ca983aa31c 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -30,6 +31,7 @@ int main(int argc, char** argv) Mesh mesh; PMP::orient_polygon_soup(input_points, input_triangles); PMP::polygon_soup_to_polygon_mesh(input_points, input_triangles, mesh); + PMP::triangulate_faces(mesh); PMP::autorefine(mesh); From 2b77fcd094859cd07853b1ae02434b05d5a277a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 3 Jan 2023 18:22:14 +0100 Subject: [PATCH 009/139] faster implementation + fix intersection segments + check --- .../Polygon_mesh_processing/autorefinement.h | 244 ++++++++++-------- 1 file changed, 132 insertions(+), 112 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index fd5e7312c26..01188d4d6b1 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -26,7 +27,7 @@ #include #include -#ifndef NDEBUG +#ifdef CGAL_DEBUG_PMP_AUTOREFINE // debug #include #endif @@ -46,12 +47,42 @@ void generate_subtriangles(const typename EK::Triangle_3& t, std::vector& new_triangles) { typedef CGAL::Projection_traits_3 P_traits; - // typedef CGAL::Exact_intersections_tag Itag; - typedef CGAL::No_constraint_intersection_requiring_constructions_tag Itag; - typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; + typedef CGAL::Exact_intersections_tag Itag; + //typedef CGAL::No_constraint_intersection_requiring_constructions_tag Itag; + typedef CGAL::Constrained_Delaunay_triangulation_2 CDT_base; + typedef CGAL::Constrained_triangulation_plus_2 CDT; + typename EK::Vector_3 n = normal(t[0], t[1], t[2]); + //~ bool orientation_flipped = false; + //~ if (n.x() < 0) + //~ { + //~ orientation_flipped = true; + //~ n = -n; + //~ } + //~ else + //~ { + //~ if (n.x()==0) + //~ { + //~ if (n.y() < 0) + //~ { + //~ orientation_flipped = true; + //~ n = -n; + //~ } + //~ else + //~ { + //~ if (n.y()==0) + //~ { + //~ if (n.z() < 0) + //~ { + //~ orientation_flipped = true; + //~ n = -n; + //~ } + //~ } + //~ } + //~ } + //~ } - P_traits cdt_traits(normal(t[0], t[1], t[2])); + P_traits cdt_traits(n); CDT cdt(cdt_traits); cdt.insert_outside_affine_hull(t[0]); @@ -65,12 +96,41 @@ void generate_subtriangles(const typename EK::Triangle_3& t, for (const typename EK::Point_3& p : points) cdt.insert(p); - for (typename CDT::Face_handle fh : cdt.finite_face_handles()) - { - new_triangles.emplace_back(fh->vertex(0)->point(), - fh->vertex(cdt.ccw(0))->point(), - fh->vertex(cdt.cw(0))->point()); - } + //~ if (orientation_flipped) + //~ for (typename CDT::Face_handle fh : cdt.finite_face_handles()) + //~ { + //~ new_triangles.emplace_back(fh->vertex(0)->point(), + //~ fh->vertex(cdt.cw(0))->point(), + //~ fh->vertex(cdt.ccw(0))->point()); + //~ } + //~ else +#ifdef CGAL_DEBUG_PMP_AUTOREFINE_DUMP_TRIANGULATIONS + static int k = 0; + std::stringstream buffer; + buffer.precision(17); + int nbt=0; +#endif + for (typename CDT::Face_handle fh : cdt.finite_face_handles()) + { + new_triangles.emplace_back(fh->vertex(0)->point(), + fh->vertex(cdt.ccw(0))->point(), + fh->vertex(cdt.cw(0))->point()); +#ifdef CGAL_DEBUG_PMP_AUTOREFINE_DUMP_TRIANGULATIONS + ++nbt; + buffer << fh->vertex(0)->point() << "\n"; + buffer << fh->vertex(cdt.ccw(0))->point() << "\n"; + buffer << fh->vertex(cdt.cw(0))->point() << "\n"; +#endif + } + +#ifdef CGAL_DEBUG_PMP_AUTOREFINE_DUMP_TRIANGULATIONS + std::ofstream dump("triangulation_"+std::to_string(k)+".off"); + dump << "OFF\n" << 3*nbt << " " << nbt << " 0\n"; + dump << buffer.str(); + for (int i=0; i @@ -106,69 +166,31 @@ struct Intersection_visitor void operator()(const typename EK::Triangle_3& t) { - for (std::size_t i=1; i<3; ++i) + for (std::size_t i=0; i<3; ++i) { - typename EK::Segment_3 s(t[i-1], t[i]); + typename EK::Segment_3 s(t[i], t[(i+1)%3]); all_segments_1.push_back(s); all_segments_2.push_back(s); } + } void operator()(const std::vector& poly) { std::size_t nbp = poly.size(); - for (std::size_t i=1; i -bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, Is_degen_map is_degen, const std::vector< std::vector>>& triangles) +template +bool is_output_valid(std::vector> soup_points, + std::vector > soup_triangles) { - typedef typename Kernel_traits::value_type>::type IK; - typedef boost::graph_traits Graph_traits; - typedef typename Graph_traits::face_descriptor face_descriptor; - typedef typename Graph_traits::halfedge_descriptor halfedge_descriptor; - - std::vector soup_points; - std::vector > soup_triangles; - Cartesian_converter to_exact; - std::map point_id_map; - - auto get_point_id = [&](const typename EK::Point_3& pt) - { - auto insert_res = point_id_map.insert(std::make_pair(pt, soup_points.size())); - if (insert_res.second) - soup_points.push_back(pt); - return insert_res.first->second; - }; - - for (face_descriptor f : faces(tm)) - { - if (get(is_degen, f)) continue; // skip degenerate faces - int tid = get(tid_map, f); - if (tid == -1) - { - halfedge_descriptor h = halfedge(f, tm); - soup_triangles.emplace_back( - CGAL::make_array(get_point_id(to_exact(get(vpm,source(h, tm)))), - get_point_id(to_exact(get(vpm,target(h, tm)))), - get_point_id(to_exact(get(vpm,target(next(h, tm), tm))))) - ); - } - else - { - for (const typename EK::Triangle_3& t : triangles[tid]) - { - soup_triangles.emplace_back(CGAL::make_array(get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2]))); - } - } - } - typedef Surface_mesh Exact_mesh; Exact_mesh etm; orient_polygon_soup(soup_points, soup_triangles); @@ -248,11 +270,11 @@ bool is_output_valid(TriangleMesh& tm , VPM vpm, TID_Map tid_map, Is_degen_map i if( CGAL::coplanar(etm.point(source(h1,etm)), etm.point(target(h1,etm)), etm.point(target(etm.next(h1),etm)), - etm.point(source(h1,etm))) && + etm.point(target(etm.next(h2),etm))) && CGAL::coplanar_orientation(etm.point(source(h1,etm)), etm.point(target(h1,etm)), etm.point(target(etm.next(h1),etm)), - etm.point(source(h1,etm))) == CGAL::POSITIVE) + etm.point(target(etm.next(h2),etm))) == CGAL::POSITIVE) { #ifdef CGAL_DEBUG_PMP_AUTOREFINE verbose_fail_msg(3, p); @@ -346,18 +368,22 @@ void autorefine_soup_output(const TriangleMesh& tm, // init the vector of triangles used for the autorefinement of triangles typedef CGAL::Exact_predicates_exact_constructions_kernel EK; - std::vector< std::vector > triangles(tid+1); + std::vector< EK::Triangle_3 > triangles(tid+1); Cartesian_converter to_exact; for(face_descriptor f : intersected_faces) { halfedge_descriptor h = halfedge(f, tm); - triangles[get(tid_map, f)].emplace_back( + triangles[get(tid_map, f)]= EK::Triangle_3( to_exact( get(vpm, source(h, tm)) ), to_exact( get(vpm, target(h, tm)) ), to_exact( get(vpm, target(next(h, tm), tm)) ) ); } + std::vector< std::vector > all_segments(triangles.size()); + std::vector< std::vector > all_points(triangles.size()); + + typename EK::Intersect_3 intersection = EK().intersect_3_object(); for (const Pair_of_faces& p : si_pairs) { @@ -366,73 +392,59 @@ void autorefine_soup_output(const TriangleMesh& tm, if (i1==-1 || i2==-1) continue; //skip degenerate faces - std::size_t nbt_1 = triangles[i1].size(), - nbt_2 = triangles[i2].size(); + const EK::Triangle_3& t1 = triangles[i1]; + const EK::Triangle_3& t2 = triangles[i2]; - std::vector< std::vector > all_segments_1(nbt_1); - std::vector< std::vector > all_segments_2(nbt_2); - std::vector< std::vector > all_points_1(nbt_1); - std::vector< std::vector > all_points_2(nbt_2); + auto inter = intersection(t1, t2); - std::vector t1_subtriangles, t2_subtriangles; - for (std::size_t it1=0; it1 intersection_visitor(all_segments[i1], all_segments[i2], + all_points[i1], all_points[i2]); - auto inter = intersection(t1, t2); - - if (inter != boost::none) - { - autorefine_impl::Intersection_visitor intersection_visitor(all_segments_1[it1], all_segments_2[it2], - all_points_1[it1], all_points_2[it2]); - - boost::apply_visitor(intersection_visitor, *inter); - } - } + boost::apply_visitor(intersection_visitor, *inter); } - - // now refine triangles - std::vector new_triangles; - for(std::size_t it1=0; it1(triangles[i1][it1], all_segments_1[it1], all_points_1[it1], new_triangles); - } - triangles[i1].swap(new_triangles); - new_triangles.clear(); - for(std::size_t it2=0; it2(triangles[i2][it2], all_segments_2[it2], all_points_2[it2], new_triangles); - } - triangles[i2].swap(new_triangles); } - CGAL_assertion( autorefine_impl::is_output_valid(tm, vpm, tid_map, is_degen, triangles) ); + // now refine triangles + std::vector new_triangles; + for(std::size_t ti=0; ti(triangles[ti], all_segments[ti], all_points[ti], new_triangles); + } + // brute force output: create a soup, orient and to-mesh - // WARNING: there is no reason when using double that identical exact points are identical in double Cartesian_converter to_input; std::map point_id_map; +#if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) + std::vector exact_soup_points; +#endif for (vertex_descriptor v : vertices(tm)) { if (point_id_map.insert(std::make_pair(to_exact(get(vpm,v)), soup_points.size())).second) + { soup_points.push_back(get(vpm,v)); +#if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) + exact_soup_points.push_back(to_exact(get(vpm,v))); +#endif + } } auto get_point_id = [&](const typename EK::Point_3& pt) { auto insert_res = point_id_map.insert(std::make_pair(pt, soup_points.size())); if (insert_res.second) + { soup_points.push_back(to_input(pt)); +#if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) + exact_soup_points.push_back(pt); +#endif + } return insert_res.first->second; }; @@ -450,14 +462,22 @@ void autorefine_soup_output(const TriangleMesh& tm, get_point_id(to_exact(get(vpm,target(next(h, tm), tm))))) ); } - else - { - for (const typename EK::Triangle_3& t : triangles[tid]) - { - soup_triangles.emplace_back(CGAL::make_array(get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2]))); - } - } } + for (const typename EK::Triangle_3& t : new_triangles) + { + soup_triangles.emplace_back(CGAL::make_array(get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2]))); + } + + +#ifndef CGAL_NDEBUG + CGAL_assertion( autorefine_impl::is_output_valid(exact_soup_points, soup_triangles) ); +#endif + +#ifdef CGAL_DEBUG_PMP_AUTOREFINE + autorefine_impl::is_output_valid(exact_soup_points, soup_triangles); + throw std::runtime_error("invalid output"); +#endif + } #endif From d92d37c476c40e909db3b8a27b20e3968c4e1f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 3 Jan 2023 18:44:52 +0100 Subject: [PATCH 010/139] fix condition --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 01188d4d6b1..d18826fc2f1 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -474,7 +474,7 @@ void autorefine_soup_output(const TriangleMesh& tm, #endif #ifdef CGAL_DEBUG_PMP_AUTOREFINE - autorefine_impl::is_output_valid(exact_soup_points, soup_triangles); + if (!autorefine_impl::is_output_valid(exact_soup_points, soup_triangles)) throw std::runtime_error("invalid output"); #endif From 34e8d7ee420489459d88a90a83a277cc9e071caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 4 Jan 2023 16:51:55 +0100 Subject: [PATCH 011/139] disable CDT+ that is slower and add debug --- .../Polygon_mesh_processing/autorefinement.h | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index d18826fc2f1..3ec80745042 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -32,6 +32,10 @@ #include #endif +#ifndef CGAL_PMP_AUTOREFINE_VERBOSE +#define CGAL_PMP_AUTOREFINE_VERBOSE(MSG) +#endif + #include namespace CGAL { @@ -49,8 +53,12 @@ void generate_subtriangles(const typename EK::Triangle_3& t, typedef CGAL::Projection_traits_3 P_traits; typedef CGAL::Exact_intersections_tag Itag; //typedef CGAL::No_constraint_intersection_requiring_constructions_tag Itag; - typedef CGAL::Constrained_Delaunay_triangulation_2 CDT_base; - typedef CGAL::Constrained_triangulation_plus_2 CDT; + + + //typedef CGAL::Constrained_Delaunay_triangulation_2 CDT_base; + //typedef CGAL::Constrained_triangulation_plus_2 CDT; + + typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; typename EK::Vector_3 n = normal(t[0], t[1], t[2]); //~ bool orientation_flipped = false; @@ -329,6 +337,7 @@ void autorefine_soup_output(const TriangleMesh& tm, std::vector si_pairs; // collect intersecting pairs of triangles + CGAL_PMP_AUTOREFINE_VERBOSE("collect intersecting pairs"); self_intersections(tm, std::back_inserter(si_pairs), np); if (si_pairs.empty()) return; @@ -384,6 +393,7 @@ void autorefine_soup_output(const TriangleMesh& tm, std::vector< std::vector > all_points(triangles.size()); + CGAL_PMP_AUTOREFINE_VERBOSE("compute intersections"); typename EK::Intersect_3 intersection = EK().intersect_3_object(); for (const Pair_of_faces& p : si_pairs) { @@ -406,6 +416,7 @@ void autorefine_soup_output(const TriangleMesh& tm, } } + CGAL_PMP_AUTOREFINE_VERBOSE("triangulate faces"); // now refine triangles std::vector new_triangles; for(std::size_t ti=0; ti to_input; std::map point_id_map; #if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) @@ -468,16 +480,17 @@ void autorefine_soup_output(const TriangleMesh& tm, soup_triangles.emplace_back(CGAL::make_array(get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2]))); } - #ifndef CGAL_NDEBUG + CGAL_PMP_AUTOREFINE_VERBOSE("check soup"); CGAL_assertion( autorefine_impl::is_output_valid(exact_soup_points, soup_triangles) ); #endif #ifdef CGAL_DEBUG_PMP_AUTOREFINE + CGAL_PMP_AUTOREFINE_VERBOSE("check soup"); if (!autorefine_impl::is_output_valid(exact_soup_points, soup_triangles)) throw std::runtime_error("invalid output"); #endif - + CGAL_PMP_AUTOREFINE_VERBOSE("done"); } #endif From e94c7be4aa72ca2b481e15265ec30f5bad92abec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 5 Jan 2023 08:44:32 +0100 Subject: [PATCH 012/139] update doc + TODOs --- .../Polygon_mesh_processing/autorefinement.h | 31 +++---------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 3ec80745042..0711ad71e21 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1,3 +1,5 @@ +//TODO: add for soup face the id of the input face. not sure it is easy to report intersection edge as a pair of vertex id + // Copyright (c) 2023 GeometryFactory (France). // All rights reserved. // @@ -347,6 +349,7 @@ void autorefine_soup_output(const TriangleMesh& tm, typedef typename boost::property_map::const_type Is_degen_map; Is_degen_map is_degen = get(Degen_property_tag(), tm); +// TODO: we already have this test in bbox inter when it report (f,f) for(face_descriptor f : faces(tm)) put(is_degen, f, is_degenerate_triangle_face(f, tm, np)); @@ -496,10 +499,7 @@ void autorefine_soup_output(const TriangleMesh& tm, /** * \ingroup PMP_corefinement_grp - * \link coref_def_subsec autorefines \endlink `tm`. Refines a triangle mesh - * so that no triangles intersects in their interior. - * Self-intersection edges will be marked as constrained. If an edge that was marked as - * constrained is split, its sub-edges will be marked as constrained as well. + * refines a triangle mesh so that no triangles intersects in their interior. * * @tparam TriangleMesh a model of `HalfedgeListGraph`, `FaceListGraph`, and `MutableFaceGraph` * @tparam NamedParameters a sequence of \ref namedparameters @@ -524,29 +524,6 @@ void autorefine_soup_output(const TriangleMesh& tm, * must be available in `TriangleMesh`.} * \cgalParamNEnd * - * \cgalParamNBegin{edge_is_constrained_map} - * \cgalParamDescription{a property map containing the constrained-or-not status of each edge of `tm`} - * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%edge_descriptor` - * as key type and `bool` as value type} - * \cgalParamDefault{a constant property map returning `false` for any edge} - * \cgalParamNEnd - * - * \cgalParamNBegin{face_index_map} - * \cgalParamDescription{a property map associating to each face of `tm` a unique index between `0` and `num_faces(tm) - 1`} - * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%face_descriptor` - * as key type and `std::size_t` as value type} - * \cgalParamDefault{an automatically indexed internal map} - * \cgalParamExtra{If the property map is writable, the indices of the faces of `tm1` and `tm2` - * will be set after the corefinement is done.} - * \cgalParamNEnd - * - * \cgalParamNBegin{visitor} - * \cgalParamDescription{a visitor used to track the creation of new faces} - * \cgalParamType{a class model of `PMPCorefinementVisitor`} - * \cgalParamDefault{`Corefinement::Default_visitor`} - * \cgalParamNEnd - * \cgalNamedParamsEnd - * */ template From 370d9134a08db1f422e6038dfa7e94ea695efea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 9 Jan 2023 17:59:56 +0100 Subject: [PATCH 013/139] use insertion by range --- .../CGAL/Polygon_mesh_processing/autorefinement.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 0711ad71e21..b2786386205 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -54,13 +54,10 @@ void generate_subtriangles(const typename EK::Triangle_3& t, { typedef CGAL::Projection_traits_3 P_traits; typedef CGAL::Exact_intersections_tag Itag; - //typedef CGAL::No_constraint_intersection_requiring_constructions_tag Itag; - - //typedef CGAL::Constrained_Delaunay_triangulation_2 CDT_base; + typedef CGAL::Constrained_Delaunay_triangulation_2 CDT_2; //typedef CGAL::Constrained_triangulation_plus_2 CDT; - - typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; + typedef CDT_2 CDT; typename EK::Vector_3 n = normal(t[0], t[1], t[2]); //~ bool orientation_flipped = false; @@ -100,11 +97,9 @@ void generate_subtriangles(const typename EK::Triangle_3& t, typename CDT::Vertex_handle v = cdt.tds().insert_dim_up(cdt.infinite_vertex(), false); v->set_point(t[2]); - for (const typename EK::Segment_3& s : segments) - cdt.insert_constraint(s[0], s[1]); + cdt.insert_constraints(segments.begin(), segments.end()); + cdt.insert(points.begin(), points.end()); - for (const typename EK::Point_3& p : points) - cdt.insert(p); //~ if (orientation_flipped) //~ for (typename CDT::Face_handle fh : cdt.finite_face_handles()) From 9ba370a22902afb08d0af7629b7383bba785ac57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 10 Jan 2023 14:40:02 +0100 Subject: [PATCH 014/139] use a canonical orientation --- .../Polygon_mesh_processing/autorefinement.h | 58 ++++++------------- 1 file changed, 17 insertions(+), 41 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index b2786386205..881ffcc8796 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -60,55 +60,26 @@ void generate_subtriangles(const typename EK::Triangle_3& t, typedef CDT_2 CDT; typename EK::Vector_3 n = normal(t[0], t[1], t[2]); - //~ bool orientation_flipped = false; - //~ if (n.x() < 0) - //~ { - //~ orientation_flipped = true; - //~ n = -n; - //~ } - //~ else - //~ { - //~ if (n.x()==0) - //~ { - //~ if (n.y() < 0) - //~ { - //~ orientation_flipped = true; - //~ n = -n; - //~ } - //~ else - //~ { - //~ if (n.y()==0) - //~ { - //~ if (n.z() < 0) - //~ { - //~ orientation_flipped = true; - //~ n = -n; - //~ } - //~ } - //~ } - //~ } - //~ } + typename EK::Point_3 o(0,0,0); + + bool orientation_flipped = false; + if ( typename EK::Less_xyz_3()(o+n,o) ) + { + n=-n; + orientation_flipped = true; + } P_traits cdt_traits(n); CDT cdt(cdt_traits); cdt.insert_outside_affine_hull(t[0]); cdt.insert_outside_affine_hull(t[1]); - typename CDT::Vertex_handle v = cdt.tds().insert_dim_up(cdt.infinite_vertex(), false); + typename CDT::Vertex_handle v = cdt.tds().insert_dim_up(cdt.infinite_vertex(), orientation_flipped); v->set_point(t[2]); cdt.insert_constraints(segments.begin(), segments.end()); cdt.insert(points.begin(), points.end()); - - //~ if (orientation_flipped) - //~ for (typename CDT::Face_handle fh : cdt.finite_face_handles()) - //~ { - //~ new_triangles.emplace_back(fh->vertex(0)->point(), - //~ fh->vertex(cdt.cw(0))->point(), - //~ fh->vertex(cdt.ccw(0))->point()); - //~ } - //~ else #ifdef CGAL_DEBUG_PMP_AUTOREFINE_DUMP_TRIANGULATIONS static int k = 0; std::stringstream buffer; @@ -117,9 +88,14 @@ void generate_subtriangles(const typename EK::Triangle_3& t, #endif for (typename CDT::Face_handle fh : cdt.finite_face_handles()) { - new_triangles.emplace_back(fh->vertex(0)->point(), - fh->vertex(cdt.ccw(0))->point(), - fh->vertex(cdt.cw(0))->point()); + if (orientation_flipped) + new_triangles.emplace_back(fh->vertex(0)->point(), + fh->vertex(cdt.cw(0))->point(), + fh->vertex(cdt.ccw(0))->point()); + else + new_triangles.emplace_back(fh->vertex(0)->point(), + fh->vertex(cdt.ccw(0))->point(), + fh->vertex(cdt.cw(0))->point()); #ifdef CGAL_DEBUG_PMP_AUTOREFINE_DUMP_TRIANGULATIONS ++nbt; buffer << fh->vertex(0)->point() << "\n"; From f9668e279f5f7f2acb49a735adb9f6c15e110841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 11 Jan 2023 11:14:05 +0100 Subject: [PATCH 015/139] use self-intersection test for soup for checking the validity of the output on some cases it seems twice faster --- .../Polygon_mesh_processing/autorefinement.h | 122 +----------------- 1 file changed, 4 insertions(+), 118 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 881ffcc8796..9393e197a19 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -29,11 +29,6 @@ #include #include -#ifdef CGAL_DEBUG_PMP_AUTOREFINE -// debug -#include -#endif - #ifndef CGAL_PMP_AUTOREFINE_VERBOSE #define CGAL_PMP_AUTOREFINE_VERBOSE(MSG) #endif @@ -168,115 +163,6 @@ struct Intersection_visitor } }; -template -bool is_output_valid(std::vector> soup_points, - std::vector > soup_triangles) -{ - typedef Surface_mesh Exact_mesh; - Exact_mesh etm; - orient_polygon_soup(soup_points, soup_triangles); - polygon_soup_to_polygon_mesh(soup_points, soup_triangles, etm); - -#ifdef CGAL_DEBUG_PMP_AUTOREFINE - std::cerr << std::setprecision(17); - auto verbose_fail_msg = [&](int i, const std::pair& p) - { - typename Exact_mesh::Halfedge_index h1 = halfedge(p.first, etm), h2 = halfedge(p.second, etm); - std::cerr << "DEBUG: failing at check #" << i << "\n"; - std::cerr << "DEBUG: " << etm.point(source(h1, etm)) << " " << etm.point(target(h1, etm)) << " " << etm.point(target(next(h1, etm), etm)) << " " << etm.point(source(h1, etm)) << "\n"; - std::cerr << "DEBUG: " << etm.point(source(h2, etm)) << " " << etm.point(target(h2, etm)) << " " << etm.point(target(next(h2, etm), etm)) << " " << etm.point(source(h2, etm)) << "\n"; - }; -#endif - - //TODO: double check me - auto skip_faces = [&](const std::pair& p) - { - typename Exact_mesh::Halfedge_index h1 = etm.halfedge(p.first), h2=etm.halfedge(p.second); - - boost::container::small_vector v1; - v1.push_back(prev(h1, etm)); - v1.push_back(h1); - v1.push_back(next(h1, etm)); - - boost::container::small_vector v2; - v2.push_back(prev(h2, etm)); - v2.push_back(h2); - v2.push_back(next(h2, etm)); - - //collect identical vertices - boost::container::small_vector, 3> common; - for(typename Exact_mesh::Halfedge_index h1 : v1) - for(typename Exact_mesh::Halfedge_index h2 : v2) - if (etm.point(target(h1, etm))==etm.point(target(h2,etm))) - common.push_back(std::make_pair(h1,h2)); - - if (common.empty()) - { -#ifdef CGAL_DEBUG_PMP_AUTOREFINE - verbose_fail_msg(1, p); -#endif - return false; - } - - switch (common.size()) - { - case 1: - { - // geometric check if the opposite segments intersect the triangles - const typename EK::Triangle_3 t1(etm.point(source(h1,etm)), - etm.point(target(h1,etm)), - etm.point(target(next(h1,etm),etm))); - const typename EK::Triangle_3 t2(etm.point(source(h2,etm)), - etm.point(target(h2,etm)), - etm.point(target(next(h2,etm),etm))); - - const typename EK::Segment_3 s1(etm.point(source(common[0].first,etm)), etm.point(target(next(common[0].first,etm),etm))); - const typename EK::Segment_3 s2(etm.point(source(common[0].second,etm)), etm.point(target(next(common[0].second,etm),etm))); - - if(do_intersect(t1, s2) || do_intersect(t2, s1)) - { -#ifdef CGAL_DEBUG_PMP_AUTOREFINE - verbose_fail_msg(2, p); -#endif - return false; - } - return true; - } - case 2: - { - // shared edge - h1 = next(common[0].first, etm) == common[1].first ? common[1].first : common[0].first; - h2 = next(common[0].second, etm) == common[1].second ? common[1].second : common[0].second; - - if( CGAL::coplanar(etm.point(source(h1,etm)), - etm.point(target(h1,etm)), - etm.point(target(etm.next(h1),etm)), - etm.point(target(etm.next(h2),etm))) && - CGAL::coplanar_orientation(etm.point(source(h1,etm)), - etm.point(target(h1,etm)), - etm.point(target(etm.next(h1),etm)), - etm.point(target(etm.next(h2),etm))) == CGAL::POSITIVE) - { -#ifdef CGAL_DEBUG_PMP_AUTOREFINE - verbose_fail_msg(3, p); -#endif - return false; - } - return true; - } - default: // size == 3 - return true; - } - }; - - std::vector< std::pair > si_faces; - self_intersections(etm, - CGAL::filter_output_iterator(std::back_inserter(si_faces), - skip_faces)); - - return si_faces.empty(); -} - } // end of autorefine_impl template @@ -456,13 +342,13 @@ void autorefine_soup_output(const TriangleMesh& tm, #ifndef CGAL_NDEBUG CGAL_PMP_AUTOREFINE_VERBOSE("check soup"); - CGAL_assertion( autorefine_impl::is_output_valid(exact_soup_points, soup_triangles) ); -#endif - + CGAL_assertion( !does_triangle_soup_self_intersect(exact_soup_points, soup_triangles) ); +#else #ifdef CGAL_DEBUG_PMP_AUTOREFINE CGAL_PMP_AUTOREFINE_VERBOSE("check soup"); - if (!autorefine_impl::is_output_valid(exact_soup_points, soup_triangles)) + if (does_triangle_soup_self_intersect(exact_soup_points, soup_triangles)) throw std::runtime_error("invalid output"); +#endif #endif CGAL_PMP_AUTOREFINE_VERBOSE("done"); } From 7d1582ddbb9ad7bf6e7d8872eb08101254b7e68a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 11 Jan 2023 14:00:32 +0100 Subject: [PATCH 016/139] avoid doing twice the degenerate test --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 9393e197a19..283e139eb1c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -206,9 +206,11 @@ void autorefine_soup_output(const TriangleMesh& tm, typedef typename boost::property_map::const_type Is_degen_map; Is_degen_map is_degen = get(Degen_property_tag(), tm); -// TODO: we already have this test in bbox inter when it report (f,f) for(face_descriptor f : faces(tm)) - put(is_degen, f, is_degenerate_triangle_face(f, tm, np)); + put(is_degen, f, false); + for (const Pair_of_faces& p : si_pairs) + if (p.first==p.second) // bbox inter reports (f,f) for degenerate faces + put(is_degen, p.first, true); // assign an id per triangle involved in an intersection // + the faces involved in the intersection From 822e65b3cf93b51855d14349d96cdbcf09cff85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 13 Jan 2023 09:35:51 +0100 Subject: [PATCH 017/139] build visitor once for all --- .../Polygon_mesh_processing/autorefinement.h | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 283e139eb1c..ea1c0de07eb 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -54,6 +54,7 @@ void generate_subtriangles(const typename EK::Triangle_3& t, //typedef CGAL::Constrained_triangulation_plus_2 CDT; typedef CDT_2 CDT; + // positive triangle normal typename EK::Vector_3 n = normal(t[0], t[1], t[2]); typename EK::Point_3 o(0,0,0); @@ -112,32 +113,32 @@ void generate_subtriangles(const typename EK::Triangle_3& t, template struct Intersection_visitor { - std::vector& all_segments_1; - std::vector& all_segments_2; - std::vector& all_points_1; - std::vector& all_points_2; + std::vector< std::vector >& all_segments; + std::vector< std::vector >& all_points; + std::pair ids; - Intersection_visitor(std::vector& all_segments_1, - std::vector& all_segments_2, - std::vector& all_points_1, - std::vector& all_points_2) - : all_segments_1(all_segments_1) - , all_segments_2(all_segments_2) - , all_points_1(all_points_1) - , all_points_2(all_points_2) + Intersection_visitor(std::vector< std::vector >& all_segments, + std::vector< std::vector >& all_points) + : all_segments (all_segments) + , all_points(all_points) {} + void set_triangle_ids(int i1, int i2) + { + ids = {i1, i2}; + } + typedef void result_type; void operator()(const typename EK::Point_3& p) { - all_points_1.push_back(p); - all_points_2.push_back(p); + all_points[ids.first].push_back(p); + all_points[ids.second].push_back(p); } void operator()(const typename EK::Segment_3& s) { - all_segments_1.push_back(s); - all_segments_2.push_back(s); + all_segments[ids.first].push_back(s); + all_segments[ids.second].push_back(s); } void operator()(const typename EK::Triangle_3& t) @@ -145,8 +146,8 @@ struct Intersection_visitor for (std::size_t i=0; i<3; ++i) { typename EK::Segment_3 s(t[i], t[(i+1)%3]); - all_segments_1.push_back(s); - all_segments_2.push_back(s); + all_segments[ids.first].push_back(s); + all_segments[ids.second].push_back(s); } } @@ -157,8 +158,8 @@ struct Intersection_visitor for (std::size_t i=0; i > all_segments(triangles.size()); std::vector< std::vector > all_points(triangles.size()); - CGAL_PMP_AUTOREFINE_VERBOSE("compute intersections"); typename EK::Intersect_3 intersection = EK().intersect_3_object(); + autorefine_impl::Intersection_visitor intersection_visitor(all_segments, all_points); + for (const Pair_of_faces& p : si_pairs) { int i1 = get(tid_map, p.first), @@ -271,9 +273,7 @@ void autorefine_soup_output(const TriangleMesh& tm, if (inter != boost::none) { - autorefine_impl::Intersection_visitor intersection_visitor(all_segments[i1], all_segments[i2], - all_points[i1], all_points[i2]); - + intersection_visitor.set_triangle_ids(i1, i2); boost::apply_visitor(intersection_visitor, *inter); } } From 9c2de3ee7974a1ccd5e72c73bbf60e03366d5523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 13 Jan 2023 11:42:14 +0100 Subject: [PATCH 018/139] handle soup as input --- .../Polygon_mesh_processing/autorefinement.h | 125 ++++++++---------- 1 file changed, 54 insertions(+), 71 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index ea1c0de07eb..290dde25332 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -28,6 +28,7 @@ // output #include #include +#include #ifndef CGAL_PMP_AUTOREFINE_VERBOSE #define CGAL_PMP_AUTOREFINE_VERBOSE(MSG) @@ -166,8 +167,9 @@ struct Intersection_visitor } // end of autorefine_impl -template -void autorefine_soup_output(const TriangleMesh& tm, +template +void autorefine_soup_output(const PointRange& input_points, + const TriIdsRange& id_triples, std::vector& soup_points, std::vector >& soup_triangles, const NamedParameters& np = parameters::default_values()) @@ -175,12 +177,9 @@ void autorefine_soup_output(const TriangleMesh& tm, using parameters::choose_parameter; using parameters::get_parameter; - typedef typename GetGeomTraits::type GT; - GT traits = choose_parameter(get_parameter(np, internal_np::geom_traits)); - - typedef typename GetVertexPointMap::const_type VPM; - VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), - get_const_property_map(vertex_point, tm)); + typedef typename GetPolygonSoupGeomTraits::type GT; + typedef typename GetPointMap::const_type Point_map; + Point_map pm = choose_parameter(get_parameter(np, internal_np::point_map)); typedef typename internal_np::Lookup_named_param_def < internal_np::concurrency_tag_t, @@ -188,68 +187,54 @@ void autorefine_soup_output(const TriangleMesh& tm, Sequential_tag > ::type Concurrency_tag; - typedef boost::graph_traits Graph_traits; - typedef typename Graph_traits::face_descriptor face_descriptor; - typedef typename Graph_traits::halfedge_descriptor halfedge_descriptor; - typedef typename Graph_traits::vertex_descriptor vertex_descriptor; - typedef std::pair Pair_of_faces; + typedef std::size_t Input_TID; + typedef std::pair Pair_of_triangle_ids; - std::vector si_pairs; + std::vector si_pairs; // collect intersecting pairs of triangles CGAL_PMP_AUTOREFINE_VERBOSE("collect intersecting pairs"); - self_intersections(tm, std::back_inserter(si_pairs), np); + triangle_soup_self_intersections(input_points, id_triples, std::back_inserter(si_pairs), np); if (si_pairs.empty()) return; // mark degenerate faces so that we can ignore them - typedef CGAL::dynamic_face_property_t Degen_property_tag; - typedef typename boost::property_map::const_type Is_degen_map; - Is_degen_map is_degen = get(Degen_property_tag(), tm); + std::vector is_degen(id_triples.size(), false); - for(face_descriptor f : faces(tm)) - put(is_degen, f, false); - for (const Pair_of_faces& p : si_pairs) + for (const Pair_of_triangle_ids& p : si_pairs) if (p.first==p.second) // bbox inter reports (f,f) for degenerate faces - put(is_degen, p.first, true); + is_degen[p.first] = true; // assign an id per triangle involved in an intersection // + the faces involved in the intersection - typedef CGAL::dynamic_face_property_t TID_property_tag; - typedef typename boost::property_map::const_type Triangle_id_map; - - Triangle_id_map tid_map = get(TID_property_tag(), tm); - for (face_descriptor f : faces(tm)) - put(tid_map, f, -1); - - std::vector intersected_faces; - int tid=-1; - for (const Pair_of_faces& p : si_pairs) + std::vector tri_inter_ids(id_triples.size(), -1); + std::vector intersected_faces; + int tiid=-1; + for (const Pair_of_triangle_ids& p : si_pairs) { - if (get(tid_map, p.first)==-1 && !get(is_degen, p.first)) + if (tri_inter_ids[p.first]==-1 && !is_degen[p.first]) { - put(tid_map, p.first, ++tid); + tri_inter_ids[p.first]=++tiid; intersected_faces.push_back(p.first); } - if (get(tid_map, p.second)==-1 && !get(is_degen, p.second)) + if (tri_inter_ids[p.second]==-1 && !is_degen[p.second]) { - put(tid_map, p.second, ++tid); + tri_inter_ids[p.second]=++tiid; intersected_faces.push_back(p.second); } } // init the vector of triangles used for the autorefinement of triangles typedef CGAL::Exact_predicates_exact_constructions_kernel EK; - std::vector< EK::Triangle_3 > triangles(tid+1); + std::vector< EK::Triangle_3 > triangles(tiid+1); Cartesian_converter to_exact; - for(face_descriptor f : intersected_faces) + for(Input_TID f : intersected_faces) { - halfedge_descriptor h = halfedge(f, tm); - triangles[get(tid_map, f)]= EK::Triangle_3( - to_exact( get(vpm, source(h, tm)) ), - to_exact( get(vpm, target(h, tm)) ), - to_exact( get(vpm, target(next(h, tm), tm)) ) ); + triangles[tri_inter_ids[f]]= EK::Triangle_3( + to_exact( get(pm, input_points[id_triples[f][0]]) ), + to_exact( get(pm, input_points[id_triples[f][1]]) ), + to_exact( get(pm, input_points[id_triples[f][2]]) ) ); } std::vector< std::vector > all_segments(triangles.size()); @@ -259,10 +244,10 @@ void autorefine_soup_output(const TriangleMesh& tm, typename EK::Intersect_3 intersection = EK().intersect_3_object(); autorefine_impl::Intersection_visitor intersection_visitor(all_segments, all_points); - for (const Pair_of_faces& p : si_pairs) + for (const Pair_of_triangle_ids& p : si_pairs) { - int i1 = get(tid_map, p.first), - i2 = get(tid_map, p.second); + int i1 = tri_inter_ids[p.first], + i2 = tri_inter_ids[p.second]; if (i1==-1 || i2==-1) continue; //skip degenerate faces @@ -298,17 +283,6 @@ void autorefine_soup_output(const TriangleMesh& tm, std::vector exact_soup_points; #endif - for (vertex_descriptor v : vertices(tm)) - { - if (point_id_map.insert(std::make_pair(to_exact(get(vpm,v)), soup_points.size())).second) - { - soup_points.push_back(get(vpm,v)); -#if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) - exact_soup_points.push_back(to_exact(get(vpm,v))); -#endif - } - } - auto get_point_id = [&](const typename EK::Point_3& pt) { auto insert_res = point_id_map.insert(std::make_pair(pt, soup_points.size())); @@ -322,18 +296,22 @@ void autorefine_soup_output(const TriangleMesh& tm, return insert_res.first->second; }; - for (face_descriptor f : faces(tm)) - { - if (get(is_degen, f)) continue; //skip degenerate faces + std::vector input_point_ids; + input_point_ids.reserve(input_points.size()); + for (const auto& p : input_points) + input_point_ids.push_back(get_point_id(to_exact(get(pm,p)))); - int tid = get(tid_map, f); - if (tid == -1) + for (Input_TID f=0; f::type GT; GT traits = choose_parameter(get_parameter(np, internal_np::geom_traits)); - std::vector soup_points; - std::vector > soup_triangles; + std::vector in_soup_points; + std::vector > in_soup_triangles; + std::vector out_soup_points; + std::vector > out_soup_triangles; - autorefine_soup_output(tm, soup_points, soup_triangles, np); + polygon_mesh_to_polygon_soup(tm, in_soup_points, in_soup_triangles); + + autorefine_soup_output(in_soup_points, in_soup_triangles, + out_soup_points, out_soup_triangles); clear(tm); - orient_polygon_soup(soup_points, soup_triangles); - polygon_soup_to_polygon_mesh(soup_points, soup_triangles, tm); + orient_polygon_soup(out_soup_points, out_soup_triangles); + polygon_soup_to_polygon_mesh(out_soup_points, out_soup_triangles, tm); } From b4887272e85bfde8bebf0093a9169cc897bca5ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 13 Jan 2023 11:56:36 +0100 Subject: [PATCH 019/139] use soup as input/output in example --- .../soup_autorefinement.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp index 8ca983aa31c..297875c9ec8 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp @@ -23,19 +23,14 @@ int main(int argc, char** argv) : std::string(argv[1]); std::vector input_points; - std::vector > input_triangles; - + std::vector> input_triangles; CGAL::IO::read_polygon_soup(filename, input_points, input_triangles); - PMP::repair_polygon_soup(input_points, input_triangles); - Mesh mesh; - PMP::orient_polygon_soup(input_points, input_triangles); - PMP::polygon_soup_to_polygon_mesh(input_points, input_triangles, mesh); - PMP::triangulate_faces(mesh); + std::vector output_points; + std::vector> output_triangles; + PMP::autorefine_soup_output(input_points, input_triangles, output_points, output_triangles); - PMP::autorefine(mesh); - - CGAL::IO::write_polygon_mesh("autorefined.off", mesh, CGAL::parameters::stream_precision(17)); + CGAL::IO::write_polygon_soup("autorefined.off", output_points, output_triangles, CGAL::parameters::stream_precision(17)); return 0; } From d979121cd29c42c203609ab3bc4956601e9b0512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 13 Jan 2023 15:41:33 +0100 Subject: [PATCH 020/139] repair soup is still recommanded --- .../examples/Polygon_mesh_processing/soup_autorefinement.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp index 297875c9ec8..9ade96e3be8 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -25,6 +24,7 @@ int main(int argc, char** argv) std::vector input_points; std::vector> input_triangles; CGAL::IO::read_polygon_soup(filename, input_points, input_triangles); + PMP::repair_polygon_soup(input_points, input_triangles); std::vector output_points; std::vector> output_triangles; From 4bc74c399cac5ce0ac84ba894e1b5e996960d605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 16 Jan 2023 22:59:18 +0100 Subject: [PATCH 021/139] WIP: start improving intersect computation --- .../Polygon_mesh_processing/autorefinement.h | 269 ++++++++++++++++-- 1 file changed, 248 insertions(+), 21 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 290dde25332..80b964ad859 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1,5 +1,5 @@ //TODO: add for soup face the id of the input face. not sure it is easy to report intersection edge as a pair of vertex id - +//TODO: only return intersection segments // Copyright (c) 2023 GeometryFactory (France). // All rights reserved. // @@ -43,21 +43,26 @@ namespace Polygon_mesh_processing { namespace autorefine_impl { template -void generate_subtriangles(const typename EK::Triangle_3& t, - const std::vector& segments, +void generate_subtriangles(std::size_t ti, + std::vector& segments, const std::vector& points, + const std::vector& in_triangle_ids, + const std::set >& intersecting_triangles, + const std::vector& triangles, std::vector& new_triangles) { typedef CGAL::Projection_traits_3 P_traits; typedef CGAL::Exact_intersections_tag Itag; - typedef CGAL::Constrained_Delaunay_triangulation_2 CDT_2; + typedef CGAL::Constrained_Delaunay_triangulation_2 CDT_2; //typedef CGAL::Constrained_triangulation_plus_2 CDT; typedef CDT_2 CDT; + const typename EK::Triangle_3& t = triangles[ti]; + // positive triangle normal typename EK::Vector_3 n = normal(t[0], t[1], t[2]); - typename EK::Point_3 o(0,0,0); + typename EK::Point_3 o(CGAL::ORIGIN); bool orientation_flipped = false; if ( typename EK::Less_xyz_3()(o+n,o) ) @@ -74,6 +79,184 @@ void generate_subtriangles(const typename EK::Triangle_3& t, typename CDT::Vertex_handle v = cdt.tds().insert_dim_up(cdt.infinite_vertex(), orientation_flipped); v->set_point(t[2]); +#if 1 + //~ static std::ofstream debug("inter_segments.polylines.txt"); + //~ debug.precision(17); + + // pre-compute segment intersections + if (!segments.empty()) + { + std::size_t nbs = segments.size(); + //~ std::cout << "nbs " << nbs << "\n"; + + //~ if (nbs==8) + //~ { + //~ for (std::size_t i = 0; i > points_on_segments(nbs); + for (std::size_t i = 0; i(&(*res))) + { + points_on_segments[i].push_back(*pt_ptr); + points_on_segments[j].push_back(*pt_ptr); + + //~ std::cout << "new inter " << *pt_ptr << "\n"; + + } + else + { + // We can have hard cases if two triangles are coplanar.... + + //~ std::cout << "coplanar inter: " << i << " " << j << "\n"; + + auto inter = CGAL::intersection(segments[i], segments[j]); + if (const typename EK::Point_3* pt_ptr = boost::get(&(*inter))) + { + points_on_segments[i].push_back(*pt_ptr); + points_on_segments[j].push_back(*pt_ptr); + + //~ std::cout << "new inter bis" << *pt_ptr << "\n"; + } + else + { + if (const typename EK::Segment_3* seg_ptr = boost::get(&(*inter))) + { + points_on_segments[i].push_back(seg_ptr->source()); + points_on_segments[j].push_back(seg_ptr->source()); + points_on_segments[i].push_back(seg_ptr->target()); + points_on_segments[j].push_back(seg_ptr->target()); + + } + else + std::cerr <<"ERROR!\n"; + } + + #if 0 + //this code works if triangles are not coplanar + // coplanar intersection that is not a point + int coord = 0; + const typename EK::Segment_3& s = segments[i]; + typename EK::Point_3 src = s.source(), tgt=s.target(); + if (src.x()==tgt.x()) + { + coord=1; + if (src.y()==tgt.y()) + coord==2; + } + + std::vector tmp_pts = { + src, tgt, segments[j][0], segments[j][1] }; + + std::sort(tmp_pts.begin(), tmp_pts.end(), + [coord](const typename EK::Point_3& p, const typename EK::Point_3& q) + {return p[coord] cst_points; + std::vector> csts; + for (std::size_t i = 0; itgt[coord]) + std::swap(src, tgt); + + std::sort(points_on_segments[i].begin(), points_on_segments[i].end(), [coord](const typename EK::Point_3& p, const typename EK::Point_3& q){return p[coord] no_inter_segments; + no_inter_segments.reserve(nbs); + for (std::size_t i = 0; i >& all_segments; std::vector< std::vector >& all_points; + std::vector< std::vector >& all_in_triangle_ids; std::pair ids; Intersection_visitor(std::vector< std::vector >& all_segments, - std::vector< std::vector >& all_points) + std::vector< std::vector >& all_points, + std::vector< std::vector >& all_in_triangle_ids) : all_segments (all_segments) , all_points(all_points) + , all_in_triangle_ids(all_in_triangle_ids) {} void set_triangle_ids(int i1, int i2) @@ -140,6 +326,8 @@ struct Intersection_visitor { all_segments[ids.first].push_back(s); all_segments[ids.second].push_back(s); + all_in_triangle_ids[ids.first].push_back(ids.second); + all_in_triangle_ids[ids.second].push_back(ids.first); } void operator()(const typename EK::Triangle_3& t) @@ -149,6 +337,8 @@ struct Intersection_visitor typename EK::Segment_3 s(t[i], t[(i+1)%3]); all_segments[ids.first].push_back(s); all_segments[ids.second].push_back(s); + all_in_triangle_ids[ids.first].push_back(ids.second); + all_in_triangle_ids[ids.second].push_back(ids.first); } } @@ -161,6 +351,8 @@ struct Intersection_visitor typename EK::Segment_3 s(poly[i], poly[(i+1)%nbp]); all_segments[ids.first].push_back(s); all_segments[ids.second].push_back(s); + all_in_triangle_ids[ids.first].push_back(ids.second); + all_in_triangle_ids[ids.second].push_back(ids.first); } } }; @@ -239,11 +431,13 @@ void autorefine_soup_output(const PointRange& input_points, std::vector< std::vector > all_segments(triangles.size()); std::vector< std::vector > all_points(triangles.size()); + std::vector< std::vector > all_in_triangle_ids(triangles.size()); CGAL_PMP_AUTOREFINE_VERBOSE("compute intersections"); typename EK::Intersect_3 intersection = EK().intersect_3_object(); - autorefine_impl::Intersection_visitor intersection_visitor(all_segments, all_points); + autorefine_impl::Intersection_visitor intersection_visitor(all_segments, all_points, all_in_triangle_ids); + std::set > intersecting_triangles; for (const Pair_of_triangle_ids& p : si_pairs) { int i1 = tri_inter_ids[p.first], @@ -258,25 +452,13 @@ void autorefine_soup_output(const PointRange& input_points, if (inter != boost::none) { + intersecting_triangles.insert(CGAL::make_sorted_pair(i1, i2)); intersection_visitor.set_triangle_ids(i1, i2); boost::apply_visitor(intersection_visitor, *inter); } } - CGAL_PMP_AUTOREFINE_VERBOSE("triangulate faces"); - // now refine triangles - std::vector new_triangles; - for(std::size_t ti=0; ti(triangles[ti], all_segments[ti], all_points[ti], new_triangles); - } - - - // brute force output: create a soup, orient and to-mesh - CGAL_PMP_AUTOREFINE_VERBOSE("create output soup"); + // deduplicate inserted segments Cartesian_converter to_input; std::map point_id_map; #if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) @@ -296,6 +478,51 @@ void autorefine_soup_output(const PointRange& input_points, return insert_res.first->second; }; + // filter duplicated segments + for(std::size_t ti=0; ti filtered_segments; + std::vector filtered_in_triangle_ids; + filtered_segments.reserve(nbs); + std::set> segset; + for (std::size_t si=0; si new_triangles; + for(std::size_t ti=0; ti(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); + } + + + // brute force output: create a soup, orient and to-mesh + CGAL_PMP_AUTOREFINE_VERBOSE("create output soup"); + std::vector input_point_ids; input_point_ids.reserve(input_points.size()); for (const auto& p : input_points) From 842b6282b5c7a0b9f9c9551dfa443edd4f5319f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 23 Jan 2023 15:39:01 +0100 Subject: [PATCH 022/139] STILL WIP: copy/paste code for coplanar intersection --- .../Polygon_mesh_processing/autorefinement.h | 44 +++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 80b964ad859..6d97f7521de 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -36,12 +36,43 @@ #include +#define TEST_RESOLVE_INTERSECTION +#define DEDUPLICATE_SEGMENTS + namespace CGAL { namespace Polygon_mesh_processing { #ifndef DOXYGEN_RUNNING namespace autorefine_impl { +template +bool do_coplanar_segments_intersect(const typename K::Segment_3& s1, + const typename K::Segment_3& s2, + const K& k = K()) +{ + // supporting_line intersects: points are coplanar + typename K::Coplanar_orientation_3 cpl_orient=k.coplanar_orientation_3_object(); + ::CGAL::Orientation or1 = cpl_orient(s1[0], s1[1], s2[0]); + ::CGAL::Orientation or2 = cpl_orient(s1[0], s1[1], s2[1]); + + if(or1 == COLLINEAR && or2 == COLLINEAR) + { + // segments are collinear + typename K::Collinear_are_ordered_along_line_3 cln_order = k.collinear_are_ordered_along_line_3_object(); + return (cln_order(s1[0], s2[0], s1[1]) || + cln_order(s1[0], s2[1], s1[1]) || + cln_order(s2[0], s1[0], s2[1])); + } + + if(or1 != or2) + { + or1 = cpl_orient(s2[0], s2[1], s1[0]); + return (or1 == COLLINEAR || or1 != cpl_orient(s2[0], s2[1], s1[1])); + } + + return false; +} + template void generate_subtriangles(std::size_t ti, std::vector& segments, @@ -54,7 +85,11 @@ void generate_subtriangles(std::size_t ti, typedef CGAL::Projection_traits_3 P_traits; typedef CGAL::Exact_intersections_tag Itag; - typedef CGAL::Constrained_Delaunay_triangulation_2 CDT_2; + typedef CGAL::Constrained_Delaunay_triangulation_2 CDT_2; //typedef CGAL::Constrained_triangulation_plus_2 CDT; typedef CDT_2 CDT; @@ -79,7 +114,7 @@ void generate_subtriangles(std::size_t ti, typename CDT::Vertex_handle v = cdt.tds().insert_dim_up(cdt.infinite_vertex(), orientation_flipped); v->set_point(t[2]); -#if 1 +#ifdef TEST_RESOLVE_INTERSECTION //~ static std::ofstream debug("inter_segments.polylines.txt"); //~ debug.precision(17); @@ -102,7 +137,7 @@ void generate_subtriangles(std::size_t ti, { if (intersecting_triangles.count(CGAL::make_sorted_pair(in_triangle_ids[i], in_triangle_ids[j]))!=0) { - if (CGAL::do_intersect(segments[i], segments[j])) + if (do_coplanar_segments_intersect(segments[i], segments[j])) { auto res = CGAL::intersection(triangles[in_triangle_ids[i]].supporting_plane(), triangles[in_triangle_ids[j]].supporting_plane(), @@ -479,6 +514,7 @@ void autorefine_soup_output(const PointRange& input_points, }; // filter duplicated segments +#ifdef DEDUPLICATE_SEGMENTS for(std::size_t ti=0; ti(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); } - // brute force output: create a soup, orient and to-mesh CGAL_PMP_AUTOREFINE_VERBOSE("create output soup"); From 39d7bbc57fee319e45f8c51c75794f7828cc21d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 24 Jan 2023 14:54:20 +0100 Subject: [PATCH 023/139] WIP import intersection computation from coref code --- .../Polygon_mesh_processing/autorefinement.h | 363 +++++++++++++----- 1 file changed, 259 insertions(+), 104 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 6d97f7521de..afbe0c3479d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -36,8 +36,8 @@ #include -#define TEST_RESOLVE_INTERSECTION -#define DEDUPLICATE_SEGMENTS +// #define TEST_RESOLVE_INTERSECTION +// #define DEDUPLICATE_SEGMENTS namespace CGAL { namespace Polygon_mesh_processing { @@ -45,10 +45,13 @@ namespace Polygon_mesh_processing { #ifndef DOXYGEN_RUNNING namespace autorefine_impl { +enum Segment_inter_type { NO_INTERSECTION=0, COPLANAR_SEGMENTS, POINT_INTERSECTION }; + template -bool do_coplanar_segments_intersect(const typename K::Segment_3& s1, - const typename K::Segment_3& s2, - const K& k = K()) +Segment_inter_type +do_coplanar_segments_intersect(const typename K::Segment_3& s1, + const typename K::Segment_3& s2, + const K& k = K()) { // supporting_line intersects: points are coplanar typename K::Coplanar_orientation_3 cpl_orient=k.coplanar_orientation_3_object(); @@ -61,26 +64,207 @@ bool do_coplanar_segments_intersect(const typename K::Segment_3& s1, typename K::Collinear_are_ordered_along_line_3 cln_order = k.collinear_are_ordered_along_line_3_object(); return (cln_order(s1[0], s2[0], s1[1]) || cln_order(s1[0], s2[1], s1[1]) || - cln_order(s2[0], s1[0], s2[1])); + cln_order(s2[0], s1[0], s2[1])) ? COPLANAR_SEGMENTS : NO_INTERSECTION; } if(or1 != or2) { or1 = cpl_orient(s2[0], s2[1], s1[0]); - return (or1 == COLLINEAR || or1 != cpl_orient(s2[0], s2[1], s1[1])); + return (or1 == COLLINEAR || or1 != cpl_orient(s2[0], s2[1], s1[1])) ? POINT_INTERSECTION : NO_INTERSECTION; } - return false; + return NO_INTERSECTION; } +////////////////////////////////// +////////////////////////////////// +////////////////////////////////// +////////////////////////////////// +////////////////////////////////// + +// imported from Polygon_mesh_processing/internal/Corefinement/intersect_triangle_segment_3.h + +template +void +find_intersection(const typename K::Point_3& p, const typename K::Point_3& q, //segment + const typename K::Point_3& a, const typename K::Point_3& b, const typename K::Point_3& c, //triangle + std::vector& inter_pts, + bool is_p_coplanar=false, bool is_q_coplanar=false) // note that in coref this was wrt a halfedge not p/q +{ + Orientation ab=orientation(p,q,a,b); + Orientation bc=orientation(p,q,b,c); + Orientation ca=orientation(p,q,c,a); + + if ( ab==POSITIVE || bc==POSITIVE || ca==POSITIVE ) + return; + + int nb_coplanar=(ab==COPLANAR?1:0) + (bc==COPLANAR?1:0) + (ca==COPLANAR?1:0); + +/* + if ( nb_coplanar==0 ) + return result_type(ON_FACE,hd,is_src_coplanar,is_tgt_coplanar); + + if (nb_coplanar==1){ + if (ab==COPLANAR) + // intersection is ab + return result_type(ON_EDGE,next(hd,tm),is_src_coplanar,is_tgt_coplanar); + if (bc==COPLANAR) + // intersection is bc + return result_type(ON_EDGE,prev(hd,tm),is_src_coplanar,is_tgt_coplanar); + CGAL_assertion(ca==COPLANAR); + // intersection is ca + return result_type(ON_EDGE,hd,is_src_coplanar,is_tgt_coplanar); + } +*/ + + if (is_p_coplanar) + { + inter_pts.push_back(p); + return; + } + if (is_q_coplanar) + { + inter_pts.push_back(q); + return; + } + + if (nb_coplanar!=2) + { + inter_pts.push_back( + typename K::Construct_plane_line_intersection_point_3()(a, b, c, p, q) + ); + } + else + { + if (ab!=COPLANAR) + { + // intersection is c + inter_pts.push_back(c); + return; + } + + if (bc!=COPLANAR) + { + // intersection is a + inter_pts.push_back(a); + return; + } + CGAL_assertion(ca!=COPLANAR); + // intersection is b + inter_pts.push_back(b); + } +} + +template +void test_edge(const typename K::Point_3& p, const typename K::Point_3& q, + const typename K::Point_3& a, const typename K::Point_3& b, const typename K::Point_3& c, + const Orientation abcp, + const Orientation abcq, + std::vector& inter_pts) +{ + switch ( abcp ) { + case POSITIVE: + switch ( abcq ) { + case POSITIVE: + // the segment lies in the positive open halfspaces defined by the + // triangle's supporting plane + break; + case NEGATIVE: + // p sees the triangle in counterclockwise order + find_intersection(p,q,a,b,c,inter_pts); + break; + //case COPLANAR: + default: + // q belongs to the triangle's supporting plane + // p sees the triangle in counterclockwise order + find_intersection(p,q,a,b,c,inter_pts,false,true); + } + break; + case NEGATIVE: + switch ( abcq ) { + case POSITIVE: + // q sees the triangle in counterclockwise order + find_intersection(q,p,a,b,c,inter_pts); + break; + case NEGATIVE: + // the segment lies in the negative open halfspaces defined by the + // triangle's supporting plane + break; + // case COPLANAR: + default: + // q belongs to the triangle's supporting plane + // p sees the triangle in clockwise order + find_intersection(q,p,a,b,c,inter_pts,true,false); + } + break; + default: + //case COPLANAR: // p belongs to the triangle's supporting plane + switch ( abcq ) { + case POSITIVE: + // q sees the triangle in counterclockwise order + find_intersection(q,p,a,b,c,inter_pts,false, true); + break; + case NEGATIVE: + // q sees the triangle in clockwise order + find_intersection(p,q,a,b,c,inter_pts,true); + break; + //case COPLANAR: + default: + // the segment is coplanar with the triangle's supporting plane + // we test whether the segment intersects the triangle in the common + // supporting plane + if ( ::CGAL::Intersections::internal::do_intersect_coplanar(a,b,c,p,q,K()) ) + { + //handle coplanar intersection + // TODO: use coref function + throw std::runtime_error("coplanar intersection"); + return; + } + } + } +} + +template +void collect_intersections(const std::array& t1, + const std::array& t2, + std::vector& inter_pts) +{ + // test edges of t1 vs t2 + std::array ori; + for (int i=0; i<3; ++i) + ori[i] = orientation(t2[0],t2[1],t2[2],t1[i]); + for (int i=0; i<3; ++i) + { + int j=(i+1)%3; + test_edge(t1[i], t1[j], t2[0], t2[1], t2[2], ori[i], ori[j], inter_pts); + if (inter_pts.size()>1) return; + } + + // test edges of t2 vs t1 + for (int i=0; i<3; ++i) + ori[i] = orientation(t1[0],t1[1],t1[2],t2[i]); + for (int i=0; i<3; ++i) + { + int j=(i+1)%3; + test_edge(t2[i], t2[j], t1[0], t1[1], t1[2], ori[i], ori[j], inter_pts); + if (inter_pts.size()>1) return; + } +} + +////////////////////////////////// +////////////////////////////////// +////////////////////////////////// +////////////////////////////////// +////////////////////////////////// + template void generate_subtriangles(std::size_t ti, std::vector& segments, const std::vector& points, const std::vector& in_triangle_ids, const std::set >& intersecting_triangles, - const std::vector& triangles, - std::vector& new_triangles) + const std::vector>& triangles, + std::vector>& new_triangles) { typedef CGAL::Projection_traits_3 P_traits; typedef CGAL::Exact_intersections_tag Itag; @@ -93,7 +277,7 @@ void generate_subtriangles(std::size_t ti, //typedef CGAL::Constrained_triangulation_plus_2 CDT; typedef CDT_2 CDT; - const typename EK::Triangle_3& t = triangles[ti]; + const std::array& t = triangles[ti]; // positive triangle normal typename EK::Vector_3 n = normal(t[0], t[1], t[2]); @@ -130,6 +314,11 @@ void generate_subtriangles(std::size_t ti, //~ std::ofstream("cst_"+std::to_string(i)+".polylines.txt") << std::setprecision(17) << "2 " << segments[i] << "\n"; //~ } + auto supporting_plane = [](const std::array& t) + { + return typename EK::Plane_3(t[0], t[1], t[2]); + }; + std::vector< std::vector > points_on_segments(nbs); for (std::size_t i = 0; i(segments[i], segments[j])) + Segment_inter_type seg_inter_type = do_coplanar_segments_intersect(segments[i], segments[j]); + switch(seg_inter_type) { - auto res = CGAL::intersection(triangles[in_triangle_ids[i]].supporting_plane(), - triangles[in_triangle_ids[j]].supporting_plane(), - triangles[ti].supporting_plane()); - - if (const typename EK::Point_3* pt_ptr = boost::get(&(*res))) + case POINT_INTERSECTION: { - points_on_segments[i].push_back(*pt_ptr); - points_on_segments[j].push_back(*pt_ptr); + auto res = CGAL::intersection(supporting_plane(triangles[in_triangle_ids[i]]), + supporting_plane(triangles[in_triangle_ids[j]]), + supporting_plane(triangles[ti])); - //~ std::cout << "new inter " << *pt_ptr << "\n"; + if (const typename EK::Point_3* pt_ptr = boost::get(&(*res))) + { + points_on_segments[i].push_back(*pt_ptr); + points_on_segments[j].push_back(*pt_ptr); + //~ std::cout << "new inter " << *pt_ptr << "\n"; + + } } - else + // break; No break because of the coplanar case + case COPLANAR_SEGMENTS: { // We can have hard cases if two triangles are coplanar.... //~ std::cout << "coplanar inter: " << i << " " << j << "\n"; auto inter = CGAL::intersection(segments[i], segments[j]); + + if (inter == boost::none) throw std::runtime_error("Unexpected case #2"); + if (const typename EK::Point_3* pt_ptr = boost::get(&(*inter))) { points_on_segments[i].push_back(*pt_ptr); @@ -224,6 +421,9 @@ void generate_subtriangles(std::size_t ti, //~ debug << "4 " << triangles[ti] << " " << triangles[ti][0] << "\n"; //~ exit(1); } + break; + default: + break; } } } @@ -304,13 +504,13 @@ void generate_subtriangles(std::size_t ti, for (typename CDT::Face_handle fh : cdt.finite_face_handles()) { if (orientation_flipped) - new_triangles.emplace_back(fh->vertex(0)->point(), - fh->vertex(cdt.cw(0))->point(), - fh->vertex(cdt.ccw(0))->point()); + new_triangles.push_back( CGAL::make_array(fh->vertex(0)->point(), + fh->vertex(cdt.cw(0))->point(), + fh->vertex(cdt.ccw(0))->point()) ); else - new_triangles.emplace_back(fh->vertex(0)->point(), - fh->vertex(cdt.ccw(0))->point(), - fh->vertex(cdt.cw(0))->point()); + new_triangles.push_back( CGAL::make_array(fh->vertex(0)->point(), + fh->vertex(cdt.ccw(0))->point(), + fh->vertex(cdt.cw(0))->point()) ); #ifdef CGAL_DEBUG_PMP_AUTOREFINE_DUMP_TRIANGULATIONS ++nbt; buffer << fh->vertex(0)->point() << "\n"; @@ -329,69 +529,6 @@ void generate_subtriangles(std::size_t ti, #endif } -template -struct Intersection_visitor -{ - std::vector< std::vector >& all_segments; - std::vector< std::vector >& all_points; - std::vector< std::vector >& all_in_triangle_ids; - std::pair ids; - - Intersection_visitor(std::vector< std::vector >& all_segments, - std::vector< std::vector >& all_points, - std::vector< std::vector >& all_in_triangle_ids) - : all_segments (all_segments) - , all_points(all_points) - , all_in_triangle_ids(all_in_triangle_ids) - {} - - void set_triangle_ids(int i1, int i2) - { - ids = {i1, i2}; - } - - typedef void result_type; - void operator()(const typename EK::Point_3& p) - { - all_points[ids.first].push_back(p); - all_points[ids.second].push_back(p); - } - - void operator()(const typename EK::Segment_3& s) - { - all_segments[ids.first].push_back(s); - all_segments[ids.second].push_back(s); - all_in_triangle_ids[ids.first].push_back(ids.second); - all_in_triangle_ids[ids.second].push_back(ids.first); - } - - void operator()(const typename EK::Triangle_3& t) - { - for (std::size_t i=0; i<3; ++i) - { - typename EK::Segment_3 s(t[i], t[(i+1)%3]); - all_segments[ids.first].push_back(s); - all_segments[ids.second].push_back(s); - all_in_triangle_ids[ids.first].push_back(ids.second); - all_in_triangle_ids[ids.second].push_back(ids.first); - } - - } - - void operator()(const std::vector& poly) - { - std::size_t nbp = poly.size(); - for (std::size_t i=0; i @@ -453,24 +590,22 @@ void autorefine_soup_output(const PointRange& input_points, // init the vector of triangles used for the autorefinement of triangles typedef CGAL::Exact_predicates_exact_constructions_kernel EK; - std::vector< EK::Triangle_3 > triangles(tiid+1); + std::vector< std::array > triangles(tiid+1); Cartesian_converter to_exact; for(Input_TID f : intersected_faces) { - triangles[tri_inter_ids[f]]= EK::Triangle_3( + triangles[tri_inter_ids[f]]= CGAL::make_array( to_exact( get(pm, input_points[id_triples[f][0]]) ), to_exact( get(pm, input_points[id_triples[f][1]]) ), to_exact( get(pm, input_points[id_triples[f][2]]) ) ); } - std::vector< std::vector > all_segments(triangles.size()); + std::vector< std::vector > all_segments(triangles.size()); // TODO use std::pair std::vector< std::vector > all_points(triangles.size()); std::vector< std::vector > all_in_triangle_ids(triangles.size()); CGAL_PMP_AUTOREFINE_VERBOSE("compute intersections"); - typename EK::Intersect_3 intersection = EK().intersect_3_object(); - autorefine_impl::Intersection_visitor intersection_visitor(all_segments, all_points, all_in_triangle_ids); std::set > intersecting_triangles; for (const Pair_of_triangle_ids& p : si_pairs) @@ -480,16 +615,36 @@ void autorefine_soup_output(const PointRange& input_points, if (i1==-1 || i2==-1) continue; //skip degenerate faces - const EK::Triangle_3& t1 = triangles[i1]; - const EK::Triangle_3& t2 = triangles[i2]; + const std::array& t1 = triangles[i1]; + const std::array& t2 = triangles[i2]; - auto inter = intersection(t1, t2); + std::vector inter_pts; + autorefine_impl::collect_intersections(t1, t2, inter_pts); - if (inter != boost::none) + if (!inter_pts.empty()) { - intersecting_triangles.insert(CGAL::make_sorted_pair(i1, i2)); - intersection_visitor.set_triangle_ids(i1, i2); - boost::apply_visitor(intersection_visitor, *inter); + std::size_t nbi = inter_pts.size(); + switch(nbi) + { + case 1: + all_points[i1].push_back(inter_pts[0]); + all_points[i2].push_back(inter_pts[0]); + break; + case 2: + all_segments[i1].push_back({inter_pts[0], inter_pts[1]}); + all_segments[i2].push_back({inter_pts[0], inter_pts[1]}); + all_in_triangle_ids[i1].push_back(i2); + all_in_triangle_ids[i2].push_back(i1); + break; + default: + for (std::size_t i=0;i new_triangles; + std::vector> new_triangles; for(std::size_t ti=0; ti& t : new_triangles) { soup_triangles.emplace_back(CGAL::make_array(get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2]))); } From 10252faf1df2480f21c25959c1980e68819099a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 24 Jan 2023 16:04:43 +0100 Subject: [PATCH 024/139] WIP use segments --- .../Polygon_mesh_processing/autorefinement.h | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index afbe0c3479d..c9bb3f3ffa8 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -36,8 +36,8 @@ #include -// #define TEST_RESOLVE_INTERSECTION -// #define DEDUPLICATE_SEGMENTS +//#define TEST_RESOLVE_INTERSECTION +//#define DEDUPLICATE_SEGMENTS namespace CGAL { namespace Polygon_mesh_processing { @@ -49,8 +49,8 @@ enum Segment_inter_type { NO_INTERSECTION=0, COPLANAR_SEGMENTS, POINT_INTERSECTI template Segment_inter_type -do_coplanar_segments_intersect(const typename K::Segment_3& s1, - const typename K::Segment_3& s2, +do_coplanar_segments_intersect(const std::array& s1, + const std::array& s2, const K& k = K()) { // supporting_line intersects: points are coplanar @@ -259,7 +259,7 @@ void collect_intersections(const std::array& t1, template void generate_subtriangles(std::size_t ti, - std::vector& segments, + std::vector>& segments, const std::vector& points, const std::vector& in_triangle_ids, const std::set >& intersecting_triangles, @@ -351,7 +351,9 @@ void generate_subtriangles(std::size_t ti, //~ std::cout << "coplanar inter: " << i << " " << j << "\n"; - auto inter = CGAL::intersection(segments[i], segments[j]); + typename EK::Segment_3 s1(segments[i][0], segments[i][1]); + typename EK::Segment_3 s2(segments[j][0], segments[j][1]);// TODO: avoid this construction + auto inter = CGAL::intersection(s1, s2); if (inter == boost::none) throw std::runtime_error("Unexpected case #2"); @@ -381,7 +383,7 @@ void generate_subtriangles(std::size_t ti, // coplanar intersection that is not a point int coord = 0; const typename EK::Segment_3& s = segments[i]; - typename EK::Point_3 src = s.source(), tgt=s.target(); + typename EK::Point_3 src = s[0], tgt=s[1]; if (src.x()==tgt.x()) { coord=1; @@ -401,10 +403,10 @@ void generate_subtriangles(std::size_t ti, points_on_segments[j].push_back(tmp_pts[1]); points_on_segments[j].push_back(tmp_pts[2]); #endif - //~ std::cout << "new inter coli " << segments[j].source() << "\n"; - //~ std::cout << "new inter coli " << segments[j].target() << "\n"; - //~ std::cout << "new inter coli " << segments[i].source() << "\n"; - //~ std::cout << "new inter coli " << segments[i].target() << "\n"; + //~ std::cout << "new inter coli " << segments[j][0] << "\n"; + //~ std::cout << "new inter coli " << segments[j][1] << "\n"; + //~ std::cout << "new inter coli " << segments[i][0] << "\n"; + //~ std::cout << "new inter coli " << segments[i][1] << "\n"; //~ points_on_segments[j].push_back(*pt_ptr); @@ -437,8 +439,8 @@ void generate_subtriangles(std::size_t ti, { // TODO: predicate on input triangles int coord = 0; - const typename EK::Segment_3& s = segments[i]; - typename EK::Point_3 src = s.source(), tgt=s.target(); + const std::array& s = segments[i]; + typename EK::Point_3 src = s[0], tgt=s[1]; if (src.x()==tgt.x()) { coord=1; @@ -482,7 +484,7 @@ void generate_subtriangles(std::size_t ti, cdt.insert_constraints(cst_points.begin(), cst_points.end(), csts.begin(), csts.end()); - std::vector no_inter_segments; + std::vector> no_inter_segments; no_inter_segments.reserve(nbs); for (std::size_t i = 0; i > all_segments(triangles.size()); // TODO use std::pair + std::vector< std::vector > > all_segments(triangles.size()); std::vector< std::vector > all_points(triangles.size()); std::vector< std::vector > all_in_triangle_ids(triangles.size()); @@ -631,16 +633,16 @@ void autorefine_soup_output(const PointRange& input_points, all_points[i2].push_back(inter_pts[0]); break; case 2: - all_segments[i1].push_back({inter_pts[0], inter_pts[1]}); - all_segments[i2].push_back({inter_pts[0], inter_pts[1]}); + all_segments[i1].push_back(CGAL::make_array(inter_pts[0], inter_pts[1])); + all_segments[i2].push_back(CGAL::make_array(inter_pts[0], inter_pts[1])); all_in_triangle_ids[i1].push_back(i2); all_in_triangle_ids[i2].push_back(i1); break; default: for (std::size_t i=0;i filtered_segments; + std::vector> filtered_segments; std::vector filtered_in_triangle_ids; filtered_segments.reserve(nbs); std::set> segset; for (std::size_t si=0; si Date: Tue, 24 Jan 2023 16:04:54 +0100 Subject: [PATCH 025/139] always std::array as cst --- Triangulation_2/include/CGAL/Constrained_triangulation_2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h index 42867cfbb07..047c8526afc 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h @@ -330,11 +330,11 @@ public: #if 1 template static decltype(auto) get_source(const Segment_2& segment){ - return segment.source(); + return segment[0]; } template static decltype(auto) get_target(const Segment_2& segment){ - return segment.target(); + return segment[1]; } static const Point& get_source(const Constraint& cst){ From 810715778223710a066d3161e2a4ec453475eaf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 24 Jan 2023 18:04:10 +0100 Subject: [PATCH 026/139] WIP handle coplanar --- .../Polygon_mesh_processing/autorefinement.h | 47 +++++++++++++++---- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index c9bb3f3ffa8..f412c2ea298 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -82,8 +82,30 @@ do_coplanar_segments_intersect(const std::array& s1, ////////////////////////////////// ////////////////////////////////// -// imported from Polygon_mesh_processing/internal/Corefinement/intersect_triangle_segment_3.h +// imported from Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h +template +void coplanar_intersections(const std::array& t1, + const std::array& t2, + std::vector& inter_pts) +{ + const typename K::Point_3& p = t1[0], q = t1[1], r = t1[2]; + + std::list l_inter_pts; + l_inter_pts.push_back(t2[0]); + l_inter_pts.push_back(t2[1]); + l_inter_pts.push_back(t2[2]); + + //intersect t2 with the three half planes which intersection defines t1 + K k; + Intersections::internal::intersection_coplanar_triangles_cutoff(p,q,r,k,l_inter_pts); //line pq + Intersections::internal::intersection_coplanar_triangles_cutoff(q,r,p,k,l_inter_pts); //line qr + Intersections::internal::intersection_coplanar_triangles_cutoff(r,p,q,k,l_inter_pts); //line rp + + inter_pts.assign(l_inter_pts.begin(), l_inter_pts.end()); +} + +// imported from Polygon_mesh_processing/internal/Corefinement/intersect_triangle_segment_3.h template void find_intersection(const typename K::Point_3& p, const typename K::Point_3& q, //segment @@ -162,7 +184,7 @@ void test_edge(const typename K::Point_3& p, const typename K::Point_3& q, const Orientation abcq, std::vector& inter_pts) { - switch ( abcp ) { + switch ( abcp ) { case POSITIVE: switch ( abcq ) { case POSITIVE: @@ -213,13 +235,13 @@ void test_edge(const typename K::Point_3& p, const typename K::Point_3& q, // the segment is coplanar with the triangle's supporting plane // we test whether the segment intersects the triangle in the common // supporting plane - if ( ::CGAL::Intersections::internal::do_intersect_coplanar(a,b,c,p,q,K()) ) - { + //if ( ::CGAL::Intersections::internal::do_intersect_coplanar(a,b,c,p,q,K()) ) + //{ //handle coplanar intersection - // TODO: use coref function - throw std::runtime_error("coplanar intersection"); - return; - } + // nothing done as coplanar case handle in collect_intersections + // and other intersection points will be collected with non-coplanar edges + //} + break; } } } @@ -233,6 +255,13 @@ void collect_intersections(const std::array& t1, std::array ori; for (int i=0; i<3; ++i) ori[i] = orientation(t2[0],t2[1],t2[2],t1[i]); + + if (ori[0]== COPLANAR && ori[1]==COPLANAR && ori[2]==COPLANAR) + { + coplanar_intersections(t1, t2, inter_pts); + return; + } + for (int i=0; i<3; ++i) { int j=(i+1)%3; @@ -378,7 +407,7 @@ void generate_subtriangles(std::size_t ti, std::cerr <<"ERROR!\n"; } - #if 0 +#if 0 //this code works if triangles are not coplanar // coplanar intersection that is not a point int coord = 0; From fa662e7dea97c5f33c8872c71817c18f51df0894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 25 Jan 2023 14:45:12 +0100 Subject: [PATCH 027/139] WIP handle duplicated intersections + add in intersection list --- .../Polygon_mesh_processing/autorefinement.h | 45 +++++++++++++++---- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index f412c2ea298..ae9858ae77d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1,5 +1,5 @@ //TODO: add for soup face the id of the input face. not sure it is easy to report intersection edge as a pair of vertex id -//TODO: only return intersection segments +//TODO: only return intersection segments (pay attention to degenerate triangles that are currently ignored) // Copyright (c) 2023 GeometryFactory (France). // All rights reserved. // @@ -36,8 +36,8 @@ #include -//#define TEST_RESOLVE_INTERSECTION -//#define DEDUPLICATE_SEGMENTS +// #define TEST_RESOLVE_INTERSECTION +// #define DEDUPLICATE_SEGMENTS namespace CGAL { namespace Polygon_mesh_processing { @@ -266,7 +266,7 @@ void collect_intersections(const std::array& t1, { int j=(i+1)%3; test_edge(t1[i], t1[j], t2[0], t2[1], t2[2], ori[i], ori[j], inter_pts); - if (inter_pts.size()>1) return; + //~ if (inter_pts.size()>1) return; } // test edges of t2 vs t1 @@ -276,8 +276,13 @@ void collect_intersections(const std::array& t1, { int j=(i+1)%3; test_edge(t2[i], t2[j], t1[0], t1[1], t1[2], ori[i], ori[j], inter_pts); - if (inter_pts.size()>1) return; + //~ if (inter_pts.size()>1) return; } + + // because we don't handle intersection type and can have edge-edge edge-vertex duplicates + std::sort(inter_pts.begin(), inter_pts.end()); + auto last = std::unique(inter_pts.begin(), inter_pts.end()); + inter_pts.erase(last, inter_pts.end()); } ////////////////////////////////// @@ -288,7 +293,7 @@ void collect_intersections(const std::array& t1, template void generate_subtriangles(std::size_t ti, - std::vector>& segments, + std::vector>& segments, const std::vector& points, const std::vector& in_triangle_ids, const std::set >& intersecting_triangles, @@ -331,6 +336,27 @@ void generate_subtriangles(std::size_t ti, //~ static std::ofstream debug("inter_segments.polylines.txt"); //~ debug.precision(17); + //~ std::cout << "points.size() " << points.size() << "\n"; + //~ std::set all_triangles_indices(in_triangle_ids.begin(), in_triangle_ids.end()); + //~ all_triangles_indices.insert(ti); + + //~ std::ofstream debug("triangles.polylines.txt"); + //~ debug << std::setprecision(17); + //~ for (std::size_t i : all_triangles_indices) + //~ debug << "4 " + //~ << triangles[i][0] << " " + //~ << triangles[i][1] << " " + //~ << triangles[i][2] << " " + //~ << triangles[i][0] << "\n"; + //~ debug.close(); + //~ debug.open("triangle.off"); + //~ debug << std::setprecision(17); + //~ debug << "OFF\n3 1 0\n"; + //~ debug << triangles[ti][0] << "\n" + //~ << triangles[ti][1] << "\n" + //~ << triangles[ti][2] << "\n 3 0 1 2\n"; + //~ debug.close(); + // pre-compute segment intersections if (!segments.empty()) { @@ -340,7 +366,7 @@ void generate_subtriangles(std::size_t ti, //~ if (nbs==8) //~ { //~ for (std::size_t i = 0; i& t) @@ -404,7 +430,7 @@ void generate_subtriangles(std::size_t ti, } else - std::cerr <<"ERROR!\n"; + throw std::runtime_error("BOOM\n"); } #if 0 @@ -671,11 +697,12 @@ void autorefine_soup_output(const PointRange& input_points, for (std::size_t i=0;i Date: Thu, 2 Feb 2023 11:14:18 +0100 Subject: [PATCH 028/139] WIP new coplanar intersection --- .../Triangle_3_Triangle_3_intersection.h | 301 +++++++++++++++--- .../Polygon_mesh_processing/autorefinement.h | 36 ++- 2 files changed, 287 insertions(+), 50 deletions(-) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h index 424e1fc9361..d4e467a0798 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h @@ -31,54 +31,257 @@ namespace CGAL { namespace Intersections { namespace internal{ -template -void intersection_coplanar_triangles_cutoff(const typename Kernel::Point_3& p, - const typename Kernel::Point_3& q, - const typename Kernel::Point_3& r, - const Kernel& k, - std::list& inter_pts) +template +typename K::FT +coplanar_segment_segment_alpha_intersection(const typename K::Point_3& p1, const typename K::Point_3& p2, // segment 1 + const typename K::Point_3& p3, const typename K::Point_3& p4, // segment 2 + const K& k) { - typedef typename std::list::iterator Iterator; + const typename K::Vector_3 v1 = p2-p1; + const typename K::Vector_3 v2 = p4-p3; + + CGAL_assertion(k.coplanar_3_object()(p1,p2,p3,p4)); + + const typename K::Vector_3 v3 = p3 - p1; + const typename K::Vector_3 v3v2 = cross_product(v3,v2); + const typename K::Vector_3 v1v2 = cross_product(v1,v2); + const typename K::FT sl = v1v2.squared_length(); + CGAL_assertion(!certainly(is_zero(sl))); + + const typename K::FT t = ((v3v2.x()*v1v2.x()) + (v3v2.y()*v1v2.y()) + (v3v2.z()*v1v2.z())) / sl; + return t; // p1 + (p2-p1) * t +} + +template +struct Point_on_triangle +{ + static + inline + const typename Kernel::Point_3& + point_from_id(const typename Kernel::Point_3& p, + const typename Kernel::Point_3& q, + const typename Kernel::Point_3& r, + int id) + { + switch(id) + { + case 0: + return p; + case 1: + return q; + default: + return r; + } + } + + Point_on_triangle(int i1, int i2=-1, int sign=0, typename Kernel::FT alpha = 0.) // TODO add global zero()? + : t1_t2_ids(i1,i2) + , sign(sign) + {} + + // (id, -1) point on t1 + // (-1, id) point on t2 + // (id1, id2) intersection of edges + std::pair t1_t2_ids; + int sign; + typename Kernel::FT alpha; + + Orientation + orientation (const typename Kernel::Point_3& p1, // source of edge edge_ids1 + const typename Kernel::Point_3& q1, // target of edge edge_ids1 + const typename Kernel::Point_3& r1, + int edge_id1, + const typename Kernel::Point_3& p2, + const typename Kernel::Point_3& q2, + const typename Kernel::Point_3& r2, + const Kernel& k) const + { + if (t1_t2_ids.first!=-1) + { + if (t1_t2_ids.second==-1) return ZERO; // it is a point on t1 + // this is an intersection point + if (sign == 0) + return POSITIVE; + if (sign == -1) + return edge_id1==t1_t2_ids.first+1?POSITIVE:NEGATIVE; + else + return edge_id1==t1_t2_ids.first+1?NEGATIVE:POSITIVE; + } + else + { + //this is an input point of t2 + typename Kernel::Coplanar_orientation_3 orient = k.coplanar_orientation_3_object(); + const typename Kernel::Point_3& query = point_from_id(p2,q2,r2,t1_t2_ids.second); + return orient(p1,q1,r1,query); + } + } + + int id1() const { return t1_t2_ids.first; } + int id2() const { return t1_t2_ids.second; } + + typename Kernel::Point_3 + point(const typename Kernel::Point_3& p1, + const typename Kernel::Point_3& q1, + const typename Kernel::Point_3& r1, + const typename Kernel::Point_3& p2, + const typename Kernel::Point_3& q2, + const typename Kernel::Point_3& r2, + const Kernel& k) const + { + if (t1_t2_ids.first==-1) + return point_from_id(p2,q2,r2,t1_t2_ids.second); + if (t1_t2_ids.second==-1) + return point_from_id(p1,q1,r1,t1_t2_ids.first); + + return k.construct_barycenter_3_object()(point_from_id(p2,q2,r2,(t1_t2_ids.second+1)%3), alpha, point_from_id(p2,q2,r2,t1_t2_ids.second)) ; + } +}; + +template +Point_on_triangle +intersection(const Point_on_triangle& p, + const Point_on_triangle& q, + int edge_id_t1, + const typename Kernel::Point_3& p1, + const typename Kernel::Point_3& q1, +// const typename Kernel::Point_3& r1, + const typename Kernel::Point_3& p2, + const typename Kernel::Point_3& q2, + const typename Kernel::Point_3& r2, + const Kernel& k) +{ + typedef Point_on_triangle Pot; + switch(p.id1()) + { + case -1: + { + switch(q.id1()) + { + case -1: // (-1, ip2) - (-1, iq2) + { + typename Kernel::FT alpha = + coplanar_segment_segment_alpha_intersection(p1, q1, + Pot::point_from_id(p2, q2, r2, p.id2()), + Pot::point_from_id(p2, q2, r2, q.id2()), k); + int sgn = sign(alpha); + return Point_on_triangle(edge_id_t1, p.id2(), sgn, alpha); // intersection with an original edge of t2 + } + default: + if (q.id2()!=-1) // (-1, ip2) - (iq1, iq2) + { + // we shorten an already cut edge + CGAL_assertion((p.id2()+1)%3 == q.id2()); + + typename Kernel::FT alpha = + coplanar_segment_segment_alpha_intersection(p1, q1, + Pot::point_from_id(p2, q2, r2, p.id2()), + Pot::point_from_id(p2, q2, r2, q.id2()), k); + int sgn = sign(alpha); + return Point_on_triangle(edge_id_t1, p.id2(), sgn, alpha); + } + // (-1, ip2) - (iq1, -1) + //vertex of t1, special case t1 edge passed thru a vertex of t2 + CGAL_assertion(edge_id_t1 == 2); + return Point_on_triangle(2, -1); // point on t1 has to be created from the intersection of edge 0 and edge 1 + } + } + default: + { + switch(p.id2()) + { + case -1: + { + switch(q.id1()) + { + case -1: // (ip1, -1) - (-1, iq2) + //vertex of t1, special case t1 edge passed thru a vertex of t2 + return Point_on_triangle(0, -1); + default: + { + CGAL_assertion(q.id2()!=-1); // (ip1, -1) - (iq2, -1) + //(ip1,-1), (iq1, iq2) + CGAL_assertion(edge_id_t1==2 && p.id1()==1); + return Point_on_triangle(q.id1()==1?2:0,-1); // vertex of t1 + } + } + } + default: + { + switch(q.id1()) + { + case -1: // (ip1, ip2) - (-1, iq2) + { + // we shorten an already cut edge + CGAL_assertion((q.id2()+1)%3 == p.id2()); + + typename Kernel::FT alpha = + coplanar_segment_segment_alpha_intersection(p1, q1, + Pot::point_from_id(p2, q2, r2, q.id2()), + Pot::point_from_id(p2, q2, r2, p.id2()), k); + int sgn = sign(alpha); + return Point_on_triangle(edge_id_t1, p.id2(), sgn, alpha); + } + default: + { + switch(q.id2()) + { + case -1: // (ip1, ip2) - (iq1, -1) + { + CGAL_assertion(edge_id_t1==2 && q.id1()==1); + return Point_on_triangle(p.id1()==1?2:0); // vertex of t1 + } + default: // (ip1, ip2) - (iq1, iq2) + return Point_on_triangle((p.id1()+1)%3==q.id1()?q.id1():p.id1(), -1); // vertex of t1 + } + } + } + } + } + } + } +} + +template +void intersection_coplanar_triangles_cutoff(const typename Kernel::Point_3& p1, + const typename Kernel::Point_3& q1, + const typename Kernel::Point_3& r1, + int edge_id, + const typename Kernel::Point_3& p2, + const typename Kernel::Point_3& q2, + const typename Kernel::Point_3& r2, + const Kernel& k, + std::list>& inter_pts) +{ + typedef typename std::list>::iterator Iterator; if(inter_pts.empty()) return; - typename Kernel::Coplanar_orientation_3 orient = k.coplanar_orientation_3_object(); - typename Kernel::Construct_line_3 line = k.construct_line_3_object(); + //orient(p1,q1,r1,r1) is POSITIVE + std::map*,Orientation> orientations; // TODO skip map + for (const Point_on_triangle& pot : inter_pts) + orientations[ &pot ]=pot.orientation(p1,q1,r1,edge_id,p2,q2,r2,k); - //orient(p,q,r,r) is POSITIVE - std::map orientations; - for (Iterator it=inter_pts.begin();it!=inter_pts.end();++it) - orientations[ &(*it) ]=orient(p,q,r,*it); + CGAL_kernel_assertion_code(int pt_added = 0); - CGAL_kernel_assertion_code(int pt_added = 0;) - - const typename Kernel::Point_3* prev = &(*boost::prior(inter_pts.end())); - Iterator stop = inter_pts.size() > 2 ? inter_pts.end() : boost::prior(inter_pts.end()); + Iterator prev = std::prev(inter_pts.end()); + Iterator stop = inter_pts.size() > 2 ? inter_pts.end() : std::prev(inter_pts.end()); for(Iterator it=inter_pts.begin(); it!=stop; ++it) { - const typename Kernel::Point_3& curr = *it; - Orientation or_prev = orientations[prev], - or_curr = orientations[&curr]; + Orientation or_prev = orientations[&(*prev)], + or_curr = orientations[&(*it)]; if((or_prev == POSITIVE && or_curr == NEGATIVE) || (or_prev == NEGATIVE && or_curr == POSITIVE)) { - typename Intersection_traits::result_type - obj = intersection(line(p,q), line(*prev,curr), k); + Point_on_triangle new_pt = intersection(*prev, *it, edge_id, p1, q1, p2, q2, r2, k); - // assert "not empty" - CGAL_kernel_assertion(bool(obj)); - - const typename Kernel::Point_3* inter = intersect_get(obj); - CGAL_kernel_assertion(inter != nullptr); - - prev = &(*inter_pts.insert(it,*inter)); - orientations[prev] = COLLINEAR; - CGAL_kernel_assertion_code(++pt_added;) + prev = inter_pts.insert(it,new_pt); + orientations[&(*prev)] = COLLINEAR; + CGAL_assertion_code(++pt_added); } - prev = &(*it); + prev = it; } CGAL_kernel_assertion(pt_added<3); @@ -98,35 +301,41 @@ intersection_coplanar_triangles(const typename K::Triangle_3& t1, const typename K::Triangle_3& t2, const K& k) { - const typename K::Point_3& p = t1.vertex(0), - q = t1.vertex(1), - r = t1.vertex(2); + const typename K::Point_3& p1 = t1.vertex(0), + q1 = t1.vertex(1), + r1 = t1.vertex(2); - std::list inter_pts; - inter_pts.push_back(t2.vertex(0)); - inter_pts.push_back(t2.vertex(1)); - inter_pts.push_back(t2.vertex(2)); + const typename K::Point_3& p2 = t2.vertex(0), + q2 = t2.vertex(1), + r2 = t2.vertex(2); + + std::list> inter_pts; + inter_pts.push_back(Point_on_triangle(-1,0)); + inter_pts.push_back(Point_on_triangle(-1,1)); + inter_pts.push_back(Point_on_triangle(-1,2)); //intersect t2 with the three half planes which intersection defines t1 - intersection_coplanar_triangles_cutoff(p,q,r,k,inter_pts); //line pq - intersection_coplanar_triangles_cutoff(q,r,p,k,inter_pts); //line qr - intersection_coplanar_triangles_cutoff(r,p,q,k,inter_pts); //line rp + intersection_coplanar_triangles_cutoff(p1,q1,r1,0,p2,q2,r2,k,inter_pts); //line pq + intersection_coplanar_triangles_cutoff(q1,r1,p1,1,p2,q2,r2,k,inter_pts); //line qr + intersection_coplanar_triangles_cutoff(r1,p1,q1,2,p2,q2,r2,k,inter_pts); //line rp + auto point = [&](const Point_on_triangle& pot){ return pot.point(p1,q1,r1,p2,q2,r2,k); }; switch(inter_pts.size()) { case 0: return intersection_return(); case 1: - return intersection_return(*inter_pts.begin()); + return intersection_return(point(*inter_pts.begin())); case 2: return intersection_return( - k.construct_segment_3_object()(*inter_pts.begin(), *boost::next(inter_pts.begin())) ); + k.construct_segment_3_object()(point(*inter_pts.begin()), point(*std::next(inter_pts.begin()))) ); case 3: return intersection_return( - k.construct_triangle_3_object()(*inter_pts.begin(), *boost::next(inter_pts.begin()), *boost::prior(inter_pts.end())) ); + k.construct_triangle_3_object()(point(*inter_pts.begin()), point(*std::next(inter_pts.begin())), point(*std::prev(inter_pts.end()))) ); default: return intersection_return( - std::vector(inter_pts.begin(),inter_pts.end())); + std::vector(boost::make_transform_iterator(inter_pts.begin(), point), + boost::make_transform_iterator(inter_pts.end(), point))); } } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index ae9858ae77d..6d0334d9366 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -36,8 +36,8 @@ #include -// #define TEST_RESOLVE_INTERSECTION -// #define DEDUPLICATE_SEGMENTS +//#define TEST_RESOLVE_INTERSECTION +//#define DEDUPLICATE_SEGMENTS namespace CGAL { namespace Polygon_mesh_processing { @@ -259,6 +259,9 @@ void collect_intersections(const std::array& t1, if (ori[0]== COPLANAR && ori[1]==COPLANAR && ori[2]==COPLANAR) { coplanar_intersections(t1, t2, inter_pts); + for (auto p : inter_pts) + if (depth(p)>2) throw std::runtime_error("Depth is not 2: "+std::to_string(depth(p))); + return; } @@ -283,6 +286,11 @@ void collect_intersections(const std::array& t1, std::sort(inter_pts.begin(), inter_pts.end()); auto last = std::unique(inter_pts.begin(), inter_pts.end()); inter_pts.erase(last, inter_pts.end()); + + + for (auto p : inter_pts) + if (depth(p)>2) throw std::runtime_error("Depth is not 2: "+std::to_string(depth(p))); + } ////////////////////////////////// @@ -300,6 +308,10 @@ void generate_subtriangles(std::size_t ti, const std::vector>& triangles, std::vector>& new_triangles) { + //~ std::cout << "generate_subtriangles()\n"; + std::cout << std::setprecision(17); + + typedef CGAL::Projection_traits_3 P_traits; typedef CGAL::Exact_intersections_tag Itag; @@ -395,7 +407,7 @@ void generate_subtriangles(std::size_t ti, points_on_segments[i].push_back(*pt_ptr); points_on_segments[j].push_back(*pt_ptr); - //~ std::cout << "new inter " << *pt_ptr << "\n"; + //~ std::cout << "new inter " << *pt_ptr << " (" << depth(points_on_segments[i].back()) << ")" << "\n"; } } @@ -417,7 +429,7 @@ void generate_subtriangles(std::size_t ti, points_on_segments[i].push_back(*pt_ptr); points_on_segments[j].push_back(*pt_ptr); - //~ std::cout << "new inter bis" << *pt_ptr << "\n"; + //~ std::cout << "new inter bis " << *pt_ptr << " (" << depth(points_on_segments[i].back()) << ")" << "\n"; } else { @@ -428,6 +440,8 @@ void generate_subtriangles(std::size_t ti, points_on_segments[i].push_back(seg_ptr->target()); points_on_segments[j].push_back(seg_ptr->target()); + //~ std::cout << "new inter seg " << *seg_ptr << " (" << depth(*seg_ptr) << ")" << "\n"; + } else throw std::runtime_error("BOOM\n"); @@ -537,6 +551,20 @@ void generate_subtriangles(std::size_t ti, } } + //~ int max_degree = 0; + //~ for (const auto p : cst_points) + //~ max_degree = std::max(max_degree, depth(p)); + //~ std::cout << "max_degree " << max_degree << "\n"; + + //~ if (max_degree > 10){ + //~ for (const auto p : cst_points) + //~ std::cout << " -- " << p << "(" << depth(p) << ")\n"; + //~ std::cout << "segments:\n"; + //~ for (auto s : segments) + //~ std::cout << " " << depth(s[0]) << " " << depth(s[1]) << "\n"; + //~ exit(1); + //~ } + cdt.insert_constraints(cst_points.begin(), cst_points.end(), csts.begin(), csts.end()); std::vector> no_inter_segments; From 8e050bdb49c5268af0e12bb48bcf34edd01db96c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 1 Mar 2023 15:39:28 +0100 Subject: [PATCH 029/139] fix various bug and add debug triangle_3_triangle_3_intersection now passes --- .../Triangle_3_Triangle_3_intersection.h | 129 +++++++++++++----- 1 file changed, 97 insertions(+), 32 deletions(-) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h index d4e467a0798..55610e867ff 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h @@ -14,6 +14,8 @@ #ifndef CGAL_INTERNAL_INTERSECTIONS_TRIANGLE_3_TRIANGLE_3_INTERSECTION_H #define CGAL_INTERNAL_INTERSECTIONS_TRIANGLE_3_TRIANGLE_3_INTERSECTION_H +//#define CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + #include #include #include @@ -74,21 +76,20 @@ struct Point_on_triangle } } - Point_on_triangle(int i1, int i2=-1, int sign=0, typename Kernel::FT alpha = 0.) // TODO add global zero()? + Point_on_triangle(int i1, int i2=-1, typename Kernel::FT alpha = 0.) // TODO add global zero()? : t1_t2_ids(i1,i2) - , sign(sign) + , alpha(alpha) {} // (id, -1) point on t1 // (-1, id) point on t2 // (id1, id2) intersection of edges std::pair t1_t2_ids; - int sign; typename Kernel::FT alpha; Orientation - orientation (const typename Kernel::Point_3& p1, // source of edge edge_ids1 - const typename Kernel::Point_3& q1, // target of edge edge_ids1 + orientation (const typename Kernel::Point_3& p1, // source of edge edge_id1 + const typename Kernel::Point_3& q1, // target of edge edge_id1 const typename Kernel::Point_3& r1, int edge_id1, const typename Kernel::Point_3& p2, @@ -98,15 +99,21 @@ struct Point_on_triangle { if (t1_t2_ids.first!=-1) { - if (t1_t2_ids.second==-1) return ZERO; // it is a point on t1 + if (t1_t2_ids.second==-1) + return (edge_id1==t1_t2_ids.first || (edge_id1+1)%3==t1_t2_ids.first) ? ZERO:POSITIVE; // it is a point on t1 // this is an intersection point - if (sign == 0) - return POSITIVE; - if (sign == -1) - return edge_id1==t1_t2_ids.first+1?POSITIVE:NEGATIVE; - else - return edge_id1==t1_t2_ids.first+1?NEGATIVE:POSITIVE; - } + + if (t1_t2_ids.first==edge_id1) + return ZERO; + if (t1_t2_ids.first==(edge_id1+1)%3) + { + if (alpha==0) return ZERO; + return alpha>=0 ? POSITIVE:NEGATIVE; + } + CGAL_assertion((t1_t2_ids.first+1)%3==edge_id1); + if (alpha==1) return ZERO; + return alpha<=1?POSITIVE:NEGATIVE; + } else { //this is an input point of t2 @@ -150,6 +157,11 @@ intersection(const Point_on_triangle& p, const typename Kernel::Point_3& r2, const Kernel& k) { +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " calling intersection: "; + std::cout << " (" << p.id1() << "," << p.id2() << ",[" << p.alpha << "])-"; + std::cout << " (" << q.id1() << "," << q.id2() << ",[" << q.alpha << "]) || e" << edge_id_t1 << "\n"; +#endif typedef Point_on_triangle Pot; switch(p.id1()) { @@ -163,21 +175,23 @@ intersection(const Point_on_triangle& p, coplanar_segment_segment_alpha_intersection(p1, q1, Pot::point_from_id(p2, q2, r2, p.id2()), Pot::point_from_id(p2, q2, r2, q.id2()), k); - int sgn = sign(alpha); - return Point_on_triangle(edge_id_t1, p.id2(), sgn, alpha); // intersection with an original edge of t2 + return Point_on_triangle(edge_id_t1, p.id2(), alpha); // intersection with an original edge of t2 } default: if (q.id2()!=-1) // (-1, ip2) - (iq1, iq2) { - // we shorten an already cut edge - CGAL_assertion((p.id2()+1)%3 == q.id2()); + if (p.id2() == q.id2() || p.id2() == (q.id2()+1)%3) + { + // points are on the same edge of t2 --> we shorten an already cut edge + typename Kernel::FT alpha = + coplanar_segment_segment_alpha_intersection(p1, q1, + Pot::point_from_id(p2, q2, r2, q.id2()), + Pot::point_from_id(p2, q2, r2, (q.id2()+1)%3), k); - typename Kernel::FT alpha = - coplanar_segment_segment_alpha_intersection(p1, q1, - Pot::point_from_id(p2, q2, r2, p.id2()), - Pot::point_from_id(p2, q2, r2, q.id2()), k); - int sgn = sign(alpha); - return Point_on_triangle(edge_id_t1, p.id2(), sgn, alpha); + return Point_on_triangle(edge_id_t1, q.id2(), alpha); + } + // point of t1 + return Point_on_triangle((q.id1()+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3 , -1); } // (-1, ip2) - (iq1, -1) //vertex of t1, special case t1 edge passed thru a vertex of t2 @@ -211,15 +225,18 @@ intersection(const Point_on_triangle& p, { case -1: // (ip1, ip2) - (-1, iq2) { - // we shorten an already cut edge - CGAL_assertion((q.id2()+1)%3 == p.id2()); + if (q.id2() == p.id2() || q.id2() == (p.id2()+1)%3) + { + // points are on the same edge of t2 --> we shorten an already cut edge + typename Kernel::FT alpha = + coplanar_segment_segment_alpha_intersection(p1, q1, + Pot::point_from_id(p2, q2, r2, p.id2()), + Pot::point_from_id(p2, q2, r2, (p.id2()+1)%3), k); - typename Kernel::FT alpha = - coplanar_segment_segment_alpha_intersection(p1, q1, - Pot::point_from_id(p2, q2, r2, q.id2()), - Pot::point_from_id(p2, q2, r2, p.id2()), k); - int sgn = sign(alpha); - return Point_on_triangle(edge_id_t1, p.id2(), sgn, alpha); + return Point_on_triangle(edge_id_t1, p.id2(), alpha); + } + // point of t1 + return Point_on_triangle((p.id1()+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3 , -1); } default: { @@ -231,7 +248,8 @@ intersection(const Point_on_triangle& p, return Point_on_triangle(p.id1()==1?2:0); // vertex of t1 } default: // (ip1, ip2) - (iq1, iq2) - return Point_on_triangle((p.id1()+1)%3==q.id1()?q.id1():p.id1(), -1); // vertex of t1 + CGAL_assertion(p.id1()==q.id1()); + return Point_on_triangle((p.id1()+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3, -1); // vertex of t1 } } } @@ -252,6 +270,11 @@ void intersection_coplanar_triangles_cutoff(const typename Kernel::Point_3& p1, const Kernel& k, std::list>& inter_pts) { +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " cutoff using e" << edge_id << ": " + << to_double(p1.x()) << " " << to_double(p1.y()) << " " << to_double(p1.z()) << " " + << to_double(q1.x()) << " " << to_double(q1.y()) << " " << to_double(q1.z()) << "\n"; +#endif typedef typename std::list>::iterator Iterator; if(inter_pts.empty()) @@ -262,6 +285,12 @@ void intersection_coplanar_triangles_cutoff(const typename Kernel::Point_3& p1, for (const Point_on_triangle& pot : inter_pts) orientations[ &pot ]=pot.orientation(p1,q1,r1,edge_id,p2,q2,r2,k); +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " Orientations:"; + for (const Point_on_triangle& pot : inter_pts) + std::cout << " " << orientations[ &pot ]; + std::cout << "\n"; +#endif CGAL_kernel_assertion_code(int pt_added = 0); Iterator prev = std::prev(inter_pts.end()); @@ -301,6 +330,22 @@ intersection_coplanar_triangles(const typename K::Triangle_3& t1, const typename K::Triangle_3& t2, const K& k) { +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + auto to_string = [](const typename K::Triangle_3& t) + { + std::stringstream sstr; + sstr << "4 " + << to_double(t[0].x()) << " " << to_double(t[0].y()) << " " << to_double(t[0].z()) << " " + << to_double(t[1].x()) << " " << to_double(t[1].y()) << " " << to_double(t[1].z()) << " " + << to_double(t[2].x()) << " " << to_double(t[2].y()) << " " << to_double(t[2].z()) << " " + << to_double(t[0].x()) << " " << to_double(t[0].y()) << " " << to_double(t[0].z()) << "\n"; + return sstr.str(); + }; + + std::cout << "intersection_coplanar_triangles\n"; + std::ofstream("/tmp/t1.polylines.txt") << to_string(t1) << "\n"; + std::ofstream("/tmp/t2.polylines.txt") << to_string(t2) << "\n"; +#endif const typename K::Point_3& p1 = t1.vertex(0), q1 = t1.vertex(1), r1 = t1.vertex(2); @@ -314,10 +359,30 @@ intersection_coplanar_triangles(const typename K::Triangle_3& t1, inter_pts.push_back(Point_on_triangle(-1,1)); inter_pts.push_back(Point_on_triangle(-1,2)); +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + auto print_points = [&]() + { + for(auto p : inter_pts) std::cout << " (" << p.id1() << "," << p.id2() << ",[" << p.alpha << "]) "; std::cout <<"\n"; + }; + std::cout << " ipts size: " << inter_pts.size() << "\n"; + print_points(); +#endif //intersect t2 with the three half planes which intersection defines t1 intersection_coplanar_triangles_cutoff(p1,q1,r1,0,p2,q2,r2,k,inter_pts); //line pq +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " ipts size: " << inter_pts.size() << "\n"; + print_points(); +#endif intersection_coplanar_triangles_cutoff(q1,r1,p1,1,p2,q2,r2,k,inter_pts); //line qr +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " ipts size: " << inter_pts.size() << "\n"; + print_points(); +#endif intersection_coplanar_triangles_cutoff(r1,p1,q1,2,p2,q2,r2,k,inter_pts); //line rp +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " ipts size: " << inter_pts.size() << "\n"; + print_points(); +#endif auto point = [&](const Point_on_triangle& pot){ return pot.point(p1,q1,r1,p2,q2,r2,k); }; switch(inter_pts.size()) From 0bf300d5c51ea71657925aec1a3e6721729cc3c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 1 Mar 2023 17:19:35 +0100 Subject: [PATCH 030/139] plug new coplanar triangle intersection code --- .../Polygon_mesh_processing/autorefinement.h | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 6d0334d9366..b87a04c8a6a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -83,26 +83,44 @@ do_coplanar_segments_intersect(const std::array& s1, ////////////////////////////////// // imported from Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h - template void coplanar_intersections(const std::array& t1, const std::array& t2, std::vector& inter_pts) { - const typename K::Point_3& p = t1[0], q = t1[1], r = t1[2]; + const typename K::Point_3& p1 = t1[0], q1 = t1[1], r1 = t1[2]; + const typename K::Point_3& p2 = t2[0], q2 = t2[1], r2 = t2[2]; - std::list l_inter_pts; - l_inter_pts.push_back(t2[0]); - l_inter_pts.push_back(t2[1]); - l_inter_pts.push_back(t2[2]); + std::list> l_inter_pts; + l_inter_pts.push_back(Intersections::internal::Point_on_triangle(-1,0)); + l_inter_pts.push_back(Intersections::internal::Point_on_triangle(-1,1)); + l_inter_pts.push_back(Intersections::internal::Point_on_triangle(-1,2)); + +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + auto to_string = [](const auto& t) + { + std::stringstream sstr; + sstr << "4 " + << to_double(t[0].x()) << " " << to_double(t[0].y()) << " " << to_double(t[0].z()) << " " + << to_double(t[1].x()) << " " << to_double(t[1].y()) << " " << to_double(t[1].z()) << " " + << to_double(t[2].x()) << " " << to_double(t[2].y()) << " " << to_double(t[2].z()) << " " + << to_double(t[0].x()) << " " << to_double(t[0].y()) << " " << to_double(t[0].z()) << "\n"; + return sstr.str(); + }; + + std::cout << "intersection_coplanar_triangles\n"; + std::ofstream("/tmp/t1.polylines.txt") << to_string(t1) << "\n"; + std::ofstream("/tmp/t2.polylines.txt") << to_string(t2) << "\n"; +#endif //intersect t2 with the three half planes which intersection defines t1 K k; - Intersections::internal::intersection_coplanar_triangles_cutoff(p,q,r,k,l_inter_pts); //line pq - Intersections::internal::intersection_coplanar_triangles_cutoff(q,r,p,k,l_inter_pts); //line qr - Intersections::internal::intersection_coplanar_triangles_cutoff(r,p,q,k,l_inter_pts); //line rp + intersection_coplanar_triangles_cutoff(p1,q1,r1,0,p2,q2,r2,k,l_inter_pts); //line p1q1 + intersection_coplanar_triangles_cutoff(q1,r1,p1,1,p2,q2,r2,k,l_inter_pts); //line q1r1 + intersection_coplanar_triangles_cutoff(r1,p1,q1,2,p2,q2,r2,k,l_inter_pts); //line r1p1 - inter_pts.assign(l_inter_pts.begin(), l_inter_pts.end()); + for (const Intersections::internal::Point_on_triangle& pot : l_inter_pts) + inter_pts.push_back( pot.point(p1,q1,r1,p2,q2,r2,k) ); } // imported from Polygon_mesh_processing/internal/Corefinement/intersect_triangle_segment_3.h From 4fa600bc5fbf357f071817c7e8a775e89d9b2fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 3 Mar 2023 10:33:16 +0100 Subject: [PATCH 031/139] bug fix --- .../internal/Triangle_3_Triangle_3_intersection.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h index 55610e867ff..7c6ad7b95f8 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h @@ -33,6 +33,7 @@ namespace CGAL { namespace Intersections { namespace internal{ +//TODO: move into a functor template typename K::FT coplanar_segment_segment_alpha_intersection(const typename K::Point_3& p1, const typename K::Point_3& p2, // segment 1 @@ -248,8 +249,18 @@ intersection(const Point_on_triangle& p, return Point_on_triangle(p.id1()==1?2:0); // vertex of t1 } default: // (ip1, ip2) - (iq1, iq2) - CGAL_assertion(p.id1()==q.id1()); - return Point_on_triangle((p.id1()+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3, -1); // vertex of t1 + { + CGAL_assertion(p.id1()==q.id1() || p.id2()==q.id2() ); + + if (p.id1()==q.id1()) + return Point_on_triangle((p.id1()+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3, -1); // vertex of t1 + + typename Kernel::FT alpha = + coplanar_segment_segment_alpha_intersection(p1, q1, + Pot::point_from_id(p2, q2, r2, q.id2()), + Pot::point_from_id(p2, q2, r2, (q.id2()+1)%3), k); + return Point_on_triangle(edge_id_t1, q.id2(), alpha); + } } } } From 2fade292146be00a4d383c8a0356802de81aa708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 3 Mar 2023 10:35:42 +0100 Subject: [PATCH 032/139] add more debug --- .../Polygon_mesh_processing/autorefinement.h | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index b87a04c8a6a..c5f3ebb7890 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -38,6 +38,7 @@ //#define TEST_RESOLVE_INTERSECTION //#define DEDUPLICATE_SEGMENTS +//#define DEBUG_DEPTH namespace CGAL { namespace Polygon_mesh_processing { @@ -111,13 +112,31 @@ void coplanar_intersections(const std::array& t1, std::cout << "intersection_coplanar_triangles\n"; std::ofstream("/tmp/t1.polylines.txt") << to_string(t1) << "\n"; std::ofstream("/tmp/t2.polylines.txt") << to_string(t2) << "\n"; + auto print_points = [&]() + { + for(auto p : l_inter_pts) std::cout << " (" << p.id1() << "," << p.id2() << ",[" << p.alpha << "]) "; std::cout <<"\n"; + }; + std::cout << " ipts size: " << l_inter_pts.size() << "\n"; + print_points(); #endif //intersect t2 with the three half planes which intersection defines t1 K k; intersection_coplanar_triangles_cutoff(p1,q1,r1,0,p2,q2,r2,k,l_inter_pts); //line p1q1 +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " ipts size: " << l_inter_pts.size() << "\n"; + print_points(); +#endif intersection_coplanar_triangles_cutoff(q1,r1,p1,1,p2,q2,r2,k,l_inter_pts); //line q1r1 +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " ipts size: " << l_inter_pts.size() << "\n"; + print_points(); +#endif intersection_coplanar_triangles_cutoff(r1,p1,q1,2,p2,q2,r2,k,l_inter_pts); //line r1p1 +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " ipts size: " << l_inter_pts.size() << "\n"; + print_points(); +#endif for (const Intersections::internal::Point_on_triangle& pot : l_inter_pts) inter_pts.push_back( pot.point(p1,q1,r1,p2,q2,r2,k) ); @@ -277,8 +296,10 @@ void collect_intersections(const std::array& t1, if (ori[0]== COPLANAR && ori[1]==COPLANAR && ori[2]==COPLANAR) { coplanar_intersections(t1, t2, inter_pts); +#ifdef DEBUG_DEPTH for (auto p : inter_pts) - if (depth(p)>2) throw std::runtime_error("Depth is not 2: "+std::to_string(depth(p))); + if (depth(p)>2) throw std::runtime_error("Depth is not 4: "+std::to_string(depth(p))); +#endif return; } @@ -308,7 +329,6 @@ void collect_intersections(const std::array& t1, for (auto p : inter_pts) if (depth(p)>2) throw std::runtime_error("Depth is not 2: "+std::to_string(depth(p))); - } ////////////////////////////////// From f3e4a60f96be4fe94124a8c945a0bd3bd2f5ffb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 6 Mar 2023 14:03:24 +0100 Subject: [PATCH 033/139] fix intersection point computation --- .../internal/Triangle_3_Triangle_3_intersection.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h index 7c6ad7b95f8..ac376f44350 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h @@ -141,7 +141,7 @@ struct Point_on_triangle if (t1_t2_ids.second==-1) return point_from_id(p1,q1,r1,t1_t2_ids.first); - return k.construct_barycenter_3_object()(point_from_id(p2,q2,r2,(t1_t2_ids.second+1)%3), alpha, point_from_id(p2,q2,r2,t1_t2_ids.second)) ; + return k.construct_barycenter_3_object()(point_from_id(p1,q1,r1,(t1_t2_ids.first+1)%3), alpha, point_from_id(p1,q1,r1,t1_t2_ids.first)) ; } }; @@ -160,8 +160,8 @@ intersection(const Point_on_triangle& p, { #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION std::cout << " calling intersection: "; - std::cout << " (" << p.id1() << "," << p.id2() << ",[" << p.alpha << "])-"; - std::cout << " (" << q.id1() << "," << q.id2() << ",[" << q.alpha << "]) || e" << edge_id_t1 << "\n"; + std::cout << " (" << p.id1() << "," << p.id2() << ",[" << p.alpha << "]) -"; + std::cout << " (" << q.id1() << "," << q.id2() << ",[" << q.alpha << "]) || e" << edge_id_t1 << "\n"; #endif typedef Point_on_triangle Pot; switch(p.id1()) @@ -354,8 +354,8 @@ intersection_coplanar_triangles(const typename K::Triangle_3& t1, }; std::cout << "intersection_coplanar_triangles\n"; - std::ofstream("/tmp/t1.polylines.txt") << to_string(t1) << "\n"; - std::ofstream("/tmp/t2.polylines.txt") << to_string(t2) << "\n"; + std::ofstream("/tmp/t1.polylines.txt") << std::setprecision(17) << to_string(t1) << "\n"; + std::ofstream("/tmp/t2.polylines.txt") << std::setprecision(17) << to_string(t2) << "\n"; #endif const typename K::Point_3& p1 = t1.vertex(0), q1 = t1.vertex(1), From f499c392664483298fb4c26bc587cce758671b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 6 Mar 2023 19:30:07 +0100 Subject: [PATCH 034/139] add a version with fixed dimension for projection --- .../Polygon_mesh_processing/autorefinement.h | 54 +++++++++++++++++-- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index c5f3ebb7890..7524c9c7f34 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -38,8 +38,13 @@ //#define TEST_RESOLVE_INTERSECTION //#define DEDUPLICATE_SEGMENTS +//#define USE_FIXED_PROJECTION_TRAITS //#define DEBUG_DEPTH +#ifdef USE_FIXED_PROJECTION_TRAITS +#include +#endif + namespace CGAL { namespace Polygon_mesh_processing { @@ -337,7 +342,11 @@ void collect_intersections(const std::array& t1, ////////////////////////////////// ////////////////////////////////// -template +template void generate_subtriangles(std::size_t ti, std::vector>& segments, const std::vector& points, @@ -349,8 +358,11 @@ void generate_subtriangles(std::size_t ti, //~ std::cout << "generate_subtriangles()\n"; std::cout << std::setprecision(17); - +#ifdef USE_FIXED_PROJECTION_TRAITS + typedef ::CGAL::internal::Projection_traits_3 P_traits; +#else typedef CGAL::Projection_traits_3 P_traits; +#endif typedef CGAL::Exact_intersections_tag Itag; typedef CGAL::Constrained_Delaunay_triangulation_2set_point(t[2]); +#endif #ifdef TEST_RESOLVE_INTERSECTION //~ static std::ofstream debug("inter_segments.polylines.txt"); @@ -832,7 +852,31 @@ void autorefine_soup_output(const PointRange& input_points, if (all_segments[ti].empty() && all_points[ti].empty()) new_triangles.push_back(triangles[ti]); else + { + #ifdef USE_FIXED_PROJECTION_TRAITS + const std::array& t = triangles[ti]; + auto is_constant_in_dim = [](const std::array& t, int dim) + { + return t[0][dim]==t[1][dim] && t[0][dim]!=t[2][dim]; + }; + + typename EK::Vector_3 orth = CGAL::normal(t[0], t[1], t[2]); // TODO::avoid construction? + 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) { + autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); + } else if(c == 1) { + autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); + } else if(c == 2) { + autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); + } + #else autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); + #endif + } + + } // brute force output: create a soup, orient and to-mesh From 3abf7c401b67eefc2a2408dbac40c11f7e933203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 6 Mar 2023 19:31:26 +0100 Subject: [PATCH 035/139] add debug --- .../CGAL/Polygon_mesh_processing/autorefinement.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 7524c9c7f34..e5a7dbbb139 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -145,6 +145,19 @@ void coplanar_intersections(const std::array& t1, for (const Intersections::internal::Point_on_triangle& pot : l_inter_pts) inter_pts.push_back( pot.point(p1,q1,r1,p2,q2,r2,k) ); + +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::ofstream debug("interpts.xyz"); + debug << std::setprecision(17); + debug << l_inter_pts.size() << "\n"; + for (auto pot : l_inter_pts) + debug << pot.point(p1,q1,r1,p2,q2,r2,k) << "\n"; + debug.close(); + std::cout <<"check!\n"; + int i; + std::cin >> i; +#endif + } // imported from Polygon_mesh_processing/internal/Corefinement/intersect_triangle_segment_3.h From 8ff9f17a415524a52aa253b3c148ad45459de656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 13 Mar 2023 15:33:35 +0100 Subject: [PATCH 036/139] restore traits creation --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index e5a7dbbb139..3bb845854ec 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -401,13 +401,14 @@ void generate_subtriangles(std::size_t ti, cdt.insert(t[1]); cdt.insert(t[2]); #else - P_traits cdt_traits(n); bool orientation_flipped = false; if ( typename EK::Less_xyz_3()(o+n,o) ) { n=-n; orientation_flipped = true; } + + P_traits cdt_traits(n); CDT cdt(cdt_traits); cdt.insert_outside_affine_hull(t[0]); cdt.insert_outside_affine_hull(t[1]); From 14105bbdd4319109f83b256b7af86e855870a487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 14 Mar 2023 13:56:54 +0100 Subject: [PATCH 037/139] always use local indices for range insertion of constraints --- .../Polygon_mesh_processing/autorefinement.h | 253 ++++++++++++------ 1 file changed, 167 insertions(+), 86 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 3bb845854ec..a81b00f65a4 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -37,7 +37,8 @@ #include //#define TEST_RESOLVE_INTERSECTION -//#define DEDUPLICATE_SEGMENTS +#define DEDUPLICATE_SEGMENTS +//#define DEBUG_COUNTERS //#define USE_FIXED_PROJECTION_TRAITS //#define DEBUG_DEPTH @@ -45,6 +46,10 @@ #include #endif +#ifdef DEBUG_COUNTERS +#include +#endif + namespace CGAL { namespace Polygon_mesh_processing { @@ -55,28 +60,28 @@ enum Segment_inter_type { NO_INTERSECTION=0, COPLANAR_SEGMENTS, POINT_INTERSECTI template Segment_inter_type -do_coplanar_segments_intersect(const std::array& s1, - const std::array& s2, +do_coplanar_segments_intersect(const typename K::Point_3& s1_0, const typename K::Point_3& s1_1, + const typename K::Point_3& s2_0, const typename K::Point_3& s2_1, const K& k = K()) { // supporting_line intersects: points are coplanar typename K::Coplanar_orientation_3 cpl_orient=k.coplanar_orientation_3_object(); - ::CGAL::Orientation or1 = cpl_orient(s1[0], s1[1], s2[0]); - ::CGAL::Orientation or2 = cpl_orient(s1[0], s1[1], s2[1]); + ::CGAL::Orientation or1 = cpl_orient(s1_0, s1_1, s2_0); + ::CGAL::Orientation or2 = cpl_orient(s1_0, s1_1, s2_1); if(or1 == COLLINEAR && or2 == COLLINEAR) { // segments are collinear typename K::Collinear_are_ordered_along_line_3 cln_order = k.collinear_are_ordered_along_line_3_object(); - return (cln_order(s1[0], s2[0], s1[1]) || - cln_order(s1[0], s2[1], s1[1]) || - cln_order(s2[0], s1[0], s2[1])) ? COPLANAR_SEGMENTS : NO_INTERSECTION; + return (cln_order(s1_0, s2_0, s1_1) || + cln_order(s1_0, s2_1, s1_1) || + cln_order(s2_0, s1_0, s2_1)) ? COPLANAR_SEGMENTS : NO_INTERSECTION; } if(or1 != or2) { - or1 = cpl_orient(s2[0], s2[1], s1[0]); - return (or1 == COLLINEAR || or1 != cpl_orient(s2[0], s2[1], s1[1])) ? POINT_INTERSECTION : NO_INTERSECTION; + or1 = cpl_orient(s2_0, s2_1, s1_0); + return (or1 == COLLINEAR || or1 != cpl_orient(s2_0, s2_1, s1_1)) ? POINT_INTERSECTION : NO_INTERSECTION; } return NO_INTERSECTION; @@ -361,8 +366,8 @@ template void generate_subtriangles(std::size_t ti, - std::vector>& segments, - const std::vector& points, + std::vector>& segments, + std::vector& points, const std::vector& in_triangle_ids, const std::set >& intersecting_triangles, const std::vector>& triangles, @@ -376,13 +381,14 @@ void generate_subtriangles(std::size_t ti, #else typedef CGAL::Projection_traits_3 P_traits; #endif - typedef CGAL::Exact_intersections_tag Itag; - typedef CGAL::Constrained_Delaunay_triangulation_2 CDT_2; + + typedef CGAL::Constrained_Delaunay_triangulation_2 CDT_2; //typedef CGAL::Constrained_triangulation_plus_2 CDT; typedef CDT_2 CDT; @@ -416,6 +422,35 @@ void generate_subtriangles(std::size_t ti, v->set_point(t[2]); #endif +#ifdef DEBUG_COUNTERS + struct Counter + { + int c1=0; + int c2=0; + int c3=0; + int c4=0; + int total=0; + ~Counter() + { + std::cout << "intersection of 3 planes: " << c1 << "\n"; + std::cout << "coplanar segment intersection : " << c2 << "\n"; + std::cout << "coplanar segment overlap: " << c3 << "\n"; + std::cout << "no intersection: " << c4 << "\n"; + std::cout << "# pairs of segments : " << total << "\n"; + std::cout << "time computing segment intersections: " << timer1.time() << "\n"; + std::cout << "time sorting intersection points: " << timer2.time() << "\n"; + std::cout << "time for cdt of constraints: " << timer3.time() << "\n"; + } + CGAL::Real_timer timer1, timer2, timer3; + }; + + static Counter counter; +#define COUNTER_INSTRUCTION(X) X +#else +#define COUNTER_INSTRUCTION(X) +#endif + + #ifdef TEST_RESOLVE_INTERSECTION //~ static std::ofstream debug("inter_segments.polylines.txt"); //~ debug.precision(17); @@ -458,14 +493,33 @@ void generate_subtriangles(std::size_t ti, return typename EK::Plane_3(t[0], t[1], t[2]); }; - std::vector< std::vector > points_on_segments(nbs); + std::vector< std::vector > points_on_segments(nbs); + + COUNTER_INSTRUCTION(counter.timer1.start();) + + std::map point_id_map; + + for (std::size_t pid=0; pidsecond; + }; + + for (std::size_t i = 0; i(segments[i], segments[j]); + Segment_inter_type seg_inter_type = + do_coplanar_segments_intersect(points[segments[i].first], points[segments[i].second], + points[segments[j].first], points[segments[j].second]); switch(seg_inter_type) { case POINT_INTERSECTION: @@ -476,9 +530,11 @@ void generate_subtriangles(std::size_t ti, if (const typename EK::Point_3* pt_ptr = boost::get(&(*res))) { - points_on_segments[i].push_back(*pt_ptr); - points_on_segments[j].push_back(*pt_ptr); - + COUNTER_INSTRUCTION(++counter.c1;) + std::size_t pid = get_point_id(*pt_ptr); + points_on_segments[i].push_back(pid); + points_on_segments[j].push_back(pid); + break; //~ std::cout << "new inter " << *pt_ptr << " (" << depth(points_on_segments[i].back()) << ")" << "\n"; } @@ -490,30 +546,35 @@ void generate_subtriangles(std::size_t ti, //~ std::cout << "coplanar inter: " << i << " " << j << "\n"; - typename EK::Segment_3 s1(segments[i][0], segments[i][1]); - typename EK::Segment_3 s2(segments[j][0], segments[j][1]);// TODO: avoid this construction + typename EK::Segment_3 s1(points[segments[i].first], points[segments[i].second]); + typename EK::Segment_3 s2(points[segments[j].first], points[segments[j].second]);// TODO: avoid this construction auto inter = CGAL::intersection(s1, s2); if (inter == boost::none) throw std::runtime_error("Unexpected case #2"); if (const typename EK::Point_3* pt_ptr = boost::get(&(*inter))) { - points_on_segments[i].push_back(*pt_ptr); - points_on_segments[j].push_back(*pt_ptr); - + COUNTER_INSTRUCTION(++counter.c2;) + std::size_t pid = get_point_id(*pt_ptr); + points_on_segments[i].push_back(pid); + points_on_segments[j].push_back(pid); + break; //~ std::cout << "new inter bis " << *pt_ptr << " (" << depth(points_on_segments[i].back()) << ")" << "\n"; } else { if (const typename EK::Segment_3* seg_ptr = boost::get(&(*inter))) { - points_on_segments[i].push_back(seg_ptr->source()); - points_on_segments[j].push_back(seg_ptr->source()); - points_on_segments[i].push_back(seg_ptr->target()); - points_on_segments[j].push_back(seg_ptr->target()); - + //TODO HERE WE SHOULD IMPROVE TO AVOID RECOMPUTING SEGMENTS ENDPOINTS + COUNTER_INSTRUCTION(++counter.c3;) + std::size_t src_pid = get_point_id(seg_ptr->source()); + std::size_t tgt_pid = get_point_id(seg_ptr->target()); + points_on_segments[i].push_back(src_pid); + points_on_segments[j].push_back(src_pid); + points_on_segments[i].push_back(tgt_pid); + points_on_segments[j].push_back(tgt_pid); + break; //~ std::cout << "new inter seg " << *seg_ptr << " (" << depth(*seg_ptr) << ")" << "\n"; - } else throw std::runtime_error("BOOM\n"); @@ -564,24 +625,26 @@ void generate_subtriangles(std::size_t ti, //~ debug << "4 " << triangles[ti] << " " << triangles[ti][0] << "\n"; //~ exit(1); } - break; +// break; default: + COUNTER_INSTRUCTION(++counter.c4;) break; } } + COUNTER_INSTRUCTION(++counter.total;) } } - - std::vector cst_points; - std::vector> csts; + COUNTER_INSTRUCTION(counter.timer1.stop();) + COUNTER_INSTRUCTION(counter.timer2.start();) + std::size_t nb_new_segments=0; for (std::size_t i = 0; i& s = segments[i]; - typename EK::Point_3 src = s[0], tgt=s[1]; + std::size_t src_id = segments[i].first, tgt_id = segments[i].second; + typename EK::Point_3 src = points[src_id], tgt=points[tgt_id]; if (src.x()==tgt.x()) { coord=1; @@ -589,15 +652,23 @@ void generate_subtriangles(std::size_t ti, coord==2; } if (src[coord]>tgt[coord]) + { + std::swap(src_id, tgt_id); std::swap(src, tgt); + } - std::sort(points_on_segments[i].begin(), points_on_segments[i].end(), [coord](const typename EK::Point_3& p, const typename EK::Point_3& q){return p[coord]> no_inter_segments; - no_inter_segments.reserve(nbs); + // now fill segments with new segments + segments.reserve(segments.size()+nb_new_segments); for (std::size_t i = 0; i to_input; - std::map point_id_map; -#if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) - std::vector exact_soup_points; -#endif - - auto get_point_id = [&](const typename EK::Point_3& pt) - { - auto insert_res = point_id_map.insert(std::make_pair(pt, soup_points.size())); - if (insert_res.second) - { - soup_points.push_back(to_input(pt)); -#if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) - exact_soup_points.push_back(pt); -#endif - } - return insert_res.first->second; - }; - - // filter duplicated segments #ifdef DEDUPLICATE_SEGMENTS + // deduplicate inserted segments + std::vector>> all_segments_ids(all_segments.size()); for(std::size_t ti=0; ti point_id_map; + auto get_point_id = [&](const typename EK::Point_3& pt) + { + auto insert_res = point_id_map.insert(std::make_pair(pt, all_points[ti].size())); + if (insert_res.second) + all_points[ti].push_back(pt); + return insert_res.first->second; + }; + std::size_t nbs = all_segments[ti].size(); std::vector> filtered_segments; std::vector filtered_in_triangle_ids; @@ -841,19 +904,16 @@ void autorefine_soup_output(const PointRange& input_points, { EK::Point_3 src = all_segments[ti][si][0], tgt = all_segments[ti][si][1]; + std::size_t src_id = get_point_id(src), tgt_id=get_point_id(tgt); if (segset.insert( - CGAL::make_sorted_pair( get_point_id(src), - get_point_id(tgt))).second) + CGAL::make_sorted_pair(src_id, tgt_id)).second) { - filtered_segments.push_back(all_segments[ti][si]); + all_segments_ids[ti].emplace_back(src_id, tgt_id); filtered_in_triangle_ids.push_back(all_in_triangle_ids[ti][si]); } } - if (filtered_segments.size()!=nbs) - { - filtered_segments.swap(all_segments[ti]); + if (all_segments_ids[ti].size()!=nbs) filtered_in_triangle_ids.swap(all_in_triangle_ids[ti]); - } } } #endif @@ -886,7 +946,7 @@ void autorefine_soup_output(const PointRange& input_points, autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); } #else - autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); + autorefine_impl::generate_subtriangles(ti, all_segments_ids[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); #endif } @@ -896,11 +956,31 @@ void autorefine_soup_output(const PointRange& input_points, // brute force output: create a soup, orient and to-mesh CGAL_PMP_AUTOREFINE_VERBOSE("create output soup"); + Cartesian_converter to_input; + std::map point_id_map; +#if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) + std::vector exact_soup_points; +#endif + + auto get_point_id = [&](const typename EK::Point_3& pt) + { + auto insert_res = point_id_map.insert(std::make_pair(pt, soup_points.size())); + if (insert_res.second) + { + soup_points.push_back(to_input(pt)); +#if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) + exact_soup_points.push_back(pt); +#endif + } + return insert_res.first->second; + }; + std::vector input_point_ids; input_point_ids.reserve(input_points.size()); for (const auto& p : input_points) input_point_ids.push_back(get_point_id(to_exact(get(pm,p)))); + // raw copy of input triangles with no intersection for (Input_TID f=0; f& t : new_triangles) { soup_triangles.emplace_back(CGAL::make_array(get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2]))); From 003910ee220262b370b31bfe525ecb20bf2e8a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 14 Mar 2023 18:10:04 +0100 Subject: [PATCH 038/139] fix typo --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index a81b00f65a4..e18cf1982b2 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -663,7 +663,7 @@ void generate_subtriangles(std::size_t ti, [&](std::size_t id1, std::size_t id2) { if (id1==id2) return false; - return points[id1][coord] Date: Tue, 14 Mar 2023 18:32:31 +0100 Subject: [PATCH 039/139] dramatic typo --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index e18cf1982b2..d40fce82d2b 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -649,7 +649,7 @@ void generate_subtriangles(std::size_t ti, { coord=1; if (src.y()==tgt.y()) - coord==2; + coord=2; } if (src[coord]>tgt[coord]) { From 5defd784cc0dae96083708f8b2454c2249509dad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 15 Mar 2023 14:24:37 +0100 Subject: [PATCH 040/139] better treatment of intersection between segments --- .../Polygon_mesh_processing/autorefinement.h | 447 ++++++++++++++---- 1 file changed, 346 insertions(+), 101 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index d40fce82d2b..711c3d82ce0 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -56,13 +56,59 @@ namespace Polygon_mesh_processing { #ifndef DOXYGEN_RUNNING namespace autorefine_impl { -enum Segment_inter_type { NO_INTERSECTION=0, COPLANAR_SEGMENTS, POINT_INTERSECTION }; + +enum Segment_inter_type_old { NO_INTERSECTION_OLD=0, COPLANAR_SEGMENTS, POINT_INTERSECTION_OLD }; +enum Segment_inter_type { NO_INTERSECTION=0, + POINT_INTERSECTION, + POINT_P, + POINT_Q, + POINT_R, + POINT_S, + COPLANAR_SEGMENT_PQ, + COPLANAR_SEGMENT_RS, + COPLANAR_SEGMENT_PS, + COPLANAR_SEGMENT_QS, + COPLANAR_SEGMENT_PR, + COPLANAR_SEGMENT_QR, + }; + + + +std::string print_enum(Segment_inter_type_old s) +{ + switch(s) + { + case NO_INTERSECTION_OLD: return "NO_INTERSECTION_OLD"; + case COPLANAR_SEGMENTS: return "COPLANAR_SEGMENTS"; + case POINT_INTERSECTION_OLD: return "POINT_INTERSECTION_OLD"; + } +} + +std::string print_enum(Segment_inter_type s) +{ + switch(s) + { + case NO_INTERSECTION: return "NO_INTERSECTION"; + case POINT_INTERSECTION: return "POINT_INTERSECTION"; + case POINT_P: return "POINT_P"; + case POINT_Q: return "POINT_Q"; + case POINT_R: return "POINT_R"; + case POINT_S: return "POINT_S"; + case COPLANAR_SEGMENT_PQ: return "COPLANAR_SEGMENT_PQ"; + case COPLANAR_SEGMENT_RS: return "COPLANAR_SEGMENT_RS"; + case COPLANAR_SEGMENT_PS: return "COPLANAR_SEGMENT_PS"; + case COPLANAR_SEGMENT_QS: return "COPLANAR_SEGMENT_QS"; + case COPLANAR_SEGMENT_PR: return "COPLANAR_SEGMENT_PR"; + case COPLANAR_SEGMENT_QR: return "COPLANAR_SEGMENT_QR"; + } +} + template -Segment_inter_type -do_coplanar_segments_intersect(const typename K::Point_3& s1_0, const typename K::Point_3& s1_1, - const typename K::Point_3& s2_0, const typename K::Point_3& s2_1, - const K& k = K()) +Segment_inter_type_old +do_coplanar_segments_intersect_old(const typename K::Point_3& s1_0, const typename K::Point_3& s1_1, + const typename K::Point_3& s2_0, const typename K::Point_3& s2_1, + const K& k = K()) { // supporting_line intersects: points are coplanar typename K::Coplanar_orientation_3 cpl_orient=k.coplanar_orientation_3_object(); @@ -75,13 +121,155 @@ do_coplanar_segments_intersect(const typename K::Point_3& s1_0, const typename K typename K::Collinear_are_ordered_along_line_3 cln_order = k.collinear_are_ordered_along_line_3_object(); return (cln_order(s1_0, s2_0, s1_1) || cln_order(s1_0, s2_1, s1_1) || - cln_order(s2_0, s1_0, s2_1)) ? COPLANAR_SEGMENTS : NO_INTERSECTION; + cln_order(s2_0, s1_0, s2_1)) ? COPLANAR_SEGMENTS : NO_INTERSECTION_OLD; } if(or1 != or2) { or1 = cpl_orient(s2_0, s2_1, s1_0); - return (or1 == COLLINEAR || or1 != cpl_orient(s2_0, s2_1, s1_1)) ? POINT_INTERSECTION : NO_INTERSECTION; + return (or1 == COLLINEAR || or1 != cpl_orient(s2_0, s2_1, s1_1)) ? POINT_INTERSECTION_OLD : NO_INTERSECTION_OLD; + } + + return NO_INTERSECTION_OLD; +} + + +// test intersection in the interior of segment pq and rs with pq and rs being coplanar segments +// note that for coplanar cases, we might report identical endpoints +template +Segment_inter_type +do_coplanar_segments_intersect(std::size_t pi, std::size_t qi, + std::size_t ri, std::size_t si, + const std::vector& points, + const K& k = K()) +{ + typename K::Collinear_are_ordered_along_line_3 cln_order = k.collinear_are_ordered_along_line_3_object(); + typename K::Coplanar_orientation_3 cpl_orient=k.coplanar_orientation_3_object(); + + const typename K::Point_3& p=points[pi]; + const typename K::Point_3& q=points[qi]; + const typename K::Point_3& r=points[ri]; + const typename K::Point_3& s=points[si]; + + // first handle case of shared endpoints + if (pi==ri) + { + if (si==qi || cpl_orient(p, q, s)!=COPLANAR) return NO_INTERSECTION; + // can be s, q or nothing + if (cln_order(p,s,q)) + return POINT_S; + if (cln_order(p,q,s)) + return POINT_Q; + return NO_INTERSECTION; + } + else + { + if(pi==si) + { + if (qi==ri || cpl_orient(p, q, r)!=COPLANAR) return NO_INTERSECTION; + // can be r, q or nothing + if (cln_order(p,r,q)) + return POINT_R; + if (cln_order(p,q,r)) + return POINT_Q; + return NO_INTERSECTION; + } + else + { + if (qi==ri) + { + if (pi==si || cpl_orient(p, q, s)!=COPLANAR) return NO_INTERSECTION; + // can be p, s or nothing + if (cln_order(p,s,q)) + return POINT_S; + if (cln_order(q,p,s)) + return POINT_P; + return NO_INTERSECTION; + } + else + { + if (qi==si) + { + if (pi==ri || cpl_orient(p, q, r)!=COPLANAR) return NO_INTERSECTION; + // can be p, r or nothing + if (cln_order(p,r,q)) + return POINT_R; + if (cln_order(q,p,r)) + return POINT_P; + return NO_INTERSECTION; + } + } + } + } + + // supporting_line intersects: points are coplanar + ::CGAL::Orientation pqr = cpl_orient(p, q, r); + ::CGAL::Orientation pqs = cpl_orient(p, q, s); + + if(pqr == COLLINEAR && pqs == COLLINEAR) + { + // segments are collinear + bool r_in_pq = cln_order(p, r, q), + s_in_pq = cln_order(p, s, q), + p_in_rs = cln_order(r, p, s); + + if (r_in_pq) + { + // intersection could be rs, pr or qr + if (s_in_pq) + return COPLANAR_SEGMENT_RS; + if (p_in_rs) + return COPLANAR_SEGMENT_PR; + CGAL_assertion(cln_order(r, q, s)); + return COPLANAR_SEGMENT_QR; + } + else + { + if (s_in_pq) + { + // intersection could be ps or qs + if (p_in_rs) + return COPLANAR_SEGMENT_PS; + CGAL_assertion(cln_order(r, q, s)); + return COPLANAR_SEGMENT_QS; + } + else + if (p_in_rs) + { + CGAL_assertion(cln_order(r, q, s)); + return COPLANAR_SEGMENT_PQ; + } + } + return NO_INTERSECTION; + } + + if(pqr != pqs) + { + ::CGAL::Orientation rsp = cpl_orient(r, s, p); + + if (rsp==COLLINEAR) + { + if (pqr==COLLINEAR || pqs==COLLINEAR) + { + throw std::runtime_error("no expected #1"); + } + return POINT_P; + } + ::CGAL::Orientation rsq = cpl_orient(r, s, q); + if (rsq==COLLINEAR) + { + if (pqr==COLLINEAR || pqs==COLLINEAR) + { + throw std::runtime_error("no expected #2"); + } + return POINT_Q; + } + if (rsp!=rsq) + { + if (pqr==COLLINEAR) return POINT_R; + if (pqs==COLLINEAR) return POINT_S; + return POINT_INTERSECTION; + } } return NO_INTERSECTION; @@ -429,6 +617,7 @@ void generate_subtriangles(std::size_t ti, int c2=0; int c3=0; int c4=0; + int c5=0; int total=0; ~Counter() { @@ -436,6 +625,7 @@ void generate_subtriangles(std::size_t ti, std::cout << "coplanar segment intersection : " << c2 << "\n"; std::cout << "coplanar segment overlap: " << c3 << "\n"; std::cout << "no intersection: " << c4 << "\n"; + std::cout << "intersection filtered with bboxes: " << c5 << "\n"; std::cout << "# pairs of segments : " << total << "\n"; std::cout << "time computing segment intersections: " << timer1.time() << "\n"; std::cout << "time sorting intersection points: " << timer2.time() << "\n"; @@ -480,13 +670,6 @@ void generate_subtriangles(std::size_t ti, if (!segments.empty()) { std::size_t nbs = segments.size(); - //~ std::cout << "nbs " << nbs << "\n"; - - //~ if (nbs==8) - //~ { - //~ for (std::size_t i = 0; i& t) { @@ -510,20 +693,69 @@ void generate_subtriangles(std::size_t ti, return insert_res.first->second; }; - + std::vector point_boxes(points.size()); + for (std::size_t i = 0; i segment_boxes(nbs); + for (std::size_t i = 0; i(points[segments[i].first], points[segments[i].second], - points[segments[j].first], points[segments[j].second]); + do_coplanar_segments_intersect(segments[i].first, segments[i].second, + segments[j].first, segments[j].second, + points); + + + //~ Segment_inter_type_old seg_inter_type_old = + //~ do_coplanar_segments_intersect_old(points[segments[i].first], points[segments[i].second], + //~ points[segments[j].first], points[segments[j].second]); + + + //~ std::cout << std::setprecision(17); + //~ std::cout << points[segments[i].first] << " " << points[segments[i].second] << "\n"; + //~ std::cout << points[segments[j].first] << " " << points[segments[j].second] << "\n"; + //~ std::cout << "OLD: " << print_enum(seg_inter_type_old) << "\n"; + //~ std::cout << "NEW: " << print_enum(seg_inter_type) << "\n"; + switch(seg_inter_type) { + case POINT_P: + { + points_on_segments[j].push_back(segments[i].first); + break; + } + case POINT_Q: + { + points_on_segments[j].push_back(segments[i].second); + break; + } + case POINT_R: + { + points_on_segments[i].push_back(segments[j].first); + break; + } + case POINT_S: + { + points_on_segments[i].push_back(segments[j].second); + break; + } case POINT_INTERSECTION: { + // TODO: use version with no variant auto res = CGAL::intersection(supporting_plane(triangles[in_triangle_ids[i]]), supporting_plane(triangles[in_triangle_ids[j]]), supporting_plane(triangles[ti])); @@ -534,101 +766,78 @@ void generate_subtriangles(std::size_t ti, std::size_t pid = get_point_id(*pt_ptr); points_on_segments[i].push_back(pid); points_on_segments[j].push_back(pid); - break; - //~ std::cout << "new inter " << *pt_ptr << " (" << depth(points_on_segments[i].back()) << ")" << "\n"; - - } - } - // break; No break because of the coplanar case - case COPLANAR_SEGMENTS: - { - // We can have hard cases if two triangles are coplanar.... - - //~ std::cout << "coplanar inter: " << i << " " << j << "\n"; - - typename EK::Segment_3 s1(points[segments[i].first], points[segments[i].second]); - typename EK::Segment_3 s2(points[segments[j].first], points[segments[j].second]);// TODO: avoid this construction - auto inter = CGAL::intersection(s1, s2); - - if (inter == boost::none) throw std::runtime_error("Unexpected case #2"); - - if (const typename EK::Point_3* pt_ptr = boost::get(&(*inter))) - { - COUNTER_INSTRUCTION(++counter.c2;) - std::size_t pid = get_point_id(*pt_ptr); - points_on_segments[i].push_back(pid); - points_on_segments[j].push_back(pid); - break; - //~ std::cout << "new inter bis " << *pt_ptr << " (" << depth(points_on_segments[i].back()) << ")" << "\n"; } else { - if (const typename EK::Segment_3* seg_ptr = boost::get(&(*inter))) + COUNTER_INSTRUCTION(++counter.c2;) + //TODO find better! + typename EK::Segment_3 s1(points[segments[i].first], points[segments[i].second]); + typename EK::Segment_3 s2(points[segments[j].first], points[segments[j].second]);// TODO: avoid this construction + auto inter = CGAL::intersection(s1, s2); + if (inter == boost::none) throw std::runtime_error("Unexpected case #2"); + if (const typename EK::Point_3* pt_ptr = boost::get(&(*inter))) { - //TODO HERE WE SHOULD IMPROVE TO AVOID RECOMPUTING SEGMENTS ENDPOINTS - COUNTER_INSTRUCTION(++counter.c3;) - std::size_t src_pid = get_point_id(seg_ptr->source()); - std::size_t tgt_pid = get_point_id(seg_ptr->target()); - points_on_segments[i].push_back(src_pid); - points_on_segments[j].push_back(src_pid); - points_on_segments[i].push_back(tgt_pid); - points_on_segments[j].push_back(tgt_pid); + std::size_t pid = get_point_id(*pt_ptr); + points_on_segments[i].push_back(pid); + points_on_segments[j].push_back(pid); break; - //~ std::cout << "new inter seg " << *seg_ptr << " (" << depth(*seg_ptr) << ")" << "\n"; } else - throw std::runtime_error("BOOM\n"); + throw std::runtime_error("Unexpected case 1"); + //~ std::ofstream debug ("/tmp/triangles.polylines.txt"); + //~ debug << "4 " << triangles[ti][0] << " " << triangles[ti][1] << " " << triangles[ti][2] << " " << triangles[ti][0] << "\n"; + //~ debug << "4 " << triangles[in_triangle_ids[i]][0] << " " << triangles[in_triangle_ids[i]][1] << " " << triangles[in_triangle_ids[i]][2] << " " << triangles[in_triangle_ids[i]][0] << "\n"; + //~ debug << "4 " << triangles[in_triangle_ids[j]][0] << " " << triangles[in_triangle_ids[j]][1] << " " << triangles[in_triangle_ids[j]][2] << " " << triangles[in_triangle_ids[j]][0] << "\n"; + //~ debug.close(); + //~ throw std::runtime_error("Unexpected case 1"); } - -#if 0 - //this code works if triangles are not coplanar - // coplanar intersection that is not a point - int coord = 0; - const typename EK::Segment_3& s = segments[i]; - typename EK::Point_3 src = s[0], tgt=s[1]; - if (src.x()==tgt.x()) - { - coord=1; - if (src.y()==tgt.y()) - coord==2; - } - - std::vector tmp_pts = { - src, tgt, segments[j][0], segments[j][1] }; - - std::sort(tmp_pts.begin(), tmp_pts.end(), - [coord](const typename EK::Point_3& p, const typename EK::Point_3& q) - {return p[coord](points_on_segments[i].begin(), points_on_segments[i].end()).size()!= points_on_segments[i].size()) + { + std::cout << "coord = " << coord << "\n"; + std::cout << "(src.x()==tgt.x()) " << (src.x()==tgt.x()) << "\n"; + std::cout << "(src.y()==tgt.y()) " << (src.y()==tgt.y()) << "\n"; + std::cout << "(src.z()==tgt.z()) " << (src.z()==tgt.z()) << "\n"; + + for (auto v : points_on_segments[i]) + std::cout << " " << v; + std::cout << std::endl; + for (auto v : points_on_segments[i]) + std::cout << points[v] << "\n"; + std::cout << std::endl; + throw std::runtime_error("unique failed!"); + } + + nb_new_segments+=points_on_segments[i].size()-2; //~ { @@ -721,6 +948,24 @@ void generate_subtriangles(std::size_t ti, //~ std::cout << "done\n"; #endif + // TODO: sorted pair to be constructed when pushing_back + for (std::pair& s : segments) + if (s.second < s.first) + std::swap(s.first,s.second); + std::sort(segments.begin(), segments.end()); + auto last = std::unique(segments.begin(), segments.end()); + segments.erase(last, segments.end()); + + + std::ofstream("/tmp/tri.xyz") << std::setprecision(17) << triangles[ti][0] << "\n" + << triangles[ti][1] << "\n" + << triangles[ti][2] << "\n"; + std::ofstream debug("/tmp/cst.polylines.txt"); + debug << std::setprecision(17); + for(auto s : segments) + debug << "2 " << points[s.first] << " " << points[s.second] << "\n"; + debug.close(); + COUNTER_INSTRUCTION(counter.timer3.start();) cdt.insert_constraints(points.begin(), points.end(), segments.begin(), segments.end()); COUNTER_INSTRUCTION(counter.timer3.stop();) From 48c49add1cd8100ed08cbff3a97f11de244f3fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 15 Mar 2023 15:48:44 +0100 Subject: [PATCH 041/139] more debug and enum fix --- .../Polygon_mesh_processing/autorefinement.h | 41 ++++++++----------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 711c3d82ce0..8cc1dd7ff9f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -154,7 +154,7 @@ do_coplanar_segments_intersect(std::size_t pi, std::size_t qi, // first handle case of shared endpoints if (pi==ri) { - if (si==qi || cpl_orient(p, q, s)!=COPLANAR) return NO_INTERSECTION; + if (si==qi || cpl_orient(p, q, s)!=COLLINEAR) return NO_INTERSECTION; // can be s, q or nothing if (cln_order(p,s,q)) return POINT_S; @@ -166,7 +166,7 @@ do_coplanar_segments_intersect(std::size_t pi, std::size_t qi, { if(pi==si) { - if (qi==ri || cpl_orient(p, q, r)!=COPLANAR) return NO_INTERSECTION; + if (qi==ri || cpl_orient(p, q, r)!=COLLINEAR) return NO_INTERSECTION; // can be r, q or nothing if (cln_order(p,r,q)) return POINT_R; @@ -178,7 +178,7 @@ do_coplanar_segments_intersect(std::size_t pi, std::size_t qi, { if (qi==ri) { - if (pi==si || cpl_orient(p, q, s)!=COPLANAR) return NO_INTERSECTION; + if (pi==si || cpl_orient(p, q, s)!=COLLINEAR) return NO_INTERSECTION; // can be p, s or nothing if (cln_order(p,s,q)) return POINT_S; @@ -190,7 +190,7 @@ do_coplanar_segments_intersect(std::size_t pi, std::size_t qi, { if (qi==si) { - if (pi==ri || cpl_orient(p, q, r)!=COPLANAR) return NO_INTERSECTION; + if (pi==ri || cpl_orient(p, q, r)!=COLLINEAR) return NO_INTERSECTION; // can be p, r or nothing if (cln_order(p,r,q)) return POINT_R; @@ -577,7 +577,7 @@ void generate_subtriangles(std::size_t ti, #endif typedef CGAL::Constrained_Delaunay_triangulation_2 CDT_2; - //typedef CGAL::Constrained_triangulation_plus_2 CDT; + //typedef CGAL::Constrained_triangulation_plus_2 CDT; typedef CDT_2 CDT; const std::array& t = triangles[ti]; @@ -630,8 +630,11 @@ void generate_subtriangles(std::size_t ti, std::cout << "time computing segment intersections: " << timer1.time() << "\n"; std::cout << "time sorting intersection points: " << timer2.time() << "\n"; std::cout << "time for cdt of constraints: " << timer3.time() << "\n"; + std::cout << "time coplanar segment intersections: " << timer4.time() << "\n"; + std::cout << "time of do_coplanar_segments_intersect: " << timer5.time() << "\n"; + std::cout << "time of triplane intersection: " << timer6.time() << "\n"; } - CGAL::Real_timer timer1, timer2, timer3; + CGAL::Real_timer timer1, timer2, timer3, timer4, timer5, timer6; }; static Counter counter; @@ -713,11 +716,12 @@ void generate_subtriangles(std::size_t ti, continue; } - // TODO: use point ids to skip some test? + COUNTER_INSTRUCTION(counter.timer5.start();) Segment_inter_type seg_inter_type = do_coplanar_segments_intersect(segments[i].first, segments[i].second, segments[j].first, segments[j].second, points); + COUNTER_INSTRUCTION(counter.timer5.stop();) //~ Segment_inter_type_old seg_inter_type_old = @@ -756,9 +760,11 @@ void generate_subtriangles(std::size_t ti, case POINT_INTERSECTION: { // TODO: use version with no variant + COUNTER_INSTRUCTION(counter.timer6.start();) auto res = CGAL::intersection(supporting_plane(triangles[in_triangle_ids[i]]), supporting_plane(triangles[in_triangle_ids[j]]), supporting_plane(triangles[ti])); + COUNTER_INSTRUCTION(counter.timer6.stop();) if (const typename EK::Point_3* pt_ptr = boost::get(&(*res))) { @@ -770,6 +776,7 @@ void generate_subtriangles(std::size_t ti, else { COUNTER_INSTRUCTION(++counter.c2;) + COUNTER_INSTRUCTION(counter.timer4.start();) //TODO find better! typename EK::Segment_3 s1(points[segments[i].first], points[segments[i].second]); typename EK::Segment_3 s2(points[segments[j].first], points[segments[j].second]);// TODO: avoid this construction @@ -784,6 +791,7 @@ void generate_subtriangles(std::size_t ti, } else throw std::runtime_error("Unexpected case 1"); + COUNTER_INSTRUCTION(counter.timer4.stop();) //~ std::ofstream debug ("/tmp/triangles.polylines.txt"); //~ debug << "4 " << triangles[ti][0] << " " << triangles[ti][1] << " " << triangles[ti][2] << " " << triangles[ti][0] << "\n"; //~ debug << "4 " << triangles[in_triangle_ids[i]][0] << " " << triangles[in_triangle_ids[i]][1] << " " << triangles[in_triangle_ids[i]][2] << " " << triangles[in_triangle_ids[i]][0] << "\n"; @@ -877,24 +885,6 @@ void generate_subtriangles(std::size_t ti, points_on_segments[i].push_back(tgt_id); auto last = std::unique(points_on_segments[i].begin(), points_on_segments[i].end()); points_on_segments[i].erase(last, points_on_segments[i].end()); - - if (std::set(points_on_segments[i].begin(), points_on_segments[i].end()).size()!= points_on_segments[i].size()) - { - std::cout << "coord = " << coord << "\n"; - std::cout << "(src.x()==tgt.x()) " << (src.x()==tgt.x()) << "\n"; - std::cout << "(src.y()==tgt.y()) " << (src.y()==tgt.y()) << "\n"; - std::cout << "(src.z()==tgt.z()) " << (src.z()==tgt.z()) << "\n"; - - for (auto v : points_on_segments[i]) - std::cout << " " << v; - std::cout << std::endl; - for (auto v : points_on_segments[i]) - std::cout << points[v] << "\n"; - std::cout << std::endl; - throw std::runtime_error("unique failed!"); - } - - nb_new_segments+=points_on_segments[i].size()-2; //~ { @@ -1240,6 +1230,7 @@ void autorefine_soup_output(const PointRange& input_points, ); } } + // import refined triangles for (const std::array& t : new_triangles) { From ebb051f0b6e5bd89b17e4eb48f5c0cfdd2b6f1fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 16 Mar 2023 10:26:06 +0100 Subject: [PATCH 042/139] remove debug --- .../Polygon_mesh_processing/autorefinement.h | 96 ++----------------- 1 file changed, 10 insertions(+), 86 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 8cc1dd7ff9f..f6b7bac57bb 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -36,9 +36,9 @@ #include -//#define TEST_RESOLVE_INTERSECTION +#define TEST_RESOLVE_INTERSECTION #define DEDUPLICATE_SEGMENTS -//#define DEBUG_COUNTERS +#define DEBUG_COUNTERS //#define USE_FIXED_PROJECTION_TRAITS //#define DEBUG_DEPTH @@ -56,8 +56,6 @@ namespace Polygon_mesh_processing { #ifndef DOXYGEN_RUNNING namespace autorefine_impl { - -enum Segment_inter_type_old { NO_INTERSECTION_OLD=0, COPLANAR_SEGMENTS, POINT_INTERSECTION_OLD }; enum Segment_inter_type { NO_INTERSECTION=0, POINT_INTERSECTION, POINT_P, @@ -72,68 +70,6 @@ enum Segment_inter_type { NO_INTERSECTION=0, COPLANAR_SEGMENT_QR, }; - - -std::string print_enum(Segment_inter_type_old s) -{ - switch(s) - { - case NO_INTERSECTION_OLD: return "NO_INTERSECTION_OLD"; - case COPLANAR_SEGMENTS: return "COPLANAR_SEGMENTS"; - case POINT_INTERSECTION_OLD: return "POINT_INTERSECTION_OLD"; - } -} - -std::string print_enum(Segment_inter_type s) -{ - switch(s) - { - case NO_INTERSECTION: return "NO_INTERSECTION"; - case POINT_INTERSECTION: return "POINT_INTERSECTION"; - case POINT_P: return "POINT_P"; - case POINT_Q: return "POINT_Q"; - case POINT_R: return "POINT_R"; - case POINT_S: return "POINT_S"; - case COPLANAR_SEGMENT_PQ: return "COPLANAR_SEGMENT_PQ"; - case COPLANAR_SEGMENT_RS: return "COPLANAR_SEGMENT_RS"; - case COPLANAR_SEGMENT_PS: return "COPLANAR_SEGMENT_PS"; - case COPLANAR_SEGMENT_QS: return "COPLANAR_SEGMENT_QS"; - case COPLANAR_SEGMENT_PR: return "COPLANAR_SEGMENT_PR"; - case COPLANAR_SEGMENT_QR: return "COPLANAR_SEGMENT_QR"; - } -} - - -template -Segment_inter_type_old -do_coplanar_segments_intersect_old(const typename K::Point_3& s1_0, const typename K::Point_3& s1_1, - const typename K::Point_3& s2_0, const typename K::Point_3& s2_1, - const K& k = K()) -{ - // supporting_line intersects: points are coplanar - typename K::Coplanar_orientation_3 cpl_orient=k.coplanar_orientation_3_object(); - ::CGAL::Orientation or1 = cpl_orient(s1_0, s1_1, s2_0); - ::CGAL::Orientation or2 = cpl_orient(s1_0, s1_1, s2_1); - - if(or1 == COLLINEAR && or2 == COLLINEAR) - { - // segments are collinear - typename K::Collinear_are_ordered_along_line_3 cln_order = k.collinear_are_ordered_along_line_3_object(); - return (cln_order(s1_0, s2_0, s1_1) || - cln_order(s1_0, s2_1, s1_1) || - cln_order(s2_0, s1_0, s2_1)) ? COPLANAR_SEGMENTS : NO_INTERSECTION_OLD; - } - - if(or1 != or2) - { - or1 = cpl_orient(s2_0, s2_1, s1_0); - return (or1 == COLLINEAR || or1 != cpl_orient(s2_0, s2_1, s1_1)) ? POINT_INTERSECTION_OLD : NO_INTERSECTION_OLD; - } - - return NO_INTERSECTION_OLD; -} - - // test intersection in the interior of segment pq and rs with pq and rs being coplanar segments // note that for coplanar cases, we might report identical endpoints template @@ -723,18 +659,6 @@ void generate_subtriangles(std::size_t ti, points); COUNTER_INSTRUCTION(counter.timer5.stop();) - - //~ Segment_inter_type_old seg_inter_type_old = - //~ do_coplanar_segments_intersect_old(points[segments[i].first], points[segments[i].second], - //~ points[segments[j].first], points[segments[j].second]); - - - //~ std::cout << std::setprecision(17); - //~ std::cout << points[segments[i].first] << " " << points[segments[i].second] << "\n"; - //~ std::cout << points[segments[j].first] << " " << points[segments[j].second] << "\n"; - //~ std::cout << "OLD: " << print_enum(seg_inter_type_old) << "\n"; - //~ std::cout << "NEW: " << print_enum(seg_inter_type) << "\n"; - switch(seg_inter_type) { case POINT_P: @@ -947,14 +871,14 @@ void generate_subtriangles(std::size_t ti, segments.erase(last, segments.end()); - std::ofstream("/tmp/tri.xyz") << std::setprecision(17) << triangles[ti][0] << "\n" - << triangles[ti][1] << "\n" - << triangles[ti][2] << "\n"; - std::ofstream debug("/tmp/cst.polylines.txt"); - debug << std::setprecision(17); - for(auto s : segments) - debug << "2 " << points[s.first] << " " << points[s.second] << "\n"; - debug.close(); + //~ std::ofstream("/tmp/tri.xyz") << std::setprecision(17) << triangles[ti][0] << "\n" + //~ << triangles[ti][1] << "\n" + //~ << triangles[ti][2] << "\n"; + //~ std::ofstream debug("/tmp/cst.polylines.txt"); + //~ debug << std::setprecision(17); + //~ for(auto s : segments) + //~ debug << "2 " << points[s.first] << " " << points[s.second] << "\n"; + //~ debug.close(); COUNTER_INSTRUCTION(counter.timer3.start();) cdt.insert_constraints(points.begin(), points.end(), segments.begin(), segments.end()); From b31dc68889c704f0120e6286fb3bbbacdf19da48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 16 Mar 2023 10:28:24 +0100 Subject: [PATCH 043/139] add another option coplanar orientation --- .../Polygon_mesh_processing/autorefinement.h | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index f6b7bac57bb..7432f1f7d35 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -38,7 +38,7 @@ #define TEST_RESOLVE_INTERSECTION #define DEDUPLICATE_SEGMENTS -#define DEBUG_COUNTERS +//#define DEBUG_COUNTERS //#define USE_FIXED_PROJECTION_TRAITS //#define DEBUG_DEPTH @@ -77,10 +77,20 @@ Segment_inter_type do_coplanar_segments_intersect(std::size_t pi, std::size_t qi, std::size_t ri, std::size_t si, const std::vector& points, + const typename K::Vector_3& plane_normal, const K& k = K()) { typename K::Collinear_are_ordered_along_line_3 cln_order = k.collinear_are_ordered_along_line_3_object(); +#ifdef USE_PROJECTED_ORIENTATION_2_FOR_COPLANAR_ORIENTATION_TESTS + auto cpl_orient = + [&plane_normal](const typename K::Point_3& p, const typename K::Point_3& q, const typename K::Point_3& r) + { + return ::CGAL::orientation(q-p, r-p, plane_normal); + }; +#else typename K::Coplanar_orientation_3 cpl_orient=k.coplanar_orientation_3_object(); + CGAL_USE(plane_normal); +#endif const typename K::Point_3& p=points[pi]; const typename K::Point_3& q=points[qi]; @@ -638,7 +648,7 @@ void generate_subtriangles(std::size_t ti, std::vector segment_boxes(nbs); for (std::size_t i = 0; i(segments[i].first, segments[i].second, segments[j].first, segments[j].second, - points); + points, n); COUNTER_INSTRUCTION(counter.timer5.stop();) switch(seg_inter_type) @@ -767,9 +777,10 @@ void generate_subtriangles(std::size_t ti, points_on_segments[j].push_back(segments[i].second); break; } -// break; case NO_INTERSECTION: + { COUNTER_INSTRUCTION(++counter.c4;) + } } } COUNTER_INSTRUCTION(++counter.total;) @@ -859,7 +870,6 @@ void generate_subtriangles(std::size_t ti, } } } - //~ std::cout << "done\n"; #endif // TODO: sorted pair to be constructed when pushing_back From 38a92ead67a2b471b68ecfc23367b72b710739ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 16 Mar 2023 14:59:08 +0100 Subject: [PATCH 044/139] make the message clearer --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 7432f1f7d35..a54e4d29971 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -36,7 +36,7 @@ #include -#define TEST_RESOLVE_INTERSECTION +//#define TEST_RESOLVE_INTERSECTION #define DEDUPLICATE_SEGMENTS //#define DEBUG_COUNTERS //#define USE_FIXED_PROJECTION_TRAITS @@ -1178,7 +1178,7 @@ void autorefine_soup_output(const PointRange& input_points, #ifdef CGAL_DEBUG_PMP_AUTOREFINE CGAL_PMP_AUTOREFINE_VERBOSE("check soup"); if (does_triangle_soup_self_intersect(exact_soup_points, soup_triangles)) - throw std::runtime_error("invalid output"); + throw std::runtime_error("ERROR: invalid output, there is most probably a bug"); #endif #endif CGAL_PMP_AUTOREFINE_VERBOSE("done"); From 6139fc4119b0c80bd6285e4c1cf1c7c269b85721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 16 Mar 2023 19:10:05 +0100 Subject: [PATCH 045/139] insert points even if no constraints --- .../Polygon_mesh_processing/autorefinement.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index a54e4d29971..734a47fcf56 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -465,7 +465,6 @@ void collect_intersections(const std::array& t1, { int j=(i+1)%3; test_edge(t1[i], t1[j], t2[0], t2[1], t2[2], ori[i], ori[j], inter_pts); - //~ if (inter_pts.size()>1) return; } // test edges of t2 vs t1 @@ -475,7 +474,6 @@ void collect_intersections(const std::array& t1, { int j=(i+1)%3; test_edge(t2[i], t2[j], t1[0], t1[1], t1[2], ori[i], ori[j], inter_pts); - //~ if (inter_pts.size()>1) return; } // because we don't handle intersection type and can have edge-edge edge-vertex duplicates @@ -483,9 +481,10 @@ void collect_intersections(const std::array& t1, auto last = std::unique(inter_pts.begin(), inter_pts.end()); inter_pts.erase(last, inter_pts.end()); - +#ifdef DEBUG_DEPTH for (auto p : inter_pts) if (depth(p)>2) throw std::runtime_error("Depth is not 2: "+std::to_string(depth(p))); +#endif } ////////////////////////////////// @@ -507,8 +506,8 @@ void generate_subtriangles(std::size_t ti, const std::vector>& triangles, std::vector>& new_triangles) { - //~ std::cout << "generate_subtriangles()\n"; - std::cout << std::setprecision(17); + // std::cout << "generate_subtriangles()\n"; + // std::cout << std::setprecision(17); #ifdef USE_FIXED_PROJECTION_TRAITS typedef ::CGAL::internal::Projection_traits_3 P_traits; @@ -870,16 +869,16 @@ void generate_subtriangles(std::size_t ti, } } } -#endif // TODO: sorted pair to be constructed when pushing_back + // TODO: only needed in case of coplanar segments? for (std::pair& s : segments) if (s.second < s.first) std::swap(s.first,s.second); std::sort(segments.begin(), segments.end()); auto last = std::unique(segments.begin(), segments.end()); segments.erase(last, segments.end()); - +#endif //~ std::ofstream("/tmp/tri.xyz") << std::setprecision(17) << triangles[ti][0] << "\n" //~ << triangles[ti][1] << "\n" @@ -891,7 +890,10 @@ void generate_subtriangles(std::size_t ti, //~ debug.close(); COUNTER_INSTRUCTION(counter.timer3.start();) - cdt.insert_constraints(points.begin(), points.end(), segments.begin(), segments.end()); + if (segments.empty()) + cdt.insert(points.begin(), points.end()); + else + cdt.insert_constraints(points.begin(), points.end(), segments.begin(), segments.end()); COUNTER_INSTRUCTION(counter.timer3.stop();) #ifdef CGAL_DEBUG_PMP_AUTOREFINE_DUMP_TRIANGULATIONS From 85b3f7ed5732f203905086d630b7e35c521e7c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 27 Mar 2023 17:52:09 +0200 Subject: [PATCH 046/139] working around non-triangular polygons --- .../Polygon_mesh_processing/soup_autorefinement.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp index 9ade96e3be8..a46fc6e711c 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp @@ -7,6 +7,8 @@ #include #include +#include + #include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; @@ -22,10 +24,13 @@ int main(int argc, char** argv) : std::string(argv[1]); std::vector input_points; - std::vector> input_triangles; + std::vector> input_triangles; CGAL::IO::read_polygon_soup(filename, input_points, input_triangles); PMP::repair_polygon_soup(input_points, input_triangles); + for (const auto& c : input_triangles) + if (c.size()!=3) return 0; // skipt for now + std::vector output_points; std::vector> output_triangles; PMP::autorefine_soup_output(input_points, input_triangles, output_points, output_triangles); From b06ed794e6e7ffa1f3112ec16ba556128be2ba79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 27 Mar 2023 17:53:36 +0200 Subject: [PATCH 047/139] add more debug --- .../Polygon_mesh_processing/autorefinement.h | 159 +++++++++++++++++- 1 file changed, 155 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 734a47fcf56..7cd083e8338 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -36,7 +36,7 @@ #include -//#define TEST_RESOLVE_INTERSECTION +#define TEST_RESOLVE_INTERSECTION #define DEDUPLICATE_SEGMENTS //#define DEBUG_COUNTERS //#define USE_FIXED_PROJECTION_TRAITS @@ -227,6 +227,69 @@ do_coplanar_segments_intersect(std::size_t pi, std::size_t qi, ////////////////////////////////// ////////////////////////////////// +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION +template +void old_intersection_coplanar_triangles_cutoff(const typename Kernel::Point_3& p, + const typename Kernel::Point_3& q, + const typename Kernel::Point_3& r, + const Kernel& k, + std::list& inter_pts) +{ + typedef typename std::list::iterator Iterator; + + if(inter_pts.empty()) + return; + + typename Kernel::Coplanar_orientation_3 orient = k.coplanar_orientation_3_object(); + typename Kernel::Construct_line_3 line = k.construct_line_3_object(); + + //orient(p,q,r,r) is POSITIVE + std::map orientations; + for (Iterator it=inter_pts.begin();it!=inter_pts.end();++it) + orientations[ &(*it) ]=orient(p,q,r,*it); + + CGAL_kernel_assertion_code(int pt_added = 0;) + + const typename Kernel::Point_3* prev = &(*boost::prior(inter_pts.end())); + Iterator stop = inter_pts.size() > 2 ? inter_pts.end() : boost::prior(inter_pts.end()); + for(Iterator it=inter_pts.begin(); it!=stop; ++it) + { + const typename Kernel::Point_3& curr = *it; + Orientation or_prev = orientations[prev], + or_curr = orientations[&curr]; + + if((or_prev == POSITIVE && or_curr == NEGATIVE) || + (or_prev == NEGATIVE && or_curr == POSITIVE)) + { + typename Intersection_traits::result_type + obj = ::CGAL::Intersections::internal::intersection(line(p,q), line(*prev,curr), k); + + // assert "not empty" + CGAL_kernel_assertion(bool(obj)); + + const typename Kernel::Point_3* inter = ::CGAL::Intersections::internal::intersect_get(obj); + CGAL_kernel_assertion(inter != nullptr); + + prev = &(*inter_pts.insert(it,*inter)); + orientations[prev] = COLLINEAR; + CGAL_kernel_assertion_code(++pt_added;) + } + + prev = &(*it); + } + + CGAL_kernel_assertion(pt_added<3); + Iterator it = inter_pts.begin(); + while(it!=inter_pts.end()) + { + if(orientations[&(*it)] == NEGATIVE) + inter_pts.erase(it++); + else + ++it; + } +} +#endif + // imported from Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h template void coplanar_intersections(const std::array& t1, @@ -242,6 +305,19 @@ void coplanar_intersections(const std::array& t1, l_inter_pts.push_back(Intersections::internal::Point_on_triangle(-1,2)); #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::list old_l_inter_pts; + old_l_inter_pts.push_back(p2); + old_l_inter_pts.push_back(q2); + old_l_inter_pts.push_back(r2); + + + auto enum_to_string = [](CGAL::Orientation o) + { + if (o==COLLINEAR) return std::string("COLLINEAR"); + if (o==POSITIVE) return std::string("POSITIVE"); + return std::string("NEGATIVE"); + }; + auto to_string = [](const auto& t) { std::stringstream sstr; @@ -256,6 +332,32 @@ void coplanar_intersections(const std::array& t1, std::cout << "intersection_coplanar_triangles\n"; std::ofstream("/tmp/t1.polylines.txt") << to_string(t1) << "\n"; std::ofstream("/tmp/t2.polylines.txt") << to_string(t2) << "\n"; + + std::cout << "Position of vertices of t1: "; + std::cout << enum_to_string( coplanar_orientation(p2,q2,r2,p1)) << " - "; + std::cout << enum_to_string( coplanar_orientation(p2,q2,r2,q1)) << " - "; + std::cout << enum_to_string( coplanar_orientation(p2,q2,r2,r1)) << "\n"; + std::cout << " "; + std::cout << enum_to_string( coplanar_orientation(q2,r2,p2,p1)) << " - "; + std::cout << enum_to_string( coplanar_orientation(q2,r2,p2,q1)) << " - "; + std::cout << enum_to_string( coplanar_orientation(q2,r2,p2,r1)) << "\n"; + std::cout << " "; + std::cout << enum_to_string( coplanar_orientation(r2,p2,q2,p1)) << " - "; + std::cout << enum_to_string( coplanar_orientation(r2,p2,q2,q1)) << " - "; + std::cout << enum_to_string( coplanar_orientation(r2,p2,q2,r1)) << "\n"; + std::cout << "Position of vertices of t2: "; + std::cout << enum_to_string( coplanar_orientation(p1,q1,r1,p2)) << " - "; + std::cout << enum_to_string( coplanar_orientation(p1,q1,r1,q2)) << " - "; + std::cout << enum_to_string( coplanar_orientation(p1,q1,r1,r2)) << "\n"; + std::cout << " "; + std::cout << enum_to_string( coplanar_orientation(q1,r1,p1,p2)) << " - "; + std::cout << enum_to_string( coplanar_orientation(q1,r1,p1,q2)) << " - "; + std::cout << enum_to_string( coplanar_orientation(q1,r1,p1,r2)) << "\n"; + std::cout << " "; + std::cout << enum_to_string( coplanar_orientation(r1,p1,q1,p2)) << " - "; + std::cout << enum_to_string( coplanar_orientation(r1,p1,q1,q2)) << " - "; + std::cout << enum_to_string( coplanar_orientation(r1,p1,q1,r2)) << "\n"; + auto print_points = [&]() { for(auto p : l_inter_pts) std::cout << " (" << p.id1() << "," << p.id2() << ",[" << p.alpha << "]) "; std::cout <<"\n"; @@ -270,31 +372,76 @@ void coplanar_intersections(const std::array& t1, #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION std::cout << " ipts size: " << l_inter_pts.size() << "\n"; print_points(); + old_intersection_coplanar_triangles_cutoff(p1,q1,r1,k,old_l_inter_pts); + CGAL_assertion(l_inter_pts.size()==old_l_inter_pts.size()); + for (std::size_t i=0; ipoint(p1,q1,r1,p2,q2,r2,k)) + { + std::cout <<"ERROR with point #" << i << "\n"; + throw std::runtime_error("invalid output 0"); + } + } #endif intersection_coplanar_triangles_cutoff(q1,r1,p1,1,p2,q2,r2,k,l_inter_pts); //line q1r1 #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION std::cout << " ipts size: " << l_inter_pts.size() << "\n"; print_points(); + old_intersection_coplanar_triangles_cutoff(q1,r1,p1,k,old_l_inter_pts); + CGAL_assertion(l_inter_pts.size()==old_l_inter_pts.size()); + for (std::size_t i=0; ipoint(p1,q1,r1,p2,q2,r2,k)) + { + std::cout <<"ERROR with point #" << i << "\n"; + throw std::runtime_error("invalid output 1"); + } + } #endif intersection_coplanar_triangles_cutoff(r1,p1,q1,2,p2,q2,r2,k,l_inter_pts); //line r1p1 #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION std::cout << " ipts size: " << l_inter_pts.size() << "\n"; print_points(); + old_intersection_coplanar_triangles_cutoff(r1,p1,q1,k,old_l_inter_pts); + CGAL_assertion(l_inter_pts.size()==old_l_inter_pts.size()); + for (std::size_t i=0; ipoint(p1,q1,r1,p2,q2,r2,k)) + { + std::cout <<"ERROR with point #" << i << "\n"; + throw std::runtime_error("invalid output 2"); + } + } +#endif + +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::size_t start=inter_pts.size(); #endif for (const Intersections::internal::Point_on_triangle& pot : l_inter_pts) inter_pts.push_back( pot.point(p1,q1,r1,p2,q2,r2,k) ); #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + for (std::size_t i=0; i> i; + // std::cout <<"check!\n"; + // int i; + // std::cin >> i; #endif } @@ -1022,6 +1169,10 @@ void autorefine_soup_output(const PointRange& input_points, std::vector inter_pts; autorefine_impl::collect_intersections(t1, t2, inter_pts); + CGAL_assertion( + CGAL::do_intersect(typename EK::Triangle_3(t1[0], t1[1], t1[2]), typename EK::Triangle_3(t2[0], t2[1], t2[2])) + != inter_pts.empty()); + if (!inter_pts.empty()) { std::size_t nbi = inter_pts.size(); From bd967e7cec9885afb9cee799ae6b39a16abfa609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 27 Mar 2023 17:53:50 +0200 Subject: [PATCH 048/139] avoid duplicated tangency point --- .../Polygon_mesh_processing/autorefinement.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 7cd083e8338..c90ba515271 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -778,7 +778,13 @@ void generate_subtriangles(std::size_t ti, std::map point_id_map; for (std::size_t pid=0; pid(points.begin(), points.end()).size()); + CGAL_assertion(points.size()==point_id_map.size()); } // TODO: sorted pair to be constructed when pushing_back @@ -1217,6 +1226,14 @@ void autorefine_soup_output(const PointRange& input_points, return insert_res.first->second; }; + if (!all_points[ti].empty()) + { + std::vector tmp; + tmp.swap(all_points[ti]); + for (const typename EK::Point_3& pt : tmp) + get_point_id(pt); + } + std::size_t nbs = all_segments[ti].size(); std::vector> filtered_segments; std::vector filtered_in_triangle_ids; From 2b74b8f10d561a335e159857e14f109a92aeed50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 28 Mar 2023 14:35:40 +0200 Subject: [PATCH 049/139] fix some bugs --- .../Triangle_3_Triangle_3_intersection.h | 98 ++++++++++++++----- 1 file changed, 76 insertions(+), 22 deletions(-) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h index ac376f44350..35aa4f8f0a5 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -86,6 +87,7 @@ struct Point_on_triangle // (-1, id) point on t2 // (id1, id2) intersection of edges std::pair t1_t2_ids; + boost::container::flat_set extra_t1; typename Kernel::FT alpha; Orientation @@ -161,7 +163,7 @@ intersection(const Point_on_triangle& p, #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION std::cout << " calling intersection: "; std::cout << " (" << p.id1() << "," << p.id2() << ",[" << p.alpha << "]) -"; - std::cout << " (" << q.id1() << "," << q.id2() << ",[" << q.alpha << "]) || e" << edge_id_t1 << "\n"; + std::cout << " (" << q.id1() << "," << q.id2() << ",[" << q.alpha << "]) || e" << edge_id_t1; #endif typedef Point_on_triangle Pot; switch(p.id1()) @@ -172,17 +174,26 @@ intersection(const Point_on_triangle& p, { case -1: // (-1, ip2) - (-1, iq2) { + CGAL_assertion((p.id2()+1)%3 == q.id2() || (q.id2()+1)%3 == p.id2()); +// CGAL_assertion(p.extra_t1.empty() && q.extra_t1.empty()); // TMP to see if it's worth implementing special case +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " -- case 1\n"; +#endif typename Kernel::FT alpha = coplanar_segment_segment_alpha_intersection(p1, q1, Pot::point_from_id(p2, q2, r2, p.id2()), Pot::point_from_id(p2, q2, r2, q.id2()), k); - return Point_on_triangle(edge_id_t1, p.id2(), alpha); // intersection with an original edge of t2 + int id2 = (p.id2()+1)%3 == q.id2() ? p.id2() : q.id2(); + return Point_on_triangle(edge_id_t1, id2, alpha); // intersection with an original edge of t2 } default: if (q.id2()!=-1) // (-1, ip2) - (iq1, iq2) { if (p.id2() == q.id2() || p.id2() == (q.id2()+1)%3) { +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " -- case 2\n"; +#endif // points are on the same edge of t2 --> we shorten an already cut edge typename Kernel::FT alpha = coplanar_segment_segment_alpha_intersection(p1, q1, @@ -191,13 +202,23 @@ intersection(const Point_on_triangle& p, return Point_on_triangle(edge_id_t1, q.id2(), alpha); } - // point of t1 - return Point_on_triangle((q.id1()+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3 , -1); +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " -- case 3\n"; +#endif + // point of t1: look for an edge of t1 containing both points + CGAL_assertion( p.extra_t1.count(q.id1())!=0 || p.extra_t1.count(3-q.id1()-edge_id_t1)!=0 ); + int eid1 = p.extra_t1.count(q.id1())!=0 ? q.id1() : 3-q.id1()-edge_id_t1; + return Point_on_triangle((eid1+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3, -1); // vertex of t1 } // (-1, ip2) - (iq1, -1) //vertex of t1, special case t1 edge passed thru a vertex of t2 CGAL_assertion(edge_id_t1 == 2); - return Point_on_triangle(2, -1); // point on t1 has to be created from the intersection of edge 0 and edge 1 +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " -- case 4\n"; +#endif + CGAL_assertion(q.id1()==1); + CGAL_assertion(!p.extra_t1.empty()); + return Point_on_triangle(p.extra_t1.count(0)==1?0:2,-1); } } default: @@ -210,13 +231,24 @@ intersection(const Point_on_triangle& p, { case -1: // (ip1, -1) - (-1, iq2) //vertex of t1, special case t1 edge passed thru a vertex of t2 - return Point_on_triangle(0, -1); +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " -- case 5\n"; +#endif + CGAL_assertion(edge_id_t1 == 2); + CGAL_assertion(p.id1()==1); + CGAL_assertion(!q.extra_t1.empty()); + return Point_on_triangle(q.extra_t1.count(0)==1?0:2,-1); default: { +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " -- case 6\n"; +#endif CGAL_assertion(q.id2()!=-1); // (ip1, -1) - (iq2, -1) //(ip1,-1), (iq1, iq2) - CGAL_assertion(edge_id_t1==2 && p.id1()==1); - return Point_on_triangle(q.id1()==1?2:0,-1); // vertex of t1 + CGAL_assertion(edge_id_t1==2); + // p and q are on the same edge of t1 + CGAL_assertion(p.id1()==q.id1() || p.id1()==(q.id1()+1)%3); + return Point_on_triangle((q.id1()+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3 , -1); } } } @@ -228,6 +260,9 @@ intersection(const Point_on_triangle& p, { if (q.id2() == p.id2() || q.id2() == (p.id2()+1)%3) { +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " -- case 7\n"; +#endif // points are on the same edge of t2 --> we shorten an already cut edge typename Kernel::FT alpha = coplanar_segment_segment_alpha_intersection(p1, q1, @@ -236,8 +271,14 @@ intersection(const Point_on_triangle& p, return Point_on_triangle(edge_id_t1, p.id2(), alpha); } +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " -- case 8\n"; +#endif // point of t1 - return Point_on_triangle((p.id1()+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3 , -1); + //std::cout << "q.extra_t1: "; for(int qet1 : q.extra_t1) std::cout << " " << qet1; std::cout << "\n"; + CGAL_assertion( q.extra_t1.count(p.id1())!=0 || q.extra_t1.count(3-p.id1()-edge_id_t1)!=0 ); + int eid1 = q.extra_t1.count(p.id1())!=0 ? p.id1() : 3-p.id1()-edge_id_t1; + return Point_on_triangle((eid1+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3, -1); // vertex of t1 } default: { @@ -245,21 +286,30 @@ intersection(const Point_on_triangle& p, { case -1: // (ip1, ip2) - (iq1, -1) { - CGAL_assertion(edge_id_t1==2 && q.id1()==1); - return Point_on_triangle(p.id1()==1?2:0); // vertex of t1 + // p and q are on the same edge of t1 + CGAL_assertion(q.id1()==p.id1() || q.id1()==(p.id1()+1)%3); +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " -- case 9\n"; +#endif + return Point_on_triangle((p.id1()+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3 , -1); } default: // (ip1, ip2) - (iq1, iq2) { - CGAL_assertion(p.id1()==q.id1() || p.id2()==q.id2() ); - - if (p.id1()==q.id1()) - return Point_on_triangle((p.id1()+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3, -1); // vertex of t1 - - typename Kernel::FT alpha = - coplanar_segment_segment_alpha_intersection(p1, q1, - Pot::point_from_id(p2, q2, r2, q.id2()), - Pot::point_from_id(p2, q2, r2, (q.id2()+1)%3), k); - return Point_on_triangle(edge_id_t1, q.id2(), alpha); + if (p.id2()==q.id2()) + { +#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION + std::cout << " -- case 10\n"; +#endif + typename Kernel::FT alpha = + coplanar_segment_segment_alpha_intersection(p1, q1, + Pot::point_from_id(p2, q2, r2, q.id2()), + Pot::point_from_id(p2, q2, r2, (q.id2()+1)%3), k); + return Point_on_triangle(edge_id_t1, q.id2(), alpha); + } + // we are intersecting an edge of t1 + CGAL_assertion(p.id1()==q.id1() || edge_id_t1==2); + int eid1 = p.id1()==q.id1() ? p.id1() : 1; + return Point_on_triangle((eid1+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3, -1); // vertex of t1 } } } @@ -293,8 +343,12 @@ void intersection_coplanar_triangles_cutoff(const typename Kernel::Point_3& p1, //orient(p1,q1,r1,r1) is POSITIVE std::map*,Orientation> orientations; // TODO skip map - for (const Point_on_triangle& pot : inter_pts) + for (Point_on_triangle& pot : inter_pts) + { orientations[ &pot ]=pot.orientation(p1,q1,r1,edge_id,p2,q2,r2,k); + if (pot.id1()==-1 && orientations[ &pot ]==COLLINEAR) + pot.extra_t1.insert(edge_id); + } #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION std::cout << " Orientations:"; From e29d52421e624a416b741e3416d75bc65ee1e101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 28 Mar 2023 16:43:35 +0200 Subject: [PATCH 050/139] fix doc --- .../Polygon_mesh_processing/autorefinement.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index c90ba515271..c7e067916d5 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1360,19 +1360,18 @@ void autorefine_soup_output(const PointRange& input_points, * refines a triangle mesh so that no triangles intersects in their interior. * * @tparam TriangleMesh a model of `HalfedgeListGraph`, `FaceListGraph`, and `MutableFaceGraph` - * @tparam NamedParameters a sequence of \ref namedparameters + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" * * @param tm input triangulated surface mesh * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below * - * \cgalParamNBegin{geom_traits} - * \cgalParamDescription{an instance of a geometric traits class} - * \cgalParamType{a class model of `PMPSelfIntersectionTraits`} - * \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} - * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} - * \cgalParamNEnd - * * \cgalNamedParamsBegin + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class} + * \cgalParamType{a class model of `PMPSelfIntersectionTraits`} + * \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} + * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} + * \cgalParamNEnd * \cgalParamNBegin{vertex_point_map} * \cgalParamDescription{a property map associating points to the vertices of `tm`} * \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits::%vertex_descriptor` @@ -1380,7 +1379,8 @@ void autorefine_soup_output(const PointRange& input_points, * \cgalParamDefault{`boost::get(CGAL::vertex_point, tm)`} * \cgalParamExtra{If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` * must be available in `TriangleMesh`.} - * \cgalParamNEnd + * \cgalParamNEnd + * \cgalNamedParamsEnd * */ template Date: Wed, 29 Mar 2023 16:38:34 +0200 Subject: [PATCH 051/139] triangulate soup --- .../examples/Polygon_mesh_processing/soup_autorefinement.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp index a46fc6e711c..d955734853b 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp @@ -27,9 +27,7 @@ int main(int argc, char** argv) std::vector> input_triangles; CGAL::IO::read_polygon_soup(filename, input_points, input_triangles); PMP::repair_polygon_soup(input_points, input_triangles); - - for (const auto& c : input_triangles) - if (c.size()!=3) return 0; // skipt for now + PMP::triangulate_polygons(input_points, input_triangles); std::vector output_points; std::vector> output_triangles; From 2a791d2625c885b96f6d12b890d6b482918b48d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 31 Mar 2023 10:24:42 +0200 Subject: [PATCH 052/139] add optional progress display --- .../CGAL/Polygon_mesh_processing/autorefinement.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index c7e067916d5..4f56b8a0d81 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -25,6 +25,10 @@ #include #include +#ifdef USE_PROGRESS_DISPLAY +#include +#endif + // output #include #include @@ -1260,6 +1264,11 @@ void autorefine_soup_output(const PointRange& input_points, CGAL_PMP_AUTOREFINE_VERBOSE("triangulate faces"); // now refine triangles std::vector> new_triangles; + +#ifdef USE_PROGRESS_DISPLAY + boost::timer::progress_display pd(triangles.size()); +#endif + for(std::size_t ti=0; ti Date: Fri, 31 Mar 2023 10:26:21 +0200 Subject: [PATCH 053/139] repair soup before orient + to mesh --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 4f56b8a0d81..e38f64ff301 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -1417,6 +1418,7 @@ autorefine( TriangleMesh& tm, out_soup_points, out_soup_triangles); clear(tm); + repair_polygon_soup(out_soup_points, out_soup_triangles); orient_polygon_soup(out_soup_points, out_soup_triangles); polygon_soup_to_polygon_mesh(out_soup_points, out_soup_triangles, tm); } From 55f8bcb12202de6fb6fe70ee3096d979b8f95dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 6 Apr 2023 18:24:59 +0200 Subject: [PATCH 054/139] fix assertion --- .../internal/Triangle_3_Triangle_3_intersection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h index 35aa4f8f0a5..4cc5f9be560 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h @@ -372,7 +372,7 @@ void intersection_coplanar_triangles_cutoff(const typename Kernel::Point_3& p1, prev = inter_pts.insert(it,new_pt); orientations[&(*prev)] = COLLINEAR; - CGAL_assertion_code(++pt_added); + CGAL_kernel_assertion_code(++pt_added); } prev = it; From a15956d231a5639cd850c6dde9f37891fdad1e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 24 May 2023 16:09:31 +0200 Subject: [PATCH 055/139] add clear function and input must mesh should be const in principle --- .../Non_manifold_feature_map.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Non_manifold_feature_map.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Non_manifold_feature_map.h index 8177a02d178..e8901ebd727 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Non_manifold_feature_map.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Non_manifold_feature_map.h @@ -28,8 +28,8 @@ struct Non_manifold_feature_map typedef typename Graph_traits::halfedge_descriptor halfedge_descriptor; typedef dynamic_edge_property_t Edge_to_id_tag; typedef dynamic_vertex_property_t Vertex_to_id_tag; - typedef typename boost::property_map::type Edge_to_nm_id; - typedef typename boost::property_map::type Vertex_to_nm_id; + typedef typename boost::property_map::const_type Edge_to_nm_id; + typedef typename boost::property_map::const_type Vertex_to_nm_id; Edge_to_nm_id e_nm_id; Vertex_to_nm_id v_nm_id; std::vector< std::vector > non_manifold_edges; @@ -39,7 +39,7 @@ struct Non_manifold_feature_map {} template - Non_manifold_feature_map(PolygonMesh& pm, Vpm vpm) + Non_manifold_feature_map(const PolygonMesh& pm, Vpm vpm) : e_nm_id(get(Edge_to_id_tag(), pm)) , v_nm_id(get(Vertex_to_id_tag(), pm)) { @@ -99,6 +99,14 @@ struct Non_manifold_feature_map } } } + + void clear() + { + non_manifold_edges.clear(); + non_manifold_vertices.clear(); + e_nm_id = Edge_to_nm_id(); + v_nm_id = Vertex_to_nm_id(); + } }; } } // end of CGAL::Polygon_mesh_processing From 5d73a7addd778919f50b60b37d87e70886703035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 25 May 2023 10:06:51 +0200 Subject: [PATCH 056/139] add TODOs for parallelism --- .../examples/Polygon_mesh_processing/CMakeLists.txt | 1 + .../CGAL/Polygon_mesh_processing/autorefinement.h | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index d2faeb70cb2..306e216be40 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -120,6 +120,7 @@ if(TARGET CGAL::TBB_support) target_link_libraries(self_intersections_example PUBLIC CGAL::TBB_support) target_link_libraries(hausdorff_distance_remeshing_example PUBLIC CGAL::TBB_support) target_link_libraries(hausdorff_bounded_error_distance_example PUBLIC CGAL::TBB_support) + target_link_libraries(soup_autorefinement PUBLIC CGAL::TBB_support) create_single_source_cgal_program("corefinement_parallel_union_meshes.cpp") target_link_libraries(corefinement_parallel_union_meshes PUBLIC CGAL::TBB_support) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index e38f64ff301..a46f2664803 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1116,7 +1116,7 @@ void autorefine_soup_output(const PointRange& input_points, typedef std::size_t Input_TID; typedef std::pair Pair_of_triangle_ids; - std::vector si_pairs; + std::vector si_pairs; // TODO: check std::vector is fine with Parallel_tag // collect intersecting pairs of triangles CGAL_PMP_AUTOREFINE_VERBOSE("collect intersecting pairs"); @@ -1170,6 +1170,7 @@ void autorefine_soup_output(const PointRange& input_points, CGAL_PMP_AUTOREFINE_VERBOSE("compute intersections"); std::set > intersecting_triangles; + //TODO: PARALLEL_FOR #2 for (const Pair_of_triangle_ids& p : si_pairs) { int i1 = tri_inter_ids[p.first], @@ -1217,6 +1218,7 @@ void autorefine_soup_output(const PointRange& input_points, #ifdef DEDUPLICATE_SEGMENTS // deduplicate inserted segments + //TODO: PARALLEL_FOR #3 std::vector>> all_segments_ids(all_segments.size()); for(std::size_t ti=0; ti> new_triangles; + std::vector> new_triangles; // Need to be threadsafe #ifdef USE_PROGRESS_DISPLAY boost::timer::progress_display pd(triangles.size()); #endif + //TODO: PARALLEL_FOR #1 for(std::size_t ti=0; ti to_input; + // TODO: reuse the fact that maps per triangle are already sorted std::map point_id_map; #if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) std::vector exact_soup_points; @@ -1348,6 +1352,7 @@ void autorefine_soup_output(const PointRange& input_points, } // import refined triangles + //TODO: PARALLEL_FOR #4 for (const std::array& t : new_triangles) { soup_triangles.emplace_back(CGAL::make_array(get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2]))); @@ -1355,11 +1360,11 @@ void autorefine_soup_output(const PointRange& input_points, #ifndef CGAL_NDEBUG CGAL_PMP_AUTOREFINE_VERBOSE("check soup"); - CGAL_assertion( !does_triangle_soup_self_intersect(exact_soup_points, soup_triangles) ); + CGAL_assertion( !does_triangle_soup_self_intersect(exact_soup_points, soup_triangles) ); #else #ifdef CGAL_DEBUG_PMP_AUTOREFINE CGAL_PMP_AUTOREFINE_VERBOSE("check soup"); - if (does_triangle_soup_self_intersect(exact_soup_points, soup_triangles)) + if (does_triangle_soup_self_intersect(exact_soup_points, soup_triangles)) throw std::runtime_error("ERROR: invalid output, there is most probably a bug"); #endif #endif From 278e1867aa322600cd236413ba305f96b013258e Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 26 May 2023 17:12:28 +0100 Subject: [PATCH 057/139] parallize #1 --- .../soup_autorefinement.cpp | 7 +- .../Polygon_mesh_processing/autorefinement.h | 89 +++++++++++++------ 2 files changed, 65 insertions(+), 31 deletions(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp index d955734853b..f1230668948 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include @@ -29,11 +30,13 @@ int main(int argc, char** argv) PMP::repair_polygon_soup(input_points, input_triangles); PMP::triangulate_polygons(input_points, input_triangles); + CGAL::Real_timer t; + t.start(); std::vector output_points; std::vector> output_triangles; PMP::autorefine_soup_output(input_points, input_triangles, output_points, output_triangles); - - CGAL::IO::write_polygon_soup("autorefined.off", output_points, output_triangles, CGAL::parameters::stream_precision(17)); + std::cout << "#points = " << output_points.size() << " and #triangles = " << output_triangles.size() << " in " << t.time() << " sec." << std::endl; + // CGAL::IO::write_polygon_soup("autorefined.off", output_points, output_triangles, CGAL::parameters::stream_precision(17)); return 0; } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index a46f2664803..e862d683960 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -39,6 +39,11 @@ #define CGAL_PMP_AUTOREFINE_VERBOSE(MSG) #endif +#ifdef CGAL_LINKED_WITH_TBB +#include +#include +#endif + #include #define TEST_RESOLVE_INTERSECTION @@ -656,7 +661,12 @@ void generate_subtriangles(std::size_t ti, const std::vector& in_triangle_ids, const std::set >& intersecting_triangles, const std::vector>& triangles, - std::vector>& new_triangles) +#ifdef CGAL_LINKED_WITH_TBB + tbb::concurrent_vector>& new_triangles +#else + std::vector>& new_triangles +#endif + ) { // std::cout << "generate_subtriangles()\n"; // std::cout << std::setprecision(17); @@ -1266,46 +1276,67 @@ void autorefine_soup_output(const PointRange& input_points, CGAL_PMP_AUTOREFINE_VERBOSE("triangulate faces"); // now refine triangles - std::vector> new_triangles; // Need to be threadsafe +#ifdef CGAL_LINKED_WITH_TBB + tbb::concurrent_vector> new_triangles; +#else + std::vector> new_triangles; +#endif #ifdef USE_PROGRESS_DISPLAY boost::timer::progress_display pd(triangles.size()); #endif - //TODO: PARALLEL_FOR #1 - for(std::size_t ti=0; ti& t = triangles[ti]; - auto is_constant_in_dim = [](const std::array& t, int dim) - { - return t[0][dim]==t[1][dim] && t[0][dim]!=t[2][dim]; - }; + if (all_segments[ti].empty() && all_points[ti].empty()) + new_triangles.push_back(triangles[ti]); + else + { +#ifdef USE_FIXED_PROJECTION_TRAITS + const std::array& t = triangles[ti]; + auto is_constant_in_dim = [](const std::array& t, int dim) + { + return t[0][dim] == t[1][dim] && t[0][dim] != t[2][dim]; + }; - typename EK::Vector_3 orth = CGAL::normal(t[0], t[1], t[2]); // TODO::avoid construction? - int c = CGAL::abs(orth[0]) > CGAL::abs(orth[1]) ? 0 : 1; - c = CGAL::abs(orth[2]) > CGAL::abs(orth[c]) ? 2 : c; + typename EK::Vector_3 orth = CGAL::normal(t[0], t[1], t[2]); // TODO::avoid construction? + 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) { - autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); - } else if(c == 1) { - autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); - } else if(c == 2) { - autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); - } - #else - autorefine_impl::generate_subtriangles(ti, all_segments_ids[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); - #endif - } + if (c == 0) { + autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); + } + else if (c == 1) { + autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); + } + else if (c == 2) { + autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); + } +#else + autorefine_impl::generate_subtriangles(ti, all_segments_ids[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); +#endif + } #ifdef USE_PROGRESS_DISPLAY - ++pd; + ++pd; #endif + }; + +#ifdef CGAL_LINKED_WITH_TBB + tbb::parallel_for(tbb::blocked_range(0, triangles.size()), + [&](const tbb::blocked_range& r) { + for (size_t ti = r.begin(); ti != r.end(); ++ti) + func(ti); + } + ); +#else + for (std::size_t ti = 0; ti < triangles.size(); ++ti) { + func(ti); } +#endif + + // brute force output: create a soup, orient and to-mesh CGAL_PMP_AUTOREFINE_VERBOSE("create output soup"); From 319743abf9126d413f6ad9feb99988896094e1f9 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 28 May 2023 15:24:35 +0300 Subject: [PATCH 058/139] Simplified test data and eliminated no. of faces (which is not used) --- .../{CompareCurveList.h => Compare_curves.h} | 0 .../DATA/segments_tight/test00.txt | 36 ++-- .../DATA/segments_tight/test01.txt | 50 ++--- .../DATA/segments_tight/test02.txt | 39 ++-- .../DATA/segments_tight/test03.txt | 27 ++- .../DATA/segments_tight/test04.txt | 39 ++-- .../DATA/segments_tight/test05.txt | 39 ++-- .../DATA/segments_tight/test06.txt | 87 ++++---- .../DATA/segments_tight/test07.txt | 26 +-- .../DATA/segments_tight/test08.txt | 24 +-- .../DATA/segments_tight/test09.txt | 25 ++- .../DATA/segments_tight/test10.txt | 26 ++- .../DATA/segments_tight/test11.txt | 26 ++- .../DATA/segments_tight/test12.txt | 40 ++-- .../DATA/segments_tight/test13.txt | 39 ++-- .../DATA/segments_tight/test14.txt | 70 +++---- .../DATA/segments_tight/test15.txt | 53 +++-- .../DATA/segments_tight/test16.txt | 90 ++++----- .../DATA/segments_tight/test17.txt | 27 ++- .../DATA/segments_tight/test18.txt | 38 ++-- .../DATA/segments_tight/test19.txt | 24 +-- .../DATA/segments_tight/test20.txt | 40 ++-- .../DATA/segments_tight/test21.txt | 42 ++-- .../DATA/segments_tight/test22.txt | 36 ++-- .../DATA/segments_tight/test23.txt | 29 ++- .../DATA/segments_tight/test24.txt | 28 +-- .../DATA/segments_tight/test25.txt | 29 ++- .../DATA/segments_tight/test26.txt | 60 +++--- .../DATA/segments_tight/test27.txt | 48 ++--- .../DATA/segments_tight/test28.txt | 58 +++--- .../DATA/segments_tight/test29.txt | 36 ++-- .../DATA/segments_tight/test30.txt | 30 +-- .../DATA/segments_tight/test31.txt | 50 ++--- .../DATA/segments_tight/test32.txt | 50 ++--- .../DATA/segments_tight/test33.txt | 18 +- .../DATA/segments_tight/test34.txt | 18 +- .../DATA/segments_tight/test35.txt | 66 +++--- .../DATA/segments_tight/test36.txt | 66 +++--- .../DATA/segments_tight/test37.txt | 86 ++++---- .../DATA/segments_tight/test40.txt | 24 +-- .../DATA/segments_tight/test41.txt | 24 +-- .../DATA/segments_tight/test42.txt | 30 +-- .../DATA/segments_tight/test43.txt | 16 +- .../DATA/segments_tight/test44.txt | 27 ++- .../DATA/segments_tight/test45.txt | 16 +- .../DATA/segments_tight/test46.txt | 26 +-- .../DATA/segments_tight/test47.txt | 24 +-- .../DATA/segments_tight/test48.txt | 46 ++--- .../DATA/segments_tight/test49.txt | 16 +- .../DATA/segments_tight/test50.txt | 42 ++-- .../DATA/segments_tight/test51.txt | 190 +++++++++--------- .../DATA/segments_tight/test52.txt | 38 ++-- .../DATA/segments_tight/test53.txt | 23 +-- .../DATA/segments_tight/test54.txt | 30 +-- .../DATA/segments_tight/test55.txt | 39 ++-- .../DATA/segments_tight/test56.txt | 37 ++-- .../DATA/segments_tight/test60.txt | 29 ++- .../DATA/segments_tight/test61.txt | 50 ++--- .../DATA/segments_tight/test62.txt | 14 +- .../DATA/segments_tight/test63.txt | 32 +-- .../DATA/segments_tight/test64.txt | 14 +- .../DATA/segments_tight/test65.txt | 30 +-- .../DATA/segments_tight/test66.txt | 34 ++-- .../DATA/segments_tight/test67.txt | 47 +++-- .../DATA/segments_tight/test68.txt | 70 +++---- .../DATA/segments_tight/test69.txt | 49 +++-- .../DATA/segments_tight/test70.txt | 62 +++--- .../DATA/segments_tight/test71.txt | 38 ++-- .../DATA/segments_tight/test72.txt | 114 +++++------ .../DATA/segments_tight/test73.txt | 28 +-- .../DATA/segments_tight/test74.txt | 50 ++--- .../DATA/segments_tight/test75.txt | 34 ++-- .../DATA/segments_tight/test76.txt | 42 ++-- .../DATA/segments_tight/test77.txt | 21 +- .../DATA/segments_tight/test78.txt | 106 +++++----- .../DATA/segments_tight/test79.txt | 50 ++--- .../DATA/segments_tight/test80.txt | 36 ++-- .../DATA/segments_tight/test81.txt | 78 +++---- .../DATA/segments_tight/test82.txt | 30 +-- .../DATA/segments_tight/test83.txt | 38 ++-- .../DATA/segments_tight/test84.txt | 42 ++-- .../DATA/segments_tight/test85.txt | 33 ++- .../DATA/segments_tight/test86.txt | 32 ++- .../DATA/segments_tight/test87.txt | 31 ++- .../DATA/segments_tight/test88.txt | 37 ++-- 85 files changed, 1744 insertions(+), 1790 deletions(-) rename Surface_sweep_2/test/Surface_sweep_2/{CompareCurveList.h => Compare_curves.h} (100%) diff --git a/Surface_sweep_2/test/Surface_sweep_2/CompareCurveList.h b/Surface_sweep_2/test/Surface_sweep_2/Compare_curves.h similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/CompareCurveList.h rename to Surface_sweep_2/test/Surface_sweep_2/Compare_curves.h diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test00.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test00.txt index 420b718d1e7..7d48df57242 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test00.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test00.txt @@ -1,23 +1,27 @@ +# No. of input segments followed by segments 2 -1 1 1 -1 1 1 -1 -1 +# No. of output segments followed by segments 4 -0/8 0/8 -1/1 -1/1 --1/1 1/1 0/8 0/8 -0/8 0/8 1/1 -1/1 -1/1 1/1 0/8 0/8 +0 0 -1 -1 +-1 1 0 0 +0 0 1 -1 +1 1 0 0 +# No. of output points followed by points 5 --1/1 -1/1 --1/1 1/1 -0/8 0/8 -1/1 -1/1 -1/1 1/1 -1 -0/8 0/8 +-1 -1 +-1 1 +0 0 +1 -1 +1 1 +# No. of intersection points followed by points 1 +0 0 +# No of faces: 1 +# No. of output segments with overlaps followed by segments 4 -0/8 0/8 -1/1 -1/1 --1/1 1/1 0/8 0/8 -0/8 0/8 1/1 -1/1 -1/1 1/1 0/8 0/8 - +0 0 -1 -1 +-1 1 0 0 +0 0 1 -1 +1 1 0 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test01.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test01.txt index b8f61bf90c6..b5e69de0242 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test01.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test01.txt @@ -4,47 +4,47 @@ 5 0 1 2 1 0 3 4 12 -1/1 0/1 36/20 32/20 -36/20 32/20 1/1 2/1 +1 0 36/20 32/20 +36/20 32/20 1 2 36/20 32/20 44/20 48/20 -1/1 3/1 44/20 48/20 -44/20 48/20 3/1 4/1 -82/26 24/26 3/1 0/1 +1 3 44/20 48/20 +44/20 48/20 3 4 +82/26 24/26 3 0 82/26 24/26 36/20 32/20 86/26 48/26 82/26 24/26 44/20 48/20 86/26 48/26 -4/1 6/1 86/26 48/26 -5/1 0/1 82/26 24/26 -86/26 48/26 5/1 1/1 +4 6 86/26 48/26 +5 0 82/26 24/26 +86/26 48/26 5 1 12 -1/1 0/1 -1/1 2/1 -1/1 3/1 +1 0 +1 2 +1 3 36/20 32/20 44/20 48/20 -3/1 0/1 -3/1 4/1 +3 0 +3 4 82/26 24/26 86/26 48/26 -4/1 6/1 -5/1 0/1 -5/1 1/1 +4 6 +5 0 +5 1 4 36/20 32/20 44/20 48/20 82/26 24/26 86/26 48/26 -2 +# No. of faces: 2 12 -1/1 0/1 36/20 32/20 -36/20 32/20 1/1 2/1 +1 0 36/20 32/20 +36/20 32/20 1 2 36/20 32/20 44/20 48/20 -1/1 3/1 44/20 48/20 -44/20 48/20 3/1 4/1 -82/26 24/26 3/1 0/1 +1 3 44/20 48/20 +44/20 48/20 3 4 +82/26 24/26 3 0 82/26 24/26 36/20 32/20 86/26 48/26 82/26 24/26 44/20 48/20 86/26 48/26 -4/1 6/1 86/26 48/26 -5/1 0/1 82/26 24/26 -86/26 48/26 5/1 1/1 +4 6 86/26 48/26 +5 0 82/26 24/26 +86/26 48/26 5 1 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test02.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test02.txt index 9f96ea0d395..5c505dbd01f 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test02.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test02.txt @@ -3,32 +3,31 @@ 7 4 1 3 5 2 3 7 7 -0/1 6/1 153/43 241/43 -153/43 241/43 3/1 7/1 -140/32 114/32 1/1 3/1 +0 6 153/43 241/43 +153/43 241/43 3 7 +140/32 114/32 1 3 140/32 114/32 153/43 241/43 -5/1 2/1 140/32 114/32 -7/1 4/1 140/32 114/32 -153/43 241/43 9/1 5/1 +5 2 140/32 114/32 +7 4 140/32 114/32 +153/43 241/43 9 5 8 -0/1 6/1 -1/1 3/1 -3/1 7/1 +0 6 +1 3 +3 7 153/43 241/43 140/32 114/32 -5/1 2/1 -7/1 4/1 -9/1 5/1 +5 2 +7 4 +9 5 2 153/43 241/43 140/32 114/32 -1 +# No. of faces: 1 7 -0/1 6/1 153/43 241/43 -153/43 241/43 3/1 7/1 -140/32 114/32 1/1 3/1 +0 6 153/43 241/43 +153/43 241/43 3 7 +140/32 114/32 1 3 140/32 114/32 153/43 241/43 -5/1 2/1 140/32 114/32 -7/1 4/1 140/32 114/32 -153/43 241/43 9/1 5/1 - +5 2 140/32 114/32 +7 4 140/32 114/32 +153/43 241/43 9 5 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test03.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test03.txt index 9fc24d51667..15cc231bb28 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test03.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test03.txt @@ -3,20 +3,19 @@ 1 2 5 2 1 3 5 3 3 -1/1 1/1 5/1 1/1 -1/1 2/1 5/1 2/1 -1/1 3/1 5/1 3/1 +1 1 5 1 +1 2 5 2 +1 3 5 3 6 -1/1 1/1 -1/1 2/1 -1/1 3/1 -5/1 1/1 -5/1 2/1 -5/1 3/1 +1 1 +1 2 +1 3 +5 1 +5 2 +5 3 0 -1 +# No. of faces: 1 3 -1/1 1/1 5/1 1/1 -1/1 2/1 5/1 2/1 -1/1 3/1 5/1 3/1 - +1 1 5 1 +1 2 5 2 +1 3 5 3 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test04.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test04.txt index 953c0bdeaaf..8ea66e0df9f 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test04.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test04.txt @@ -3,32 +3,31 @@ 2 2 9 2 3 7 8 1 7 -2/1 2/1 63/21 42/21 -1/1 4/1 63/21 42/21 -63/21 42/21 4/1 1/1 +2 2 63/21 42/21 +1 4 63/21 42/21 +63/21 42/21 4 1 63/21 42/21 301/42 84/42 -3/1 7/1 301/42 84/42 -301/42 84/42 8/1 1/1 -301/42 84/42 9/1 2/1 +3 7 301/42 84/42 +301/42 84/42 8 1 +301/42 84/42 9 2 8 -1/1 4/1 -2/1 2/1 +1 4 +2 2 63/21 42/21 -3/1 7/1 -4/1 1/1 +3 7 +4 1 301/42 84/42 -8/1 1/1 -9/1 2/1 +8 1 +9 2 2 63/21 42/21 301/42 84/42 -1 +# No. of faces: 1 7 -2/1 2/1 63/21 42/21 -1/1 4/1 63/21 42/21 -63/21 42/21 4/1 1/1 +2 2 63/21 42/21 +1 4 63/21 42/21 +63/21 42/21 4 1 63/21 42/21 301/42 84/42 -3/1 7/1 301/42 84/42 -301/42 84/42 8/1 1/1 -301/42 84/42 9/1 2/1 - +3 7 301/42 84/42 +301/42 84/42 8 1 +301/42 84/42 9 2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test05.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test05.txt index 46d7e73e4d6..187550ca704 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test05.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test05.txt @@ -3,38 +3,37 @@ 3 2 10 6 1 3 14 3 9 -3/1 2/1 247/52 156/52 -1/1 3/1 247/52 156/52 +3 2 247/52 156/52 +1 3 247/52 156/52 247/52 156/52 681/87 414/87 -2/1 7/1 681/87 414/87 -681/87 414/87 10/1 6/1 +2 7 681/87 414/87 +681/87 414/87 10 6 247/52 156/52 806/65 195/65 681/87 414/87 806/65 195/65 -806/65 195/65 14/1 3/1 -806/65 195/65 15/1 2/1 +806/65 195/65 14 3 +806/65 195/65 15 2 9 -1/1 3/1 -2/1 7/1 -3/1 2/1 +1 3 +2 7 +3 2 247/52 156/52 681/87 414/87 -10/1 6/1 +10 6 806/65 195/65 -14/1 3/1 -15/1 2/1 +14 3 +15 2 3 247/52 156/52 681/87 414/87 806/65 195/65 -2 +# No. of faces: 2 9 -3/1 2/1 247/52 156/52 -1/1 3/1 247/52 156/52 +3 2 247/52 156/52 +1 3 247/52 156/52 247/52 156/52 681/87 414/87 -2/1 7/1 681/87 414/87 -681/87 414/87 10/1 6/1 +2 7 681/87 414/87 +681/87 414/87 10 6 247/52 156/52 806/65 195/65 681/87 414/87 806/65 195/65 -806/65 195/65 14/1 3/1 -806/65 195/65 15/1 2/1 - +806/65 195/65 14 3 +806/65 195/65 15 2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test06.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test06.txt index cd0e00f2585..2f9455a5a35 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test06.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test06.txt @@ -6,56 +6,55 @@ 6 2 3 7 5 7 3 5 14 -60/16 92/16 3/1 5/1 -60/16 92/16 3/1 7/1 -213/45 185/45 1/1 1/1 +60/16 92/16 3 5 +60/16 92/16 3 7 +213/45 185/45 1 1 213/45 185/45 60/16 92/16 -5/1 7/1 60/16 92/16 -6/1 2/1 213/45 185/45 -7/1 6/1 213/45 185/45 -156/15 60/15 9/1 4/1 -156/15 60/15 8/1 6/1 -58/5 15/5 11/1 3/1 -58/5 15/5 156/15 60/15 -12/1 3/1 58/5 15/5 -12/1 4/1 156/15 60/15 -14/1 1/1 58/5 15/5 +5 7 60/16 92/16 +6 2 213/45 185/45 +7 6 213/45 185/45 +156/15 4 9 4 +156/15 4 8 6 +58/5 3 11 3 +58/5 3 156/15 4 +12 3 58/5 3 +12 4 156/15 4 +14 1 58/5 3 16 -1/1 1/1 -3/1 5/1 -3/1 7/1 +1 1 +3 5 +3 7 60/16 92/16 213/45 185/45 -5/1 7/1 -6/1 2/1 -7/1 6/1 -8/1 6/1 -9/1 4/1 -156/15 60/15 -11/1 3/1 -58/5 15/5 -12/1 3/1 -12/1 4/1 -14/1 1/1 +5 7 +6 2 +7 6 +8 6 +9 4 +156/15 4 +11 3 +58/5 3 +12 3 +12 4 +14 1 4 60/16 92/16 213/45 185/45 -156/15 60/15 -58/5 15/5 -1 +156/15 4 +58/5 3 +# No. of faces: 1 14 -60/16 92/16 3/1 5/1 -60/16 92/16 3/1 7/1 -213/45 185/45 1/1 1/1 +60/16 92/16 3 5 +60/16 92/16 3 7 +213/45 185/45 1 1 213/45 185/45 60/16 92/16 -5/1 7/1 60/16 92/16 -6/1 2/1 213/45 185/45 -7/1 6/1 213/45 185/45 -156/15 60/15 9/1 4/1 -156/15 60/15 8/1 6/1 -58/5 15/5 11/1 3/1 -58/5 15/5 156/15 60/15 -12/1 3/1 58/5 15/5 -12/1 4/1 156/15 60/15 -14/1 1/1 58/5 15/5 - +5 7 60/16 92/16 +6 2 213/45 185/45 +7 6 213/45 185/45 +156/15 4 9 4 +156/15 4 8 6 +58/5 3 11 3 +58/5 3 156/15 4 +12 3 58/5 3 +12 4 156/15 4 +14 1 58/5 3 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test07.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test07.txt index c94c53eece6..b95f6e3998c 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test07.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test07.txt @@ -4,19 +4,19 @@ 7 1 9 4 5 5 9 4 4 -5/1 5/1 2/1 3/1 -7/1 1/1 2/1 3/1 -7/1 1/1 9/1 4/1 -5/1 5/1 9/1 4/1 +5 5 2 3 +7 1 2 3 +7 1 9 4 +5 5 9 4 4 -2/1 3/1 -5/1 5/1 -7/1 1/1 -9/1 4/1 +2 3 +5 5 +7 1 +9 4 0 -2 +# No. of faces: 2 4 -5/1 5/1 2/1 3/1 -7/1 1/1 2/1 3/1 -7/1 1/1 9/1 4/1 -5/1 5/1 9/1 4/1 +5 5 2 3 +7 1 2 3 +7 1 9 4 +5 5 9 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test08.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test08.txt index 2aa0735bf04..10db8ae63ea 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test08.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test08.txt @@ -2,18 +2,18 @@ 1 2 4 2 3 0 5 4 3 -3/1 0/1 4/1 2/1 -1/1 2/1 4/1 2/1 -4/1 2/1 5/1 4/1 +3 0 4 2 +1 2 4 2 +4 2 5 4 4 -1/1 2/1 -3/1 0/1 -4/1 2/1 -5/1 4/1 -1 -4/1 2/1 +1 2 +3 0 +4 2 +5 4 1 +4 2 +# No. of faces: 1 3 -3/1 0/1 4/1 2/1 -1/1 2/1 4/1 2/1 -4/1 2/1 5/1 4/1 +3 0 4 2 +1 2 4 2 +4 2 5 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test09.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test09.txt index e9f6371753e..8e0635e3ca6 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test09.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test09.txt @@ -2,19 +2,18 @@ 1 1 7 1 3 1 5 4 3 -1/1 1/1 3/1 1/1 -3/1 1/1 5/1 4/1 -3/1 1/1 7/1 1/1 +1 1 3 1 +3 1 5 4 +3 1 7 1 4 -1/1 1/1 -3/1 1/1 -5/1 4/1 -7/1 1/1 -1 -3/1 1/1 +1 1 +3 1 +5 4 +7 1 1 +3 1 +# No. of faces: 1 3 -1/1 1/1 3/1 1/1 -3/1 1/1 5/1 4/1 -3/1 1/1 7/1 1/1 - +1 1 3 1 +3 1 5 4 +3 1 7 1 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test10.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test10.txt index f0113460554..47e21732fd6 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test10.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test10.txt @@ -2,20 +2,18 @@ 6 1 1 1 4 -2 3 1 3 -3/1 1/1 1/1 1/1 -4/1 -2/1 3/1 1/1 -6/1 1/1 3/1 1/1 +3 1 1 1 +4 -2 3 1 +6 1 3 1 4 -1/1 1/1 -3/1 1/1 -4/1 -2/1 -6/1 1/1 -1 -3/1 1/1 +1 1 +3 1 +4 -2 +6 1 1 +3 1 +# No. of faces: 1 3 -3/1 1/1 1/1 1/1 -4/1 -2/1 3/1 1/1 -6/1 1/1 3/1 1/1 - - +3 1 1 1 +4 -2 3 1 +6 1 3 1 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test11.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test11.txt index 78140996955..e389d4a7db7 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test11.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test11.txt @@ -2,20 +2,18 @@ 1 1 3 5 5 3 2 3 3 -1/1 1/1 2/1 3/1 -2/1 3/1 3/1 5/1 -5/1 3/1 2/1 3/1 +1 1 2 3 +2 3 3 5 +5 3 2 3 4 -1/1 1/1 -2/1 3/1 -3/1 5/1 -5/1 3/1 -1 -2/1 3/1 +1 1 +2 3 +3 5 +5 3 1 +2 3 +# No. of faces: 1 3 -1/1 1/1 2/1 3/1 -2/1 3/1 3/1 5/1 -5/1 3/1 2/1 3/1 - - +1 1 2 3 +2 3 3 5 +5 3 2 3 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test12.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test12.txt index 39d22990f45..4710b27995d 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test12.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test12.txt @@ -3,27 +3,25 @@ 7 1 1 1 1 4 5 4 5 -1/1 4/1 2/1 4/1 -4/1 1/1 1/1 1/1 -2/1 4/1 4/1 1/1 -2/1 4/1 5/1 4/1 -7/1 1/1 4/1 1/1 +1 4 2 4 +4 1 1 1 +2 4 4 1 +2 4 5 4 +7 1 4 1 6 -1/1 1/1 -1/1 4/1 -2/1 4/1 -4/1 1/1 -5/1 4/1 -7/1 1/1 +1 1 +1 4 +2 4 +4 1 +5 4 +7 1 2 -2/1 4/1 -4/1 1/1 -1 +2 4 +4 1 +# No. of faces: 1 5 -1/1 4/1 2/1 4/1 -4/1 1/1 1/1 1/1 -2/1 4/1 4/1 1/1 -2/1 4/1 5/1 4/1 -7/1 1/1 4/1 1/1 - - +1 4 2 4 +4 1 1 1 +2 4 4 1 +2 4 5 4 +7 1 4 1 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test13.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test13.txt index 69f7c821d95..3fad0655447 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test13.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test13.txt @@ -3,26 +3,25 @@ 1 5 9 -1 7 4 3 0 5 -0/1 2/1 4/1 2/1 -280/56 112/56 3/1 0/1 -1/1 5/1 280/56 112/56 -7/1 4/1 280/56 112/56 -280/56 112/56 9/1 -1/1 +0 2 4 2 +5 2 3 0 +1 5 5 2 +7 4 5 2 +5 2 9 -1 7 -0/1 2/1 -1/1 5/1 -3/1 0/1 -4/1 2/1 -280/56 112/56 -7/1 4/1 -9/1 -1/1 -1 -280/56 112/56 +0 2 +1 5 +3 0 +4 2 +5 2 +7 4 +9 -1 1 +5 2 +# No. of faces: 1 5 -0/1 2/1 4/1 2/1 -280/56 112/56 3/1 0/1 -1/1 5/1 280/56 112/56 -7/1 4/1 280/56 112/56 -280/56 112/56 9/1 -1/1 - +0 2 4 2 +5 2 3 0 +1 5 5 2 +7 4 5 2 +5 2 9 -1 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test14.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test14.txt index 6252c3b96dc..01535344d7c 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test14.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test14.txt @@ -7,41 +7,41 @@ 3 -1 5 -1 3 -2 5 -2 9 -0/1 2/1 4/1 2/1 -3/1 -2/1 5/1 -2/1 -3/1 -1/1 5/1 -1/1 -280/56 112/56 3/1 0/1 -1/1 5/1 280/56 112/56 -3/1 4/1 5/1 4/1 -3/1 5/1 5/1 5/1 -7/1 4/1 280/56 112/56 -280/56 112/56 9/1 -1/1 +0 2 4 2 +3 -2 5 -2 +3 -1 5 -1 +5 2 3 0 +1 5 5 2 +3 4 5 4 +3 5 5 5 +7 4 5 2 +5 2 9 -1 15 -0/1 2/1 -1/1 5/1 -3/1 -2/1 -3/1 -1/1 -3/1 0/1 -3/1 4/1 -3/1 5/1 -4/1 2/1 -5/1 -2/1 -5/1 -1/1 -280/56 112/56 -5/1 4/1 -5/1 5/1 -7/1 4/1 -9/1 -1/1 -1 -280/56 112/56 +0 2 +1 5 +3 -2 +3 -1 +3 0 +3 4 +3 5 +4 2 +5 -2 +5 -1 +5 2 +5 4 +5 5 +7 4 +9 -1 1 +5 2 +# No. of faces: 1 9 -0/1 2/1 4/1 2/1 -3/1 -2/1 5/1 -2/1 -3/1 -1/1 5/1 -1/1 -280/56 112/56 3/1 0/1 -1/1 5/1 280/56 112/56 -3/1 4/1 5/1 4/1 -3/1 5/1 5/1 5/1 -7/1 4/1 280/56 112/56 -280/56 112/56 9/1 -1/1 +0 2 4 2 +3 -2 5 -2 +3 -1 5 -1 +5 2 3 0 +1 5 5 2 +3 4 5 4 +3 5 5 5 +7 4 5 2 +5 2 9 -1 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test15.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test15.txt index bc9ee161137..f7b36b05432 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test15.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test15.txt @@ -9,33 +9,32 @@ 8 2 5 -1 4 3 5 -1 9 -3/1 -3/1 0/1 0/1 -4/1 -4/1 3/1 -3/1 -0/1 0/1 4/1 3/1 -4/1 -4/1 5/1 -1/1 -3/1 -3/1 5/1 -1/1 -4/1 3/1 5/1 -1/1 -8/1 2/1 5/1 -1/1 -5/1 -1/1 9/1 -1/1 -8/1 2/1 9/1 -1/1 +3 -3 0 0 +4 -4 3 -3 +0 0 4 3 +4 -4 5 -1 +3 -3 5 -1 +4 3 5 -1 +8 2 5 -1 +5 -1 9 -1 +8 2 9 -1 7 -0/1 0/1 -3/1 -3/1 -4/1 -4/1 -4/1 3/1 -5/1 -1/1 -8/1 2/1 -9/1 -1/1 +0 0 +3 -3 +4 -4 +4 3 +5 -1 +8 2 +9 -1 0 -4 +# No. of faces: 4 9 -3/1 -3/1 0/1 0/1 -4/1 -4/1 3/1 -3/1 -0/1 0/1 4/1 3/1 -4/1 -4/1 5/1 -1/1 -3/1 -3/1 5/1 -1/1 -4/1 3/1 5/1 -1/1 -8/1 2/1 5/1 -1/1 -5/1 -1/1 9/1 -1/1 -8/1 2/1 9/1 -1/1 - +3 -3 0 0 +4 -4 3 -3 +0 0 4 3 +4 -4 5 -1 +3 -3 5 -1 +4 3 5 -1 +8 2 5 -1 +5 -1 9 -1 +8 2 9 -1 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test16.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test16.txt index d174c920fc2..3bc6a8ce547 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test16.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test16.txt @@ -7,51 +7,51 @@ 0 2 6 4 1 4 5 2 14 -2/1 0/1 36/12 36/12 -36/12 36/12 1/1 1/1 -0/1 2/1 36/12 36/12 -36/12 36/12 0/1 3/1 -1/1 4/1 36/12 36/12 -36/12 36/12 1/1 5/1 -36/12 36/12 2/1 6/1 -4/1 0/1 36/12 36/12 -36/12 36/12 4/1 6/1 -5/1 1/1 36/12 36/12 -36/12 36/12 5/1 2/1 -5/1 5/1 36/12 36/12 -6/1 3/1 36/12 36/12 -36/12 36/12 6/1 4/1 +2 0 3 3 +3 3 1 1 +0 2 3 3 +3 3 0 3 +1 4 3 3 +3 3 1 5 +3 3 2 6 +4 0 3 3 +3 3 4 6 +5 1 3 3 +3 3 5 2 +5 5 3 3 +6 3 3 3 +3 3 6 4 15 -0/1 2/1 -0/1 3/1 -1/1 1/1 -1/1 4/1 -1/1 5/1 -2/1 0/1 -2/1 6/1 -36/12 36/12 -4/1 0/1 -4/1 6/1 -5/1 1/1 -5/1 2/1 -5/1 5/1 -6/1 3/1 -6/1 4/1 -1 -36/12 36/12 +0 2 +0 3 +1 1 +1 4 +1 5 +2 0 +2 6 +3 3 +4 0 +4 6 +5 1 +5 2 +5 5 +6 3 +6 4 1 +3 3 +# No. of faces: 1 14 -2/1 0/1 36/12 36/12 -36/12 36/12 1/1 1/1 -0/1 2/1 36/12 36/12 -36/12 36/12 0/1 3/1 -1/1 4/1 36/12 36/12 -36/12 36/12 1/1 5/1 -36/12 36/12 2/1 6/1 -4/1 0/1 36/12 36/12 -36/12 36/12 4/1 6/1 -5/1 1/1 36/12 36/12 -36/12 36/12 5/1 2/1 -5/1 5/1 36/12 36/12 -6/1 3/1 36/12 36/12 -36/12 36/12 6/1 4/1 +2 0 3 3 +3 3 1 1 +0 2 3 3 +3 3 0 3 +1 4 3 3 +3 3 1 5 +3 3 2 6 +4 0 3 3 +3 3 4 6 +5 1 3 3 +3 3 5 2 +5 5 3 3 +6 3 3 3 +3 3 6 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test17.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test17.txt index 32cf9a98c6c..34351b917ac 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test17.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test17.txt @@ -4,20 +4,19 @@ 1 3 0 4 1 3 2 4 4 -1/1 3/1 0/1 4/1 -1/1 5/1 0/1 4/1 -1/1 3/1 2/1 4/1 -1/1 5/1 2/1 4/1 +1 3 0 4 +1 5 0 4 +1 3 2 4 +1 5 2 4 4 -0/1 4/1 -1/1 3/1 -1/1 5/1 -2/1 4/1 +0 4 +1 3 +1 5 +2 4 0 -2 +# No. of faces: 2 4 -1/1 3/1 0/1 4/1 -1/1 5/1 0/1 4/1 -1/1 3/1 2/1 4/1 -1/1 5/1 2/1 4/1 - +1 3 0 4 +1 5 0 4 +1 3 2 4 +1 5 2 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test18.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test18.txt index 049c8e10a28..23c2db7d18f 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test18.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test18.txt @@ -3,25 +3,25 @@ 0 2 3 2 2 -1 4 1 5 -2/1 -1/1 36/12 0/12 -0/1 0/1 36/12 0/12 -0/1 2/1 3/1 2/1 -36/12 0/12 4/1 1/1 -36/12 0/12 6/1 0/1 +2 -1 3 0 +0 0 3 0 +0 2 3 2 +3 0 4 1 +3 0 6 0 7 -0/1 0/1 -0/1 2/1 -2/1 -1/1 -36/12 0/12 -3/1 2/1 -4/1 1/1 -6/1 0/1 -1 -36/12 0/12 +0 0 +0 2 +2 -1 +3 0 +3 2 +4 1 +6 0 1 +3 0 +# No. of faces: 1 5 -2/1 -1/1 36/12 0/12 -0/1 0/1 36/12 0/12 -0/1 2/1 3/1 2/1 -36/12 0/12 4/1 1/1 -36/12 0/12 6/1 0/1 +2 -1 3 0 +0 0 3 0 +0 2 3 2 +3 0 4 1 +3 0 6 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test19.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test19.txt index b21e9b2a107..a6cf55f8025 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test19.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test19.txt @@ -3,19 +3,17 @@ 3 0 5 0 5 0 8 0 3 -0/1 0/1 3/1 0/1 -3/1 0/1 5/1 0/1 -5/1 0/1 8/1 0/1 +0 0 3 0 +3 0 5 0 +5 0 8 0 4 -0/1 0/1 -3/1 0/1 -5/1 0/1 -8/1 0/1 +0 0 +3 0 +5 0 +8 0 0 -1 +# No. of faces: 1 3 -0/1 0/1 3/1 0/1 -3/1 0/1 5/1 0/1 -5/1 0/1 8/1 0/1 - - +0 0 3 0 +3 0 5 0 +5 0 8 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test20.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test20.txt index 9075a5d1fb5..2c261cad7d1 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test20.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test20.txt @@ -3,28 +3,24 @@ 3 0 5 4 3 4 5 0 5 -3/1 0/1 4/1 2/1 -1/1 2/1 4/1 2/1 -3/1 4/1 4/1 2/1 -4/1 2/1 5/1 0/1 -4/1 2/1 5/1 4/1 +3 0 4 2 +1 2 4 2 +3 4 4 2 +4 2 5 0 +4 2 5 4 6 -1/1 2/1 -3/1 0/1 -3/1 4/1 -4/1 2/1 -5/1 0/1 -5/1 4/1 -1 -4/1 2/1 +1 2 +3 0 +3 4 +4 2 +5 0 +5 4 1 +4 2 +# No. of faces: 1 5 -3/1 0/1 4/1 2/1 -1/1 2/1 4/1 2/1 -3/1 4/1 4/1 2/1 -4/1 2/1 5/1 0/1 -4/1 2/1 5/1 4/1 - - - - +3 0 4 2 +1 2 4 2 +3 4 4 2 +4 2 5 0 +4 2 5 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test21.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test21.txt index 445b25d3b6e..ad795ac780e 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test21.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test21.txt @@ -3,27 +3,27 @@ 9 3 0 3 2 1 6 5 6 -2/1 1/1 180/45 135/45 -180/45 135/45 0/1 3/1 -180/45 135/45 1/1 6/1 -6/1 1/1 180/45 135/45 -180/45 135/45 6/1 5/1 -9/1 3/1 180/45 135/45 +2 1 4 3 +4 3 0 3 +4 3 1 6 +6 1 4 3 +4 3 6 5 +9 3 4 3 7 -0/1 3/1 -1/1 6/1 -2/1 1/1 -180/45 135/45 -6/1 1/1 -6/1 5/1 -9/1 3/1 -1 -180/45 135/45 +0 3 +1 6 +2 1 +4 3 +6 1 +6 5 +9 3 1 +4 3 +# No. of faces: 1 6 -2/1 1/1 180/45 135/45 -180/45 135/45 0/1 3/1 -180/45 135/45 1/1 6/1 -6/1 1/1 180/45 135/45 -180/45 135/45 6/1 5/1 -9/1 3/1 180/45 135/45 +2 1 4 3 +4 3 0 3 +4 3 1 6 +6 1 4 3 +4 3 6 5 +9 3 4 3 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test22.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test22.txt index 738953c643b..e6ac95bc017 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test22.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test22.txt @@ -5,25 +5,23 @@ 0 0 -1 -3 0 0 -3 4 5 -0/1 0/1 -1/1 -3/1 -0/1 0/1 -3/1 4/1 -0/1 0/1 1/1 1/1 -0/1 0/1 2/1 3/1 -0/1 0/1 9/1 8/1 +0 0 -1 -3 +0 0 -3 4 +0 0 1 1 +0 0 2 3 +0 0 9 8 6 --3/1 4/1 --1/1 -3/1 -0/1 0/1 -1/1 1/1 -2/1 3/1 -9/1 8/1 +-3 4 +-1 -3 +0 0 +1 1 +2 3 +9 8 0 -1 +# No. of faces: 1 5 -0/1 0/1 -1/1 -3/1 -0/1 0/1 -3/1 4/1 -0/1 0/1 1/1 1/1 -0/1 0/1 2/1 3/1 -0/1 0/1 9/1 8/1 - - +0 0 -1 -3 +0 0 -3 4 +0 0 1 1 +0 0 2 3 +0 0 9 8 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test23.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test23.txt index 8c692cc93a4..633acf5e467 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test23.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test23.txt @@ -4,21 +4,20 @@ 0 0 4 0 0 0 2 -2 4 -1/1 2/1 0/1 0/1 -0/1 0/1 2/1 -2/1 -3/1 2/1 0/1 0/1 -0/1 0/1 4/1 0/1 +1 2 0 0 +0 0 2 -2 +3 2 0 0 +0 0 4 0 5 -0/1 0/1 -1/1 2/1 -2/1 -2/1 -3/1 2/1 -4/1 0/1 +0 0 +1 2 +2 -2 +3 2 +4 0 0 -1 +# No. of faces: 1 4 -1/1 2/1 0/1 0/1 -0/1 0/1 2/1 -2/1 -3/1 2/1 0/1 0/1 -0/1 0/1 4/1 0/1 - +1 2 0 0 +0 0 2 -2 +3 2 0 0 +0 0 4 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test24.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test24.txt index 601e8cfbf8a..c1b674a8f00 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test24.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test24.txt @@ -4,20 +4,20 @@ -2 -2 0 0 0 0 -2 -4 4 -0/1 0/1 -2/1 -4/1 --2/1 -2/1 0/1 0/1 --3/1 0/1 0/1 0/1 --3/1 2/1 0/1 0/1 +0 0 -2 -4 +-2 -2 0 0 +-3 0 0 0 +-3 2 0 0 5 --3/1 0/1 --3/1 2/1 --2/1 -4/1 --2/1 -2/1 -0/1 0/1 +-3 0 +-3 2 +-2 -4 +-2 -2 +0 0 0 -1 +# No. of faces: 1 4 -0/1 0/1 -2/1 -4/1 --2/1 -2/1 0/1 0/1 --3/1 0/1 0/1 0/1 --3/1 2/1 0/1 0/1 +0 0 -2 -4 +-2 -2 0 0 +-3 0 0 0 +-3 2 0 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test25.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test25.txt index 3b52e2164d7..c679dad3f34 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test25.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test25.txt @@ -4,21 +4,20 @@ 6 0 3 3 0 6 3 3 4 -0/1 0/1 3/1 3/1 -0/1 6/1 3/1 3/1 -6/1 0/1 3/1 3/1 -3/1 3/1 6/1 6/1 +0 0 3 3 +0 6 3 3 +6 0 3 3 +3 3 6 6 5 -0/1 0/1 -0/1 6/1 -3/1 3/1 -6/1 0/1 -6/1 6/1 +0 0 +0 6 +3 3 +6 0 +6 6 0 -1 +# No. of faces: 1 4 -0/1 0/1 3/1 3/1 -0/1 6/1 3/1 3/1 -6/1 0/1 3/1 3/1 -3/1 3/1 6/1 6/1 - +0 0 3 3 +0 6 3 3 +6 0 3 3 +3 3 6 6 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test26.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test26.txt index fc3cfb4fc30..2cfe803179b 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test26.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test26.txt @@ -7,36 +7,36 @@ 0 1 4 1 1 4 3 6 8 -1/1 4/1 2/1 5/1 -0/1 5/1 2/1 5/1 -0/1 7/1 2/1 5/1 -2/1 5/1 3/1 6/1 -0/1 1/1 4/1 1/1 -2/1 4/1 4/1 2/1 -2/1 4/1 4/1 4/1 -2/1 7/1 4/1 9/1 +1 4 2 5 +0 5 2 5 +0 7 2 5 +2 5 3 6 +0 1 4 1 +2 4 4 2 +2 4 4 4 +2 7 4 9 12 -0/1 1/1 -0/1 5/1 -0/1 7/1 -1/1 4/1 -2/1 4/1 -2/1 5/1 -2/1 7/1 -3/1 6/1 -4/1 1/1 -4/1 2/1 -4/1 4/1 -4/1 9/1 -1 -2/1 5/1 +0 1 +0 5 +0 7 +1 4 +2 4 +2 5 +2 7 +3 6 +4 1 +4 2 +4 4 +4 9 1 +2 5 +# No. of faces: 1 8 -1/1 4/1 2/1 5/1 -0/1 5/1 2/1 5/1 -0/1 7/1 2/1 5/1 -2/1 5/1 3/1 6/1 -0/1 1/1 4/1 1/1 -2/1 4/1 4/1 2/1 -2/1 4/1 4/1 4/1 -2/1 7/1 4/1 9/1 +1 4 2 5 +0 5 2 5 +0 7 2 5 +2 5 3 6 +0 1 4 1 +2 4 4 2 +2 4 4 4 +2 7 4 9 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test27.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test27.txt index 1d25c06c8c4..09d93ba7d9b 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test27.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test27.txt @@ -8,30 +8,30 @@ 1 3 2 2 1 1 2 2 8 -0/1 2/1 1/1 1/1 -0/1 2/1 1/1 3/1 -1/1 3/1 0/1 4/1 -1/1 5/1 0/1 4/1 -1/1 1/1 2/1 2/1 -1/1 3/1 2/1 2/1 -1/1 3/1 2/1 4/1 -1/1 5/1 2/1 4/1 +0 2 1 1 +0 2 1 3 +1 3 0 4 +1 5 0 4 +1 1 2 2 +1 3 2 2 +1 3 2 4 +1 5 2 4 7 -0/1 2/1 -0/1 4/1 -1/1 1/1 -1/1 3/1 -1/1 5/1 -2/1 2/1 -2/1 4/1 +0 2 +0 4 +1 1 +1 3 +1 5 +2 2 +2 4 0 -3 +# No. of faces: 3 8 -0/1 2/1 1/1 1/1 -0/1 2/1 1/1 3/1 -1/1 3/1 0/1 4/1 -1/1 5/1 0/1 4/1 -1/1 1/1 2/1 2/1 -1/1 3/1 2/1 2/1 -1/1 3/1 2/1 4/1 -1/1 5/1 2/1 4/1 +0 2 1 1 +0 2 1 3 +1 3 0 4 +1 5 0 4 +1 1 2 2 +1 3 2 2 +1 3 2 4 +1 5 2 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test28.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test28.txt index ed905e724c2..d945734fca4 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test28.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test28.txt @@ -10,35 +10,35 @@ 2 1 3 0 2 -1 3 0 10 -0/1 -1/1 -1/1 0/1 --1/1 0/1 0/1 1/1 -0/1 -1/1 1/1 0/1 -1/1 0/1 0/1 1/1 -0/1 1/1 1/1 2/1 -1/1 0/1 2/1 -1/1 -1/1 0/1 2/1 1/1 -2/1 1/1 1/1 2/1 -2/1 -1/1 3/1 0/1 -2/1 1/1 3/1 0/1 +0 -1 -1 0 +-1 0 0 1 +0 -1 1 0 +1 0 0 1 +0 1 1 2 +1 0 2 -1 +1 0 2 1 +2 1 1 2 +2 -1 3 0 +2 1 3 0 8 --1/1 0/1 -0/1 -1/1 -0/1 1/1 -1/1 0/1 -1/1 2/1 -2/1 -1/1 -2/1 1/1 -3/1 0/1 +-1 0 +0 -1 +0 1 +1 0 +1 2 +2 -1 +2 1 +3 0 0 -4 +# No. of faces: 4 10 -0/1 -1/1 -1/1 0/1 --1/1 0/1 0/1 1/1 -0/1 -1/1 1/1 0/1 -1/1 0/1 0/1 1/1 -0/1 1/1 1/1 2/1 -1/1 0/1 2/1 -1/1 -1/1 0/1 2/1 1/1 -2/1 1/1 1/1 2/1 -2/1 -1/1 3/1 0/1 -2/1 1/1 3/1 0/1 +0 -1 -1 0 +-1 0 0 1 +0 -1 1 0 +1 0 0 1 +0 1 1 2 +1 0 2 -1 +1 0 2 1 +2 1 1 2 +2 -1 3 0 +2 1 3 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test29.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test29.txt index 37aca71a59c..44a64a0247f 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test29.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test29.txt @@ -3,24 +3,24 @@ 0 0 4 4 2 2 5 2 5 -0/1 0/1 2/1 2/1 -0/1 4/1 2/1 2/1 -2/1 2/1 4/1 0/1 -2/1 2/1 4/1 4/1 -2/1 2/1 5/1 2/1 +0 0 2 2 +0 4 2 2 +2 2 4 0 +2 2 4 4 +2 2 5 2 6 -0/1 0/1 -0/1 4/1 -2/1 2/1 -4/1 0/1 -4/1 4/1 -5/1 2/1 -1 -2/1 2/1 +0 0 +0 4 +2 2 +4 0 +4 4 +5 2 1 +2 2 +# No. of faces: 1 5 -0/1 0/1 2/1 2/1 -0/1 4/1 2/1 2/1 -2/1 2/1 4/1 0/1 -2/1 2/1 4/1 4/1 -2/1 2/1 5/1 2/1 +0 0 2 2 +0 4 2 2 +2 2 4 0 +2 2 4 4 +2 2 5 2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test30.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test30.txt index e6a784c9d3d..93f5204f262 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test30.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test30.txt @@ -2,21 +2,21 @@ 0 0 5 0 2 -2 2 3 4 -2/1 -2/1 50/25 0/25 -0/1 0/1 50/25 0/25 -50/25 0/25 2/1 3/1 -50/25 0/25 5/1 0/1 +2 -2 2 0 +0 0 2 0 +2 0 2 3 +2 0 5 0 5 -0/1 0/1 -2/1 -2/1 -50/25 0/25 -2/1 3/1 -5/1 0/1 -1 -50/25 0/25 +0 0 +2 -2 +2 0 +2 3 +5 0 1 +2 0 +# No. of faces: 1 4 -2/1 -2/1 50/25 0/25 -0/1 0/1 50/25 0/25 -50/25 0/25 2/1 3/1 -50/25 0/25 5/1 0/1 +2 -2 2 0 +0 0 2 0 +2 0 2 3 +2 0 5 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test31.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test31.txt index 3185f80ec7b..42f4208cf9a 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test31.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test31.txt @@ -3,31 +3,31 @@ 0 0 5 0 2 4 2 -2 7 -60/30 0/30 2/1 -2/1 -0/1 0/1 60/30 0/30 -24/12 24/12 60/30 0/30 -1/1 2/1 24/12 24/12 -2/1 4/1 24/12 24/12 -24/12 24/12 3/1 2/1 -60/30 0/30 5/1 0/1 +2 0 2 -2 +0 0 2 0 +2 2 2 0 +1 2 2 2 +2 4 2 2 +2 2 3 2 +2 0 5 0 8 -0/1 0/1 -1/1 2/1 -2/1 -2/1 -60/30 0/30 -24/12 24/12 -2/1 4/1 -3/1 2/1 -5/1 0/1 +0 0 +1 2 +2 -2 +2 0 +2 2 +2 4 +3 2 +5 0 2 -60/30 0/30 -24/12 24/12 -1 +2 0 +2 2 +# No. of faces: 1 7 -60/30 0/30 2/1 -2/1 -0/1 0/1 60/30 0/30 -24/12 24/12 60/30 0/30 -1/1 2/1 24/12 24/12 -2/1 4/1 24/12 24/12 -24/12 24/12 3/1 2/1 -60/30 0/30 5/1 0/1 +2 0 2 -2 +0 0 2 0 +2 2 2 0 +1 2 2 2 +2 4 2 2 +2 2 3 2 +2 0 5 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test32.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test32.txt index 830d83f2e59..822e3789c28 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test32.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test32.txt @@ -3,31 +3,31 @@ 0 0 5 0 2 -2 2 4 7 -2/1 -2/1 2/1 0/1 -0/1 0/1 2/1 0/1 -2/1 0/1 2/1 2/1 -1/1 2/1 2/1 2/1 -2/1 2/1 2/1 4/1 -2/1 2/1 3/1 2/1 -2/1 0/1 5/1 0/1 +2 -2 2 0 +0 0 2 0 +2 0 2 2 +1 2 2 2 +2 2 2 4 +2 2 3 2 +2 0 5 0 8 -0/1 0/1 -1/1 2/1 -2/1 -2/1 -60/30 0/30 -24/12 24/12 -2/1 4/1 -3/1 2/1 -5/1 0/1 +0 0 +1 2 +2 -2 +2 0 +2 2 +2 4 +3 2 +5 0 2 -60/30 0/30 -24/12 24/12 -1 +2 0 +2 2 +# No. of faces: 1 7 -2/1 -2/1 2/1 0/1 -0/1 0/1 2/1 0/1 -2/1 0/1 2/1 2/1 -1/1 2/1 2/1 2/1 -2/1 2/1 2/1 4/1 -2/1 2/1 3/1 2/1 -2/1 0/1 5/1 0/1 +2 -2 2 0 +0 0 2 0 +2 0 2 2 +1 2 2 2 +2 2 2 4 +2 2 3 2 +2 0 5 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test33.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test33.txt index 52b22ae49a6..6db47eaf9ed 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test33.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test33.txt @@ -2,15 +2,15 @@ 1 5 1 2 0 0 3 2 2 -1/1 5/1 1/1 2/1 -0/1 0/1 3/1 2/1 +1 5 1 2 +0 0 3 2 4 -0/1 0/1 -1/1 2/1 -1/1 5/1 -3/1 2/1 +0 0 +1 2 +1 5 +3 2 0 -1 +# No. of faces: 1 2 -1/1 5/1 1/1 2/1 -0/1 0/1 3/1 2/1 +1 5 1 2 +0 0 3 2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test34.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test34.txt index 9587d1b15dc..47ced43d85b 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test34.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test34.txt @@ -2,15 +2,15 @@ -1 2 1 4 0 0 0 2 2 -0/1 0/1 0/1 2/1 --1/1 2/1 1/1 4/1 +0 0 0 2 +-1 2 1 4 4 --1/1 2/1 -0/1 0/1 -0/1 2/1 -1/1 4/1 +-1 2 +0 0 +0 2 +1 4 0 -1 +# No. of faces: 1 2 -0/1 0/1 0/1 2/1 --1/1 2/1 1/1 4/1 +0 0 0 2 +-1 2 1 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test35.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test35.txt index 58b53d15991..c8a3dd025bc 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test35.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test35.txt @@ -5,39 +5,39 @@ 1 3 3 3 1 0 3 0 9 -2/1 3/1 2/1 2/1 -1/1 3/1 2/1 3/1 -2/1 4/1 2/1 3/1 -0/1 4/1 2/1 4/1 -2/1 6/1 2/1 4/1 -1/1 0/1 3/1 0/1 -2/1 3/1 3/1 3/1 -1/1 7/1 3/1 7/1 -2/1 4/1 4/1 4/1 +2 3 2 2 +1 3 2 3 +2 4 2 3 +0 4 2 4 +2 6 2 4 +1 0 3 0 +2 3 3 3 +1 7 3 7 +2 4 4 4 12 -0/1 4/1 -1/1 0/1 -1/1 3/1 -1/1 7/1 -2/1 2/1 -16/8 24/8 -32/16 64/16 -2/1 6/1 -3/1 0/1 -3/1 3/1 -3/1 7/1 -4/1 4/1 +0 4 +1 0 +1 3 +1 7 +2 2 +2 3 +2 4 +2 6 +3 0 +3 3 +3 7 +4 4 2 -16/8 24/8 -32/16 64/16 -1 +2 3 +2 4 +# No. of faces: 1 9 -2/1 3/1 2/1 2/1 -1/1 3/1 2/1 3/1 -2/1 4/1 2/1 3/1 -0/1 4/1 2/1 4/1 -2/1 6/1 2/1 4/1 -1/1 0/1 3/1 0/1 -2/1 3/1 3/1 3/1 -1/1 7/1 3/1 7/1 -2/1 4/1 4/1 4/1 +2 3 2 2 +1 3 2 3 +2 4 2 3 +0 4 2 4 +2 6 2 4 +1 0 3 0 +2 3 3 3 +1 7 3 7 +2 4 4 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test36.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test36.txt index 2c4c5a96f29..03fbb7e16ea 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test36.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test36.txt @@ -4,43 +4,43 @@ 0 4 4 2 1 2 4 5 11 -2/1 0/1 2/1 3/1 -1/1 2/1 2/1 3/1 -0/1 4/1 2/1 3/1 -2/1 3/1 2/1 6/1 -1/1 7/1 2/1 6/1 -2/1 6/1 2/1 9/1 -2/1 3/1 7/2 9/2 -2/1 6/1 7/2 9/2 -2/1 3/1 4/1 2/1 -7/2 9/2 4/1 5/1 -7/2 9/2 5/1 3/1 +2 0 2 3 +1 2 2 3 +0 4 2 3 +2 3 2 6 +1 7 2 6 +2 6 2 9 +2 3 7/2 9/2 +2 6 7/2 9/2 +2 3 4 2 +7/2 9/2 4 5 +7/2 9/2 5 3 11 -0/1 4/1 -1/1 2/1 -1/1 7/1 -2/1 0/1 -36/18 54/18 +0 4 +1 2 +1 7 +2 0 +2 3 72/36 216/36 -2/1 9/1 +2 9 84/24 108/24 -4/1 2/1 -4/1 5/1 -5/1 3/1 +4 2 +4 5 +5 3 3 -36/18 54/18 +2 3 72/36 216/36 84/24 108/24 -2 +# No. of faces: 2 11 -2/1 0/1 2/1 3/1 -1/1 2/1 2/1 3/1 -0/1 4/1 2/1 3/1 -2/1 3/1 2/1 6/1 -1/1 7/1 2/1 6/1 -2/1 6/1 2/1 9/1 -2/1 3/1 7/2 9/2 -2/1 6/1 7/2 9/2 -2/1 3/1 4/1 2/1 -7/2 9/2 4/1 5/1 -7/2 9/2 5/1 3/1 +2 0 2 3 +1 2 2 3 +0 4 2 3 +2 3 2 6 +1 7 2 6 +2 6 2 9 +2 3 7/2 9/2 +2 6 7/2 9/2 +2 3 4 2 +7/2 9/2 4 5 +7/2 9/2 5 3 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test37.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test37.txt index bf946526e36..2c10412d83b 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test37.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test37.txt @@ -5,51 +5,51 @@ -2 4 1 6 -1 6 -1 1 13 --1/1 6/5 -1/1 1/1 --3/1 2/1 -1/1 6/5 --1/1 14/3 -1/1 6/5 --2/1 4/1 -1/1 14/3 --1/1 6/1 -1/1 14/3 -0/1 0/1 0/1 4/5 --1/1 6/5 0/1 4/5 -0/1 4/5 0/1 3/1 -0/1 4/1 0/1 16/3 --1/1 14/3 0/1 16/3 -0/1 16/3 0/1 6/1 -0/1 16/3 1/1 6/1 -0/1 4/5 2/1 0/1 +-1 6/5 -1 1 +-3 2 -1 6/5 +-1 14/3 -1 6/5 +-2 4 -1 14/3 +-1 6 -1 14/3 +0 0 0 4/5 +-1 6/5 0 4/5 +0 4/5 0 3 +0 4 0 16/3 +-1 14/3 0 16/3 +0 16/3 0 6 +0 16/3 1 6 +0 4/5 2 0 14 --3/1 2/1 --2/1 4/1 --1/1 1/1 +-3 2 +-2 4 +-1 1 -25/25 30/25 --15/15 70/15 --1/1 6/1 -0/1 0/1 -0/15 12/15 -0/1 3/1 -0/1 4/1 -0/6 32/6 -0/1 6/1 -1/1 6/1 -2/1 0/1 +-1 70/15 +-1 6 +0 0 +0 12/15 +0 3 +0 4 +0 32/6 +0 6 +1 6 +2 0 4 -25/25 30/25 --15/15 70/15 -0/15 12/15 -0/6 32/6 -1 +-1 70/15 +0 12/15 +0 32/6 +# No. of faces: 1 13 --1/1 6/5 -1/1 1/1 --3/1 2/1 -1/1 6/5 --1/1 14/3 -1/1 6/5 --2/1 4/1 -1/1 14/3 --1/1 6/1 -1/1 14/3 -0/1 0/1 0/1 4/5 --1/1 6/5 0/1 4/5 -0/1 4/5 0/1 3/1 -0/1 4/1 0/1 16/3 --1/1 14/3 0/1 16/3 -0/1 16/3 0/1 6/1 -0/1 16/3 1/1 6/1 -0/1 4/5 2/1 0/1 +-1 6/5 -1 1 +-3 2 -1 6/5 +-1 14/3 -1 6/5 +-2 4 -1 14/3 +-1 6 -1 14/3 +0 0 0 4/5 +-1 6/5 0 4/5 +0 4/5 0 3 +0 4 0 16/3 +-1 14/3 0 16/3 +0 16/3 0 6 +0 16/3 1 6 +0 4/5 2 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test40.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test40.txt index beea62f7afb..2cb778d38b7 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test40.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test40.txt @@ -2,18 +2,18 @@ 0 0 0 6 0 3 3 3 3 -0/1 0/1 0/1 3/1 -0/1 3/1 0/1 6/1 -0/1 3/1 3/1 3/1 +0 0 0 3 +0 3 0 6 +0 3 3 3 4 -0/1 0/1 -0/1 3/1 -0/1 6/1 -3/1 3/1 -1 -0/1 3/1 +0 0 +0 3 +0 6 +3 3 1 +0 3 +# No. of faces: 1 3 -0/1 0/1 0/1 3/1 -0/1 3/1 0/1 6/1 -0/1 3/1 3/1 3/1 +0 0 0 3 +0 3 0 6 +0 3 3 3 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test41.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test41.txt index 3651988bd29..f9cefcc2116 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test41.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test41.txt @@ -2,18 +2,18 @@ -3 3 0 3 0 0 0 6 3 -0/1 0/1 0/1 3/1 --3/1 3/1 0/1 3/1 -0/1 3/1 0/1 6/1 +0 0 0 3 +-3 3 0 3 +0 3 0 6 4 --3/1 3/1 -0/1 0/1 -0/1 3/1 -0/1 6/1 -1 -0/1 3/1 +-3 3 +0 0 +0 3 +0 6 1 +0 3 +# No. of faces: 1 3 -0/1 0/1 0/1 3/1 --3/1 3/1 0/1 3/1 -0/1 3/1 0/1 6/1 +0 0 0 3 +-3 3 0 3 +0 3 0 6 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test42.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test42.txt index b83c0b96d1c..4cfeb604b7f 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test42.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test42.txt @@ -3,21 +3,21 @@ -2 2 0 2 0 2 2 2 4 -0/1 0/1 0/1 2/1 --2/1 2/1 0/1 2/1 -0/1 2/1 0/1 4/1 -0/1 2/1 2/1 2/1 +0 0 0 2 +-2 2 0 2 +0 2 0 4 +0 2 2 2 5 --2/1 2/1 -0/1 0/1 -0/1 2/1 -0/1 4/1 -2/1 2/1 -1 -0/1 2/1 +-2 2 +0 0 +0 2 +0 4 +2 2 1 +0 2 +# No. of faces: 1 4 -0/1 0/1 0/1 2/1 --2/1 2/1 0/1 2/1 -0/1 2/1 0/1 4/1 -0/1 2/1 2/1 2/1 +0 0 0 2 +-2 2 0 2 +0 2 0 4 +0 2 2 2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test43.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test43.txt index a78d9c4bdea..90afe463752 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test43.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test43.txt @@ -2,14 +2,14 @@ 0 5 4 5 4 5 4 1 2 -4/1 5/1 4/1 1/1 -0/1 5/1 4/1 5/1 +4 5 4 1 +0 5 4 5 3 -0/1 5/1 -4/1 1/1 -4/1 5/1 +0 5 +4 1 +4 5 0 -1 +# No. of faces: 1 2 -4/1 5/1 4/1 1/1 -0/1 5/1 4/1 5/1 +4 5 4 1 +0 5 4 5 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test44.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test44.txt index 0aff3e7b181..19a28bae19d 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test44.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test44.txt @@ -4,20 +4,19 @@ 0 0 4 0 0 4 0 0 4 -0/1 4/1 0/1 0/1 -0/1 0/1 4/1 0/1 -4/1 4/1 4/1 0/1 -0/1 4/1 4/1 4/1 +0 4 0 0 +0 0 4 0 +4 4 4 0 +0 4 4 4 4 -0/1 0/1 -0/1 4/1 -4/1 0/1 -4/1 4/1 +0 0 +0 4 +4 0 +4 4 0 -2 +# No. of faces: 2 4 -0/1 4/1 0/1 0/1 -0/1 0/1 4/1 0/1 -4/1 4/1 4/1 0/1 -0/1 4/1 4/1 4/1 - +0 4 0 0 +0 0 4 0 +4 4 4 0 +0 4 4 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test45.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test45.txt index 431f41756eb..24188d25fa0 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test45.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test45.txt @@ -2,14 +2,14 @@ 0 0 4 0 0 4 0 0 2 -0/1 4/1 0/1 0/1 -0/1 0/1 4/1 0/1 +0 4 0 0 +0 0 4 0 3 -0/1 0/1 -0/1 4/1 -4/1 0/1 +0 0 +0 4 +4 0 0 -1 +# No. of faces: 1 2 -0/1 4/1 0/1 0/1 -0/1 0/1 4/1 0/1 +0 4 0 0 +0 0 4 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test46.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test46.txt index ed0e785f55b..512151f3428 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test46.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test46.txt @@ -3,19 +3,19 @@ 2 5 2 2 2 1 4 1 3 -2/1 5/1 2/1 2/1 -0/1 6/1 2/1 6/1 -2/1 1/1 4/1 1/1 +2 5 2 2 +0 6 2 6 +2 1 4 1 6 -0/1 6/1 -2/1 1/1 -2/1 2/1 -2/1 5/1 -2/1 6/1 -4/1 1/1 +0 6 +2 1 +2 2 +2 5 +2 6 +4 1 0 -1 +# No. of faces: 1 3 -2/1 5/1 2/1 2/1 -0/1 6/1 2/1 6/1 -2/1 1/1 4/1 1/1 +2 5 2 2 +0 6 2 6 +2 1 4 1 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test47.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test47.txt index 5861e7d3583..1624ab36537 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test47.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test47.txt @@ -2,18 +2,18 @@ 2 0 2 3 4 0 0 0 3 -2/1 0/1 0/1 0/1 -2/1 0/1 2/1 3/1 -4/1 0/1 2/1 0/1 +2 0 0 0 +2 0 2 3 +4 0 2 0 4 -0/1 0/1 -2/1 0/1 -2/1 3/1 -4/1 0/1 -1 -2/1 0/1 +0 0 +2 0 +2 3 +4 0 1 +2 0 +# No. of faces: 1 3 -2/1 0/1 0/1 0/1 -2/1 0/1 2/1 3/1 -4/1 0/1 2/1 0/1 +2 0 0 0 +2 0 2 3 +4 0 2 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test48.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test48.txt index 8546ccf6f28..9884d9b633f 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test48.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test48.txt @@ -4,29 +4,29 @@ 7 3 12 3 9 3 9 0 6 -0/1 0/1 2/1 0/1 -2/1 3/1 2/1 0/1 -2/1 0/1 5/1 0/1 -9/1 3/1 9/1 0/1 -7/1 3/1 9/1 3/1 -9/1 3/1 12/1 3/1 +0 0 2 0 +2 3 2 0 +2 0 5 0 +9 3 9 0 +7 3 9 3 +9 3 12 3 8 -0/1 0/1 -2/1 0/1 -2/1 3/1 -5/1 0/1 -7/1 3/1 -9/1 0/1 -9/1 3/1 -12/1 3/1 +0 0 +2 0 +2 3 +5 0 +7 3 +9 0 +9 3 +12 3 2 -2/1 0/1 -9/1 3/1 -1 +2 0 +9 3 +# No. of faces: 1 6 -0/1 0/1 2/1 0/1 -2/1 3/1 2/1 0/1 -2/1 0/1 5/1 0/1 -9/1 3/1 9/1 0/1 -7/1 3/1 9/1 3/1 -9/1 3/1 12/1 3/1 +0 0 2 0 +2 3 2 0 +2 0 5 0 +9 3 9 0 +7 3 9 3 +9 3 12 3 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test49.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test49.txt index 38fdef6d37b..937d78e447e 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test49.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test49.txt @@ -2,14 +2,14 @@ 0 0 4 0 4 0 4 4 2 -0/1 0/1 4/1 0/1 -4/1 0/1 4/1 4/1 +0 0 4 0 +4 0 4 4 3 -0/1 0/1 -4/1 0/1 -4/1 4/1 +0 0 +4 0 +4 4 0 -1 +# No. of faces: 1 2 -0/1 0/1 4/1 0/1 -4/1 0/1 4/1 4/1 +0 0 4 0 +4 0 4 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test50.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test50.txt index 47db121f373..11d3fd8a787 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test50.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test50.txt @@ -5,27 +5,27 @@ 8 6 9 7 8 6 9 5 6 -5/1 5/1 8/1 5/1 -8/1 6/1 8/1 5/1 -8/1 7/1 8/1 6/1 -4/1 7/1 8/1 7/1 -8/1 6/1 9/1 5/1 -8/1 6/1 9/1 7/1 +5 5 8 5 +8 6 8 5 +8 7 8 6 +4 7 8 7 +8 6 9 5 +8 6 9 7 7 -4/1 7/1 -5/1 5/1 -8/1 5/1 -8/1 6/1 -8/1 7/1 -9/1 5/1 -9/1 7/1 -1 -8/1 6/1 +4 7 +5 5 +8 5 +8 6 +8 7 +9 5 +9 7 1 +8 6 +# No. of faces: 1 6 -5/1 5/1 8/1 5/1 -8/1 6/1 8/1 5/1 -8/1 7/1 8/1 6/1 -4/1 7/1 8/1 7/1 -8/1 6/1 9/1 5/1 -8/1 6/1 9/1 7/1 +5 5 8 5 +8 6 8 5 +8 7 8 6 +4 7 8 7 +8 6 9 5 +8 6 9 7 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test51.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test51.txt index cf9cd7243ce..0acf5053818 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test51.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test51.txt @@ -16,103 +16,103 @@ 2 0 6 4 2 10 6 8 30 -2/1 3/1 2/1 0/1 -0/1 1/1 2/1 3/1 -2/1 4/1 2/1 3/1 -2/1 4/1 0/1 3/1 -0/1 6/1 2/1 6/1 -2/1 6/1 2/1 8/1 -1/1 7/1 2/1 8/1 -0/1 8/1 2/1 8/1 -2/1 8/1 2/1 10/1 -2/1 3/1 3/1 4/1 -2/1 8/1 10/3 28/3 -2/1 10/1 10/3 28/3 -2/1 3/1 4/1 3/1 -10/3 28/3 4/1 10/1 -2/1 0/1 6/1 4/1 -6/1 5/1 6/1 4/1 -6/1 5/1 5/1 5/1 -6/1 6/1 6/1 5/1 -6/1 6/1 2/1 4/1 -2/1 6/1 6/1 6/1 -6/1 7/1 6/1 6/1 -4/1 7/1 6/1 7/1 -6/1 8/1 6/1 7/1 -10/3 28/3 6/1 8/1 -8/1 5/1 6/1 5/1 -8/1 6/1 8/1 5/1 -8/1 7/1 8/1 6/1 -6/1 7/1 8/1 7/1 -9/1 5/1 8/1 6/1 -9/1 7/1 8/1 6/1 +2 3 2 0 +0 1 2 3 +2 4 2 3 +2 4 0 3 +0 6 2 6 +2 6 2 8 +1 7 2 8 +0 8 2 8 +2 8 2 10 +2 3 3 4 +2 8 10/3 28/3 +2 10 10/3 28/3 +2 3 4 3 +10/3 28/3 4 10 +2 0 6 4 +6 5 6 4 +6 5 5 5 +6 6 6 5 +6 6 2 4 +2 6 6 6 +6 7 6 6 +4 7 6 7 +6 8 6 7 +10/3 28/3 6 8 +8 5 6 5 +8 6 8 5 +8 7 8 6 +6 7 8 7 +9 5 8 6 +9 7 8 6 27 -0/1 1/1 -0/1 3/1 -0/1 6/1 -0/1 8/1 -1/1 7/1 -2/1 0/1 -2/1 3/1 -2/1 4/1 -2/1 6/1 -2/1 8/1 -2/1 10/1 -3/1 4/1 +0 1 +0 3 +0 6 +0 8 +1 7 +2 0 +2 3 +2 4 +2 6 +2 8 +2 10 +3 4 60/18 168/18 -4/1 3/1 -4/1 7/1 -4/1 10/1 -5/1 5/1 -6/1 4/1 -72/12 60/12 -6/1 6/1 -96/16 112/16 -6/1 8/1 -8/1 5/1 -8/1 6/1 -8/1 7/1 -9/1 5/1 -9/1 7/1 +4 3 +4 7 +4 10 +5 5 +6 4 +6 5 +6 6 +6 7 +6 8 +8 5 +8 6 +8 7 +9 5 +9 7 9 -2/1 3/1 -2/1 4/1 -2/1 6/1 -2/1 8/1 +2 3 +2 4 +2 6 +2 8 60/18 168/18 -72/12 60/12 -6/1 6/1 -96/16 112/16 -8/1 6/1 -5 +6 5 +6 6 +6 7 +8 6 +# No. of faces: 5 30 -2/1 3/1 2/1 0/1 -0/1 1/1 2/1 3/1 -2/1 4/1 2/1 3/1 -2/1 4/1 0/1 3/1 -0/1 6/1 2/1 6/1 -2/1 6/1 2/1 8/1 -1/1 7/1 2/1 8/1 -0/1 8/1 2/1 8/1 -2/1 8/1 2/1 10/1 -2/1 3/1 3/1 4/1 -2/1 8/1 10/3 28/3 -2/1 10/1 10/3 28/3 -2/1 3/1 4/1 3/1 -10/3 28/3 4/1 10/1 -2/1 0/1 6/1 4/1 -6/1 5/1 6/1 4/1 -6/1 5/1 5/1 5/1 -6/1 6/1 6/1 5/1 -6/1 6/1 2/1 4/1 -2/1 6/1 6/1 6/1 -6/1 7/1 6/1 6/1 -4/1 7/1 6/1 7/1 -6/1 8/1 6/1 7/1 -10/3 28/3 6/1 8/1 -8/1 5/1 6/1 5/1 -8/1 6/1 8/1 5/1 -8/1 7/1 8/1 6/1 -6/1 7/1 8/1 7/1 -9/1 5/1 8/1 6/1 -9/1 7/1 8/1 6/1 +2 3 2 0 +0 1 2 3 +2 4 2 3 +2 4 0 3 +0 6 2 6 +2 6 2 8 +1 7 2 8 +0 8 2 8 +2 8 2 10 +2 3 3 4 +2 8 10/3 28/3 +2 10 10/3 28/3 +2 3 4 3 +10/3 28/3 4 10 +2 0 6 4 +6 5 6 4 +6 5 5 5 +6 6 6 5 +6 6 2 4 +2 6 6 6 +6 7 6 6 +4 7 6 7 +6 8 6 7 +10/3 28/3 6 8 +8 5 6 5 +8 6 8 5 +8 7 8 6 +6 7 8 7 +9 5 8 6 +9 7 8 6 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test52.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test52.txt index 519eff3c8c9..e54693b507c 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test52.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test52.txt @@ -3,27 +3,27 @@ 0 0 4 4 2 5 2 -1 6 -2/1 2/1 2/1 -1/1 -0/1 0/1 2/1 2/1 -0/1 4/1 2/1 2/1 -2/1 5/1 2/1 2/1 -2/1 2/1 4/1 0/1 -2/1 2/1 4/1 4/1 +2 2 2 -1 +0 0 2 2 +0 4 2 2 +2 5 2 2 +2 2 4 0 +2 2 4 4 7 -0/1 0/1 -0/1 4/1 -2/1 -1/1 +0 0 +0 4 +2 -1 64/32 64/32 -2/1 5/1 -4/1 0/1 -4/1 4/1 +2 5 +4 0 +4 4 1 64/32 64/32 -1 +# No. of faces: 1 6 -2/1 2/1 2/1 -1/1 -0/1 0/1 2/1 2/1 -0/1 4/1 2/1 2/1 -2/1 5/1 2/1 2/1 -2/1 2/1 4/1 0/1 -2/1 2/1 4/1 4/1 +2 2 2 -1 +0 0 2 2 +0 4 2 2 +2 5 2 2 +2 2 4 0 +2 2 4 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test53.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test53.txt index 79d17493558..03bc28fe6ca 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test53.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test53.txt @@ -3,18 +3,17 @@ 0 3 0 2 0 2 0 0 3 -0/1 2/1 0/1 0/1 -0/1 3/1 0/1 2/1 -0/1 5/1 0/1 3/1 +0 2 0 0 +0 3 0 2 +0 5 0 3 4 -0/1 0/1 -0/1 2/1 -0/1 3/1 -0/1 5/1 +0 0 +0 2 +0 3 +0 5 0 -1 +# No. of faces: 1 3 -0/1 2/1 0/1 0/1 -0/1 3/1 0/1 2/1 -0/1 5/1 0/1 3/1 - +0 2 0 0 +0 3 0 2 +0 5 0 3 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test54.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test54.txt index ce10a30cb75..75d46976285 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test54.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test54.txt @@ -3,21 +3,21 @@ 8 6 9 7 8 6 9 5 4 -8/1 6/1 8/1 5/1 -8/1 7/1 8/1 6/1 -8/1 6/1 9/1 5/1 -8/1 6/1 9/1 7/1 +8 6 8 5 +8 7 8 6 +8 6 9 5 +8 6 9 7 5 -8/1 5/1 -8/1 6/1 -8/1 7/1 -9/1 5/1 -9/1 7/1 -1 -8/1 6/1 +8 5 +8 6 +8 7 +9 5 +9 7 1 +8 6 +# No. of faces: 1 4 -8/1 6/1 8/1 5/1 -8/1 7/1 8/1 6/1 -8/1 6/1 9/1 5/1 -8/1 6/1 9/1 7/1 +8 6 8 5 +8 7 8 6 +8 6 9 5 +8 6 9 7 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test55.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test55.txt index 1065362fc19..f2f078a9329 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test55.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test55.txt @@ -3,26 +3,25 @@ 0 1 2 1 2 0 2 2 5 -0/1 0/1 0/1 1/1 -0/1 1/1 0/1 2/1 -2/1 0/1 2/1 1/1 -0/1 1/1 2/1 1/1 -2/1 1/1 2/1 2/1 +0 0 0 1 +0 1 0 2 +2 0 2 1 +0 1 2 1 +2 1 2 2 6 -0/1 0/1 -0/1 1/1 -0/1 2/1 -2/1 0/1 -2/1 1/1 -2/1 2/1 +0 0 +0 1 +0 2 +2 0 +2 1 +2 2 2 -0/1 1/1 -2/1 1/1 -1 +0 1 +2 1 +# No. of faces: 1 5 -0/1 0/1 0/1 1/1 -0/1 1/1 0/1 2/1 -2/1 0/1 2/1 1/1 -0/1 1/1 2/1 1/1 -2/1 1/1 2/1 2/1 - +0 0 0 1 +0 1 0 2 +2 0 2 1 +0 1 2 1 +2 1 2 2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test56.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test56.txt index adc296648a4..bac5d28e69c 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test56.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test56.txt @@ -3,25 +3,24 @@ 0 1 6 5 3 3 7 3 5 -3/1 0/1 3/1 3/1 -0/1 1/1 3/1 3/1 -3/1 3/1 3/1 6/1 -3/1 3/1 6/1 5/1 -3/1 3/1 7/1 3/1 +3 0 3 3 +0 1 3 3 +3 3 3 6 +3 3 6 5 +3 3 7 3 6 -0/1 1/1 -3/1 0/1 -3/1 3/1 -3/1 6/1 -6/1 5/1 -7/1 3/1 -1 -3/1 3/1 +0 1 +3 0 +3 3 +3 6 +6 5 +7 3 1 +3 3 +# No. of faces: 1 5 -3/1 0/1 3/1 3/1 -0/1 1/1 3/1 3/1 -3/1 3/1 3/1 6/1 -3/1 3/1 6/1 5/1 -3/1 3/1 7/1 3/1 - +3 0 3 3 +0 1 3 3 +3 3 3 6 +3 3 6 5 +3 3 7 3 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test60.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test60.txt index 92beb4090a2..580ad875127 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test60.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test60.txt @@ -2,21 +2,20 @@ 0 0 4 0 3 0 7 0 3 -0/1 0/1 3/1 0/1 -3/1 0/1 4/1 0/1 -4/1 0/1 7/1 0/1 +0 0 3 0 +3 0 4 0 +4 0 7 0 4 -0/1 0/1 -3/1 0/1 -4/1 0/1 -7/1 0/1 +0 0 +3 0 +4 0 +7 0 2 -3/1 0/1 -4/1 0/1 -1 +3 0 +4 0 +# No. of faces: 1 4 -0/1 0/1 3/1 0/1 -3/1 0/1 4/1 0/1 -3/1 0/1 4/1 0/1 -4/1 0/1 7/1 0/1 - +0 0 3 0 +3 0 4 0 +3 0 4 0 +4 0 7 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test61.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test61.txt index 6db6035cbc7..56f8052dbd5 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test61.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test61.txt @@ -3,31 +3,31 @@ 0 0 4 0 2 0 8 0 5 -0/1 0/1 2/1 0/1 -2/1 0/1 3/1 0/1 -3/1 0/1 4/1 0/1 -4/1 0/1 6/1 0/1 -6/1 0/1 8/1 0/1 +0 0 2 0 +2 0 3 0 +3 0 4 0 +4 0 6 0 +6 0 8 0 6 -0/1 0/1 -2/1 0/1 -3/1 0/1 -4/1 0/1 -6/1 0/1 -8/1 0/1 +0 0 +2 0 +3 0 +4 0 +6 0 +8 0 4 -2/1 0/1 -3/1 0/1 -4/1 0/1 -6/1 0/1 -1 +2 0 +3 0 +4 0 +6 0 +# No. of faces: 1 9 -0/1 0/1 2/1 0/1 -2/1 0/1 3/1 0/1 -2/1 0/1 3/1 0/1 -3/1 0/1 4/1 0/1 -3/1 0/1 4/1 0/1 -3/1 0/1 4/1 0/1 -4/1 0/1 6/1 0/1 -4/1 0/1 6/1 0/1 -6/1 0/1 8/1 0/1 \ No newline at end of file +0 0 2 0 +2 0 3 0 +2 0 3 0 +3 0 4 0 +3 0 4 0 +3 0 4 0 +4 0 6 0 +4 0 6 0 +6 0 8 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test62.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test62.txt index ee6c49c399e..a975379f310 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test62.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test62.txt @@ -2,14 +2,12 @@ 0 0 3 0 0 0 3 0 1 -0/1 0/1 3/1 0/1 +0 0 3 0 2 -0/1 0/1 -3/1 0/1 +0 0 +3 0 0 -1 +# No. of faces: 1 2 -0/1 0/1 3/1 0/1 -0/1 0/1 3/1 0/1 - - +0 0 3 0 +0 0 3 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test63.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test63.txt index 8923f049d15..0bf64d49d7f 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test63.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test63.txt @@ -4,22 +4,22 @@ 0 0 5 0 2 0 3 0 3 -0/1 0/1 2/1 0/1 -2/1 0/1 3/1 0/1 -3/1 0/1 5/1 0/1 +0 0 2 0 +2 0 3 0 +3 0 5 0 4 -0/1 0/1 -2/1 0/1 -3/1 0/1 -5/1 0/1 +0 0 +2 0 +3 0 +5 0 2 -2/1 0/1 -3/1 0/1 -1 +2 0 +3 0 +# No. of faces: 1 6 -0/1 0/1 2/1 0/1 -0/1 0/1 2/1 0/1 -2/1 0/1 3/1 0/1 -2/1 0/1 3/1 0/1 -3/1 0/1 5/1 0/1 -3/1 0/1 5/1 0/1 +0 0 2 0 +0 0 2 0 +2 0 3 0 +2 0 3 0 +3 0 5 0 +3 0 5 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test64.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test64.txt index f2825be57f2..b27adefbb3b 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test64.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test64.txt @@ -3,13 +3,13 @@ 0 0 6 6 6 6 0 0 1 -0/1 0/1 6/1 6/1 +0 0 6 6 2 -0/1 0/1 -6/1 6/1 +0 0 +6 6 0 -1 +# No. of faces: 1 3 -0/1 0/1 6/1 6/1 -0/1 0/1 6/1 6/1 -6/1 6/1 0/1 0/1 +0 0 6 6 +0 0 6 6 +6 6 0 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test65.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test65.txt index e83cce072ae..d1ebcea2dc1 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test65.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test65.txt @@ -3,23 +3,23 @@ 0 0 4 4 0 4 4 0 4 -0/1 0/1 64/32 64/32 -0/1 4/1 64/32 64/32 -64/32 64/32 4/1 0/1 -64/32 64/32 4/1 4/1 +0 0 64/32 64/32 +0 4 64/32 64/32 +64/32 64/32 4 0 +64/32 64/32 4 4 5 -0/1 0/1 -0/1 4/1 +0 0 +0 4 64/32 64/32 -4/1 0/1 -4/1 4/1 +4 0 +4 4 1 64/32 64/32 -1 +# No. of faces: 1 6 -0/1 0/1 64/32 64/32 -0/1 0/1 64/32 64/32 -0/1 4/1 64/32 64/32 -64/32 64/32 4/1 0/1 -64/32 64/32 4/1 4/1 -64/32 64/32 4/1 4/1 +0 0 64/32 64/32 +0 0 64/32 64/32 +0 4 64/32 64/32 +64/32 64/32 4 0 +64/32 64/32 4 4 +64/32 64/32 4 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test66.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test66.txt index 7725cef46c2..420a030dada 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test66.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test66.txt @@ -4,25 +4,25 @@ 0 4 4 0 0 4 4 0 4 -0/1 0/1 64/32 64/32 -0/1 4/1 64/32 64/32 -64/32 64/32 4/1 0/1 -64/32 64/32 4/1 4/1 +0 0 64/32 64/32 +0 4 64/32 64/32 +64/32 64/32 4 0 +64/32 64/32 4 4 5 -0/1 0/1 -0/1 4/1 +0 0 +0 4 64/32 64/32 -4/1 0/1 -4/1 4/1 +4 0 +4 4 1 64/32 64/32 -1 +# No. of faces: 1 8 -0/1 0/1 64/32 64/32 -0/1 0/1 64/32 64/32 -0/1 4/1 64/32 64/32 -0/1 4/1 64/32 64/32 -64/32 64/32 4/1 0/1 -64/32 64/32 4/1 0/1 -64/32 64/32 4/1 4/1 -64/32 64/32 4/1 4/1 +0 0 64/32 64/32 +0 0 64/32 64/32 +0 4 64/32 64/32 +0 4 64/32 64/32 +64/32 64/32 4 0 +64/32 64/32 4 0 +64/32 64/32 4 4 +64/32 64/32 4 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test67.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test67.txt index b380b5e7cbd..cdd01dcd119 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test67.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test67.txt @@ -5,32 +5,31 @@ 0 4 4 0 -1 2 5 2 6 -0/1 0/1 48/24 48/24 --1/1 2/1 48/24 48/24 -0/1 4/1 48/24 48/24 -48/24 48/24 4/1 0/1 -48/24 48/24 4/1 4/1 -48/24 48/24 5/1 2/1 +0 0 48/24 48/24 +-1 2 48/24 48/24 +0 4 48/24 48/24 +48/24 48/24 4 0 +48/24 48/24 4 4 +48/24 48/24 5 2 7 --1/1 2/1 -0/1 0/1 -0/1 4/1 +-1 2 +0 0 +0 4 48/24 48/24 -4/1 0/1 -4/1 4/1 -5/1 2/1 +4 0 +4 4 +5 2 1 48/24 48/24 -1 +# No. of faces: 1 10 -0/1 0/1 48/24 48/24 -0/1 0/1 48/24 48/24 --1/1 2/1 48/24 48/24 -0/1 4/1 48/24 48/24 -0/1 4/1 48/24 48/24 -48/24 48/24 4/1 0/1 -48/24 48/24 4/1 0/1 -48/24 48/24 4/1 4/1 -48/24 48/24 4/1 4/1 -48/24 48/24 5/1 2/1 - +0 0 48/24 48/24 +0 0 48/24 48/24 +-1 2 48/24 48/24 +0 4 48/24 48/24 +0 4 48/24 48/24 +48/24 48/24 4 0 +48/24 48/24 4 0 +48/24 48/24 4 4 +48/24 48/24 4 4 +48/24 48/24 5 2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test68.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test68.txt index 54feabc43ba..4d739e20e78 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test68.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test68.txt @@ -6,43 +6,43 @@ -1 2 5 2 1 1 3 3 8 -0/1 0/1 1/1 1/1 -1/1 1/1 48/24 48/24 --1/1 2/1 48/24 48/24 -0/1 4/1 48/24 48/24 -48/24 48/24 3/1 3/1 -48/24 48/24 4/1 0/1 -3/1 3/1 4/1 4/1 -48/24 48/24 5/1 2/1 +0 0 1 1 +1 1 48/24 48/24 +-1 2 48/24 48/24 +0 4 48/24 48/24 +48/24 48/24 3 3 +48/24 48/24 4 0 +3 3 4 4 +48/24 48/24 5 2 9 --1/1 2/1 -0/1 0/1 -0/1 4/1 -1/1 1/1 +-1 2 +0 0 +0 4 +1 1 48/24 48/24 -3/1 3/1 -4/1 0/1 -4/1 4/1 -5/1 2/1 +3 3 +4 0 +4 4 +5 2 3 -1/1 1/1 +1 1 48/24 48/24 -3/1 3/1 -1 +3 3 +# No. of faces: 1 16 -0/1 0/1 1/1 1/1 -0/1 0/1 1/1 1/1 -1/1 1/1 48/24 48/24 -1/1 1/1 48/24 48/24 -1/1 1/1 48/24 48/24 --1/1 2/1 48/24 48/24 -0/1 4/1 48/24 48/24 -0/1 4/1 48/24 48/24 -48/24 48/24 3/1 3/1 -48/24 48/24 3/1 3/1 -48/24 48/24 3/1 3/1 -48/24 48/24 4/1 0/1 -48/24 48/24 4/1 0/1 -3/1 3/1 4/1 4/1 -3/1 3/1 4/1 4/1 -48/24 48/24 5/1 2/1 +0 0 1 1 +0 0 1 1 +1 1 48/24 48/24 +1 1 48/24 48/24 +1 1 48/24 48/24 +-1 2 48/24 48/24 +0 4 48/24 48/24 +0 4 48/24 48/24 +48/24 48/24 3 3 +48/24 48/24 3 3 +48/24 48/24 3 3 +48/24 48/24 4 0 +48/24 48/24 4 0 +3 3 4 4 +3 3 4 4 +48/24 48/24 5 2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test69.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test69.txt index cc0683ad7ad..c353837bfed 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test69.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test69.txt @@ -8,31 +8,30 @@ 1 1 2 1 2 1 1 1 7 -0/1 0/1 1/1 1/1 -1/1 1/1 0/1 1/1 -1/1 1/1 0/1 2/1 -1/1 1/1 2/1 1/1 -3/1 0/1 2/1 1/1 -2/1 1/1 3/1 1/1 -3/1 2/1 2/1 1/1 +0 0 1 1 +1 1 0 1 +1 1 0 2 +1 1 2 1 +3 0 2 1 +2 1 3 1 +3 2 2 1 8 -0/1 0/1 -0/1 1/1 -0/1 2/1 -1/1 1/1 -2/1 1/1 -3/1 0/1 -3/1 1/1 -3/1 2/1 +0 0 +0 1 +0 2 +1 1 +2 1 +3 0 +3 1 +3 2 0 -1 +# No. of faces: 1 8 -0/1 0/1 1/1 1/1 -1/1 1/1 0/1 1/1 -1/1 1/1 0/1 2/1 -1/1 1/1 2/1 1/1 -2/1 1/1 1/1 1/1 -3/1 0/1 2/1 1/1 -2/1 1/1 3/1 1/1 -3/1 2/1 2/1 1/1 - +0 0 1 1 +1 1 0 1 +1 1 0 2 +1 1 2 1 +2 1 1 1 +3 0 2 1 +2 1 3 1 +3 2 2 1 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test70.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test70.txt index c6b68c4163b..cfc1576cd41 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test70.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test70.txt @@ -5,37 +5,37 @@ 1 0 4 0 0 0 3 0 6 -0/1 0/1 1/1 0/1 -1/1 0/1 2/1 0/1 -2/1 0/1 3/1 0/1 -3/1 0/1 4/1 0/1 -4/1 0/1 5/1 0/1 -5/1 0/1 7/1 0/1 +0 0 1 0 +1 0 2 0 +2 0 3 0 +3 0 4 0 +4 0 5 0 +5 0 7 0 7 -0/1 0/1 -1/1 0/1 -2/1 0/1 -3/1 0/1 -4/1 0/1 -5/1 0/1 -7/1 0/1 +0 0 +1 0 +2 0 +3 0 +4 0 +5 0 +7 0 5 -1/1 0/1 -2/1 0/1 -3/1 0/1 -4/1 0/1 -5/1 0/1 -1 +1 0 +2 0 +3 0 +4 0 +5 0 +# No. of faces: 1 12 -0/1 0/1 1/1 0/1 -1/1 0/1 2/1 0/1 -1/1 0/1 2/1 0/1 -2/1 0/1 3/1 0/1 -2/1 0/1 3/1 0/1 -2/1 0/1 3/1 0/1 -3/1 0/1 4/1 0/1 -3/1 0/1 4/1 0/1 -3/1 0/1 4/1 0/1 -4/1 0/1 5/1 0/1 -4/1 0/1 5/1 0/1 -5/1 0/1 7/1 0/1 +0 0 1 0 +1 0 2 0 +1 0 2 0 +2 0 3 0 +2 0 3 0 +2 0 3 0 +3 0 4 0 +3 0 4 0 +3 0 4 0 +4 0 5 0 +4 0 5 0 +5 0 7 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test71.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test71.txt index 7ac58ab7917..726cdc2d9d4 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test71.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test71.txt @@ -3,27 +3,23 @@ 0 2 4 2 0 2 4 2 4 -2/1 2/1 2/1 0/1 -0/1 2/1 2/1 2/1 -2/1 4/1 2/1 2/1 -2/1 2/1 4/1 2/1 +2 2 2 0 +0 2 2 2 +2 4 2 2 +2 2 4 2 5 -0/1 2/1 -2/1 0/1 -32/16 32/16 -2/1 4/1 -4/1 2/1 -1 -32/16 32/16 +0 2 +2 0 +2 2 +2 4 +4 2 1 +2 2 +# No. of faces: 1 6 -2/1 2/1 2/1 0/1 -0/1 2/1 2/1 2/1 -0/1 2/1 2/1 2/1 -2/1 4/1 2/1 2/1 -2/1 2/1 4/1 2/1 -2/1 2/1 4/1 2/1 - - - - +2 2 2 0 +0 2 2 2 +0 2 2 2 +2 4 2 2 +2 2 4 2 +2 2 4 2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test72.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test72.txt index c231c7b4f77..212a77a0f3c 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test72.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test72.txt @@ -13,69 +13,69 @@ 10 0 14 4 10 0 14 4 15 --1/1 2/1 1/1 2/1 -0/1 0/1 64/32 64/32 -0/1 4/1 64/32 64/32 -64/32 64/32 4/1 0/1 -64/32 64/32 4/1 4/1 -4/1 2/1 6/1 2/1 -5/1 0/1 224/32 64/32 -5/1 4/1 224/32 64/32 -224/32 64/32 9/1 0/1 -224/32 64/32 9/1 4/1 -9/1 2/1 11/1 2/1 -10/1 0/1 384/32 64/32 -10/1 4/1 384/32 64/32 -384/32 64/32 14/1 0/1 -384/32 64/32 14/1 4/1 +-1 2 1 2 +0 0 64/32 64/32 +0 4 64/32 64/32 +64/32 64/32 4 0 +64/32 64/32 4 4 +4 2 6 2 +5 0 224/32 64/32 +5 4 224/32 64/32 +224/32 64/32 9 0 +224/32 64/32 9 4 +9 2 11 2 +10 0 384/32 64/32 +10 4 384/32 64/32 +384/32 64/32 14 0 +384/32 64/32 14 4 21 --1/1 2/1 -0/1 0/1 -0/1 4/1 -1/1 2/1 +-1 2 +0 0 +0 4 +1 2 64/32 64/32 -4/1 0/1 -4/1 2/1 -4/1 4/1 -5/1 0/1 -5/1 4/1 -6/1 2/1 +4 0 +4 2 +4 4 +5 0 +5 4 +6 2 224/32 64/32 -9/1 0/1 -9/1 2/1 -9/1 4/1 -10/1 0/1 -10/1 4/1 -11/1 2/1 +9 0 +9 2 +9 4 +10 0 +10 4 +11 2 384/32 64/32 -14/1 0/1 -14/1 4/1 +14 0 +14 4 3 64/32 64/32 224/32 64/32 384/32 64/32 -1 +# No. of faces: 1 23 --1/1 2/1 1/1 2/1 -0/1 0/1 64/32 64/32 -0/1 0/1 64/32 64/32 -0/1 4/1 64/32 64/32 -0/1 4/1 64/32 64/32 -64/32 64/32 4/1 0/1 -64/32 64/32 4/1 0/1 -64/32 64/32 4/1 4/1 -64/32 64/32 4/1 4/1 -4/1 2/1 6/1 2/1 -5/1 0/1 224/32 64/32 -5/1 4/1 224/32 64/32 -5/1 4/1 224/32 64/32 -224/32 64/32 9/1 0/1 -224/32 64/32 9/1 0/1 -224/32 64/32 9/1 4/1 -9/1 2/1 11/1 2/1 -10/1 0/1 384/32 64/32 -10/1 0/1 384/32 64/32 -10/1 4/1 384/32 64/32 -384/32 64/32 14/1 0/1 -384/32 64/32 14/1 4/1 -384/32 64/32 14/1 4/1 +-1 2 1 2 +0 0 64/32 64/32 +0 0 64/32 64/32 +0 4 64/32 64/32 +0 4 64/32 64/32 +64/32 64/32 4 0 +64/32 64/32 4 0 +64/32 64/32 4 4 +64/32 64/32 4 4 +4 2 6 2 +5 0 224/32 64/32 +5 4 224/32 64/32 +5 4 224/32 64/32 +224/32 64/32 9 0 +224/32 64/32 9 0 +224/32 64/32 9 4 +9 2 11 2 +10 0 384/32 64/32 +10 0 384/32 64/32 +10 4 384/32 64/32 +384/32 64/32 14 0 +384/32 64/32 14 4 +384/32 64/32 14 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test73.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test73.txt index 0a95db80fac..5e2b5aafab2 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test73.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test73.txt @@ -2,20 +2,20 @@ 3 0 3 4 3 2 3 7 3 -3/1 0/1 3/1 2/1 -3/1 2/1 3/1 4/1 -3/1 4/1 3/1 7/1 +3 0 3 2 +3 2 3 4 +3 4 3 7 4 -3/1 0/1 -3/1 2/1 -3/1 4/1 -3/1 7/1 +3 0 +3 2 +3 4 +3 7 2 -3/1 2/1 -3/1 4/1 -1 +3 2 +3 4 +# No. of faces: 1 4 -3/1 0/1 3/1 2/1 -3/1 2/1 3/1 4/1 -3/1 2/1 3/1 4/1 -3/1 4/1 3/1 7/1 +3 0 3 2 +3 2 3 4 +3 2 3 4 +3 4 3 7 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test74.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test74.txt index 4cc18dcb021..c48b428b791 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test74.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test74.txt @@ -3,31 +3,31 @@ 2 4 2 0 0 3 4 3 6 -2/1 2/1 2/1 0/1 -2/1 2/1 2/1 3/1 -0/1 3/1 2/1 3/1 -2/1 3/1 2/1 4/1 -2/1 7/1 2/1 4/1 -2/1 3/1 4/1 3/1 +2 2 2 0 +2 2 2 3 +0 3 2 3 +2 3 2 4 +2 7 2 4 +2 3 4 3 7 -0/1 3/1 -2/1 0/1 -2/1 2/1 -32/16 48/16 -2/1 4/1 -2/1 7/1 -4/1 3/1 +0 3 +2 0 +2 2 +2 3 +2 4 +2 7 +4 3 3 -2/1 2/1 -32/16 48/16 -2/1 4/1 -1 +2 2 +2 3 +2 4 +# No. of faces: 1 8 -2/1 2/1 2/1 0/1 -2/1 2/1 2/1 3/1 -2/1 2/1 2/1 3/1 -0/1 3/1 2/1 3/1 -2/1 3/1 2/1 4/1 -2/1 3/1 2/1 4/1 -2/1 7/1 2/1 4/1 -2/1 3/1 4/1 3/1 +2 2 2 0 +2 2 2 3 +2 2 2 3 +0 3 2 3 +2 3 2 4 +2 3 2 4 +2 7 2 4 +2 3 4 3 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test75.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test75.txt index 50fe97fa383..2b7af6f80e7 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test75.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test75.txt @@ -3,23 +3,23 @@ 2 4 2 0 0 2 4 2 4 -2/1 0/1 2/1 2/1 -0/1 2/1 2/1 2/1 -2/1 2/1 2/1 4/1 -2/1 2/1 4/1 2/1 +2 0 2 2 +0 2 2 2 +2 2 2 4 +2 2 4 2 5 -0/1 2/1 -2/1 0/1 -32/16 32/16 -2/1 4/1 -4/1 2/1 -1 -32/16 32/16 +0 2 +2 0 +2 2 +2 4 +4 2 1 +2 2 +# No. of faces: 1 6 -2/1 0/1 2/1 2/1 -2/1 0/1 2/1 2/1 -0/1 2/1 2/1 2/1 -2/1 2/1 2/1 4/1 -2/1 2/1 2/1 4/1 -2/1 2/1 4/1 2/1 +2 0 2 2 +2 0 2 2 +0 2 2 2 +2 2 2 4 +2 2 2 4 +2 2 4 2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test76.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test76.txt index e33576bb815..97bfc5d24fd 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test76.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test76.txt @@ -3,31 +3,31 @@ 4 4 4 0 0 2 6 2 7 -2/1 2/1 2/1 0/1 -0/1 2/1 2/1 2/1 -2/1 4/1 2/1 2/1 -4/1 2/1 4/1 0/1 -2/1 2/1 4/1 2/1 -4/1 4/1 4/1 2/1 -4/1 2/1 6/1 2/1 +2 2 2 0 +0 2 2 2 +2 4 2 2 +4 2 4 0 +2 2 4 2 +4 4 4 2 +4 2 6 2 8 -0/1 2/1 -2/1 0/1 +0 2 +2 0 48/24 48/24 -2/1 4/1 -4/1 0/1 +2 4 +4 0 96/24 48/24 -4/1 4/1 -6/1 2/1 +4 4 +6 2 2 48/24 48/24 96/24 48/24 -1 +# No. of faces: 1 7 -2/1 2/1 2/1 0/1 -0/1 2/1 2/1 2/1 -2/1 4/1 2/1 2/1 -4/1 2/1 4/1 0/1 -2/1 2/1 4/1 2/1 -4/1 4/1 4/1 2/1 -4/1 2/1 6/1 2/1 +2 2 2 0 +0 2 2 2 +2 4 2 2 +4 2 4 0 +2 2 4 2 +4 4 4 2 +4 2 6 2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test77.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test77.txt index 52ed98b070e..b3ec36e6744 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test77.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test77.txt @@ -2,17 +2,16 @@ 0 3 0 0 0 2 0 0 2 -0/1 2/1 0/1 0/1 -0/1 3/1 0/1 2/1 +0 2 0 0 +0 3 0 2 3 -0/1 0/1 -0/1 2/1 -0/1 3/1 -1 -0/1 2/1 +0 0 +0 2 +0 3 1 +0 2 +# No. of faces: 1 3 -0/1 2/1 0/1 0/1 -0/1 2/1 0/1 0/1 -0/1 3/1 0/1 2/1 - +0 2 0 0 +0 2 0 0 +0 3 0 2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test78.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test78.txt index 194577128a5..a91fe60a739 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test78.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test78.txt @@ -6,59 +6,59 @@ 0 3 5 3 0 1 5 1 14 -1/1 1/1 1/1 0/1 -0/1 1/1 1/1 1/1 -1/1 2/1 1/1 1/1 -1/1 2/1 1/1 3/1 -0/1 3/1 1/1 3/1 -1/1 3/1 1/1 5/1 -4/1 0/1 4/1 1/1 -1/1 1/1 4/1 1/1 -4/1 1/1 4/1 2/1 -4/1 2/1 4/1 3/1 -1/1 3/1 4/1 3/1 -4/1 3/1 4/1 4/1 -4/1 1/1 5/1 1/1 -4/1 3/1 5/1 3/1 +1 1 1 0 +0 1 1 1 +1 2 1 1 +1 2 1 3 +0 3 1 3 +1 3 1 5 +4 0 4 1 +1 1 4 1 +4 1 4 2 +4 2 4 3 +1 3 4 3 +4 3 4 4 +4 1 5 1 +4 3 5 3 14 -0/1 1/1 -0/1 3/1 -1/1 0/1 -25/25 25/25 -1/1 2/1 -25/25 75/25 -1/1 5/1 -4/1 0/1 -80/20 20/20 -4/1 2/1 -80/20 60/20 -4/1 4/1 -5/1 1/1 -5/1 3/1 +0 1 +0 3 +1 0 +1 1 +1 2 +1 3 +1 5 +4 0 +4 1 +4 2 +4 3 +4 4 +5 1 +5 3 6 -25/25 25/25 -1/1 2/1 -25/25 75/25 -80/20 20/20 -4/1 2/1 -80/20 60/20 -2 +1 1 +1 2 +1 3 +4 1 +4 2 +4 3 +# No. of faces: 2 18 -1/1 1/1 1/1 0/1 -0/1 1/1 1/1 1/1 -1/1 2/1 1/1 1/1 -1/1 2/1 1/1 3/1 -1/1 2/1 1/1 3/1 -0/1 3/1 1/1 3/1 -1/1 3/1 1/1 5/1 -1/1 3/1 1/1 5/1 -4/1 0/1 4/1 1/1 -1/1 1/1 4/1 1/1 -4/1 1/1 4/1 2/1 -4/1 2/1 4/1 3/1 -4/1 2/1 4/1 3/1 -1/1 3/1 4/1 3/1 -4/1 3/1 4/1 4/1 -4/1 3/1 4/1 4/1 -4/1 1/1 5/1 1/1 -4/1 3/1 5/1 3/1 +1 1 1 0 +0 1 1 1 +1 2 1 1 +1 2 1 3 +1 2 1 3 +0 3 1 3 +1 3 1 5 +1 3 1 5 +4 0 4 1 +1 1 4 1 +4 1 4 2 +4 2 4 3 +4 2 4 3 +1 3 4 3 +4 3 4 4 +4 3 4 4 +4 1 5 1 +4 3 5 3 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test79.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test79.txt index dc9b76b1284..9390c7cc608 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test79.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test79.txt @@ -4,31 +4,31 @@ 0 3 3 3 0 1 3 1 6 -0/1 1/1 0/1 0/1 -0/1 2/1 0/1 1/1 -0/1 2/1 0/1 3/1 -0/1 3/1 0/1 5/1 -0/1 1/1 3/1 1/1 -0/1 3/1 3/1 3/1 +0 1 0 0 +0 2 0 1 +0 2 0 3 +0 3 0 5 +0 1 3 1 +0 3 3 3 7 -0/1 0/1 -0/1 1/1 -0/1 2/1 -0/1 3/1 -0/1 5/1 -3/1 1/1 -3/1 3/1 +0 0 +0 1 +0 2 +0 3 +0 5 +3 1 +3 3 3 -0/1 1/1 -0/1 2/1 -0/1 3/1 -1 +0 1 +0 2 +0 3 +# No. of faces: 1 8 -0/1 1/1 0/1 0/1 -0/1 2/1 0/1 1/1 -0/1 2/1 0/1 3/1 -0/1 2/1 0/1 3/1 -0/1 3/1 0/1 5/1 -0/1 3/1 0/1 5/1 -0/1 1/1 3/1 1/1 -0/1 3/1 3/1 3/1 +0 1 0 0 +0 2 0 1 +0 2 0 3 +0 2 0 3 +0 3 0 5 +0 3 0 5 +0 1 3 1 +0 3 3 3 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test80.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test80.txt index 57300a903c3..3181a33c498 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test80.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test80.txt @@ -8,25 +8,23 @@ 0 4 0 0 0 4 0 0 4 -0/1 0/1 0/1 4/1 -0/1 0/1 4/1 0/1 -4/1 0/1 4/1 4/1 -0/1 4/1 4/1 4/1 +0 0 0 4 +0 0 4 0 +4 0 4 4 +0 4 4 4 4 -0/1 0/1 -0/1 4/1 -4/1 0/1 -4/1 4/1 +0 0 +0 4 +4 0 +4 4 0 -2 +# No. of faces: 2 8 -0/1 0/1 0/1 4/1 -0/1 0/1 0/1 4/1 -0/1 0/1 4/1 0/1 -0/1 0/1 4/1 0/1 -4/1 0/1 4/1 4/1 -4/1 0/1 4/1 4/1 -0/1 4/1 4/1 4/1 -0/1 4/1 4/1 4/1 - - +0 0 0 4 +0 0 0 4 +0 0 4 0 +0 0 4 0 +4 0 4 4 +4 0 4 4 +0 4 4 4 +0 4 4 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test81.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test81.txt index 4c27222b415..4f7bc3a18d5 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test81.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test81.txt @@ -6,45 +6,45 @@ 1 7 6 7 1 7 6 7 10 -0/1 2/1 144/72 288/72 -0/1 6/1 144/72 288/72 -1/1 1/1 150/30 30/30 -144/72 288/72 150/30 30/30 -144/72 288/72 150/30 210/30 -1/1 7/1 150/30 210/30 -150/30 30/30 6/1 0/1 -150/30 30/30 6/1 1/1 -150/30 210/30 6/1 7/1 -150/30 210/30 6/1 8/1 +0 2 2 4 +0 6 2 4 +1 1 5 1 +2 4 5 1 +2 4 5 7 +1 7 5 7 +5 1 6 0 +5 1 6 1 +5 7 6 7 +5 7 6 8 11 -0/1 2/1 -0/1 6/1 -1/1 1/1 -1/1 7/1 -144/72 288/72 -150/30 30/30 -150/30 210/30 -6/1 0/1 -6/1 1/1 -6/1 7/1 -6/1 8/1 +0 2 +0 6 +1 1 +1 7 +2 4 +5 1 +5 7 +6 0 +6 1 +6 7 +6 8 3 -144/72 288/72 -150/30 30/30 -150/30 210/30 -1 +2 4 +5 1 +5 7 +# No. of faces: 1 14 -0/1 2/1 144/72 288/72 -0/1 6/1 144/72 288/72 -1/1 1/1 150/30 30/30 -1/1 1/1 150/30 30/30 -144/72 288/72 150/30 30/30 -144/72 288/72 150/30 210/30 -1/1 7/1 150/30 210/30 -1/1 7/1 150/30 210/30 -150/30 30/30 6/1 0/1 -150/30 30/30 6/1 1/1 -150/30 30/30 6/1 1/1 -150/30 210/30 6/1 7/1 -150/30 210/30 6/1 7/1 -150/30 210/30 6/1 8/1 +0 2 2 4 +0 6 2 4 +1 1 5 1 +1 1 5 1 +2 4 5 1 +2 4 5 7 +1 7 5 7 +1 7 5 7 +5 1 6 0 +5 1 6 1 +5 1 6 1 +5 7 6 7 +5 7 6 7 +5 7 6 8 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test82.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test82.txt index e4dbeb073c2..723bf69b8ff 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test82.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test82.txt @@ -3,23 +3,23 @@ 0 4 4 0 -1 2 5 2 4 --1/1 2/1 48/24 48/24 -0/1 4/1 48/24 48/24 -48/24 48/24 4/1 0/1 -48/24 48/24 5/1 2/1 +-1 2 48/24 48/24 +0 4 48/24 48/24 +48/24 48/24 4 0 +48/24 48/24 5 2 5 --1/1 2/1 -0/1 4/1 +-1 2 +0 4 48/24 48/24 -4/1 0/1 -5/1 2/1 +4 0 +5 2 1 48/24 48/24 -1 +# No. of faces: 1 6 --1/1 2/1 48/24 48/24 -0/1 4/1 48/24 48/24 -0/1 4/1 48/24 48/24 -48/24 48/24 4/1 0/1 -48/24 48/24 4/1 0/1 -48/24 48/24 5/1 2/1 +-1 2 48/24 48/24 +0 4 48/24 48/24 +0 4 48/24 48/24 +48/24 48/24 4 0 +48/24 48/24 4 0 +48/24 48/24 5 2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test83.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test83.txt index 67a74747e52..5ef7d44396b 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test83.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test83.txt @@ -5,26 +5,24 @@ 0 2 5 1 0 4 5 5 5 -0/1 2/1 5/1 1/1 -0/1 3/1 5/1 1/1 -0/1 3/1 5/1 5/1 -0/1 4/1 5/1 5/1 -0/1 1/1 7/1 0/1 +0 2 5 1 +0 3 5 1 +0 3 5 5 +0 4 5 5 +0 1 7 0 7 -0/1 1/1 -0/1 2/1 -0/1 3/1 -0/1 4/1 -5/1 1/1 -5/1 5/1 -7/1 0/1 +0 1 +0 2 +0 3 +0 4 +5 1 +5 5 +7 0 0 -1 +# No. of faces: 1 5 -0/1 2/1 5/1 1/1 -0/1 3/1 5/1 1/1 -0/1 3/1 5/1 5/1 -0/1 4/1 5/1 5/1 -0/1 1/1 7/1 0/1 - - +0 2 5 1 +0 3 5 1 +0 3 5 5 +0 4 5 5 +0 1 7 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test84.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test84.txt index 419bf09b9eb..b7d779ff1b1 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test84.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test84.txt @@ -4,27 +4,27 @@ 3 2 5 4 3 2 5 0 6 -0/1 0/1 3/1 2/1 -0/1 4/1 3/1 2/1 -3/1 2/1 5/1 0/1 -3/1 2/1 5/1 4/1 -3/1 2/1 6/1 0/1 -3/1 2/1 6/1 4/1 +0 0 3 2 +0 4 3 2 +3 2 5 0 +3 2 5 4 +3 2 6 0 +3 2 6 4 7 -0/1 0/1 -0/1 4/1 -3/1 2/1 -5/1 0/1 -5/1 4/1 -6/1 0/1 -6/1 4/1 -1 -3/1 2/1 +0 0 +0 4 +3 2 +5 0 +5 4 +6 0 +6 4 1 +3 2 +# No. of faces: 1 6 -0/1 0/1 3/1 2/1 -0/1 4/1 3/1 2/1 -3/1 2/1 5/1 0/1 -3/1 2/1 5/1 4/1 -3/1 2/1 6/1 0/1 -3/1 2/1 6/1 4/1 +0 0 3 2 +0 4 3 2 +3 2 5 0 +3 2 5 4 +3 2 6 0 +3 2 6 4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test85.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test85.txt index 79d9d1bd8be..53e394fb9dc 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test85.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test85.txt @@ -3,24 +3,21 @@ 2 0 4 3 2 0 5 2 4 -0/1 0/1 2/1 0/1 -2/1 0/1 4/1 3/1 -2/1 0/1 5/1 2/1 -2/1 0/1 6/1 0/1 +0 0 2 0 +2 0 4 3 +2 0 5 2 +2 0 6 0 5 -0/1 0/1 -2/1 0/1 -4/1 3/1 -5/1 2/1 -6/1 0/1 -1 -2/1 0/1 +0 0 +2 0 +4 3 +5 2 +6 0 1 +2 0 +# No. of faces: 1 4 -0/1 0/1 2/1 0/1 -2/1 0/1 4/1 3/1 -2/1 0/1 5/1 2/1 -2/1 0/1 6/1 0/1 - - - +0 0 2 0 +2 0 4 3 +2 0 5 2 +2 0 6 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test86.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test86.txt index bb28d85698c..85ef8c50bc4 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test86.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test86.txt @@ -3,23 +3,21 @@ 3 3 6 1 3 3 6 0 4 -0/1 3/1 3/1 3/1 -3/1 3/1 6/1 0/1 -3/1 3/1 6/1 1/1 -3/1 3/1 6/1 3/1 +0 3 3 3 +3 3 6 0 +3 3 6 1 +3 3 6 3 5 -0/1 3/1 -3/1 3/1 -6/1 0/1 -6/1 1/1 -6/1 3/1 -1 -3/1 3/1 +0 3 +3 3 +6 0 +6 1 +6 3 1 +3 3 +# No. of faces: 1 4 -0/1 3/1 3/1 3/1 -3/1 3/1 6/1 0/1 -3/1 3/1 6/1 1/1 -3/1 3/1 6/1 3/1 - - +0 3 3 3 +3 3 6 0 +3 3 6 1 +3 3 6 3 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test87.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test87.txt index 2d84b028ae6..029e8e04e93 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test87.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test87.txt @@ -3,22 +3,21 @@ 3 3 5 0 3 3 6 6 4 -3/1 3/1 0/1 3/1 -3/1 3/1 5/1 0/1 -3/1 3/1 6/1 6/1 -7/1 3/1 3/1 3/1 +3 3 0 3 +3 3 5 0 +3 3 6 6 +7 3 3 3 5 -0/1 3/1 -3/1 3/1 -5/1 0/1 -6/1 6/1 -7/1 3/1 -1 -3/1 3/1 +0 3 +3 3 +5 0 +6 6 +7 3 1 +3 3 +# No. of faces: 1 4 -3/1 3/1 0/1 3/1 -3/1 3/1 5/1 0/1 -3/1 3/1 6/1 6/1 -7/1 3/1 3/1 3/1 - +3 3 0 3 +3 3 5 0 +3 3 6 6 +7 3 3 3 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test88.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test88.txt index 911adaeaab2..036b8c8b6bd 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test88.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test88.txt @@ -3,25 +3,24 @@ 1 0 5 8 3 4 6 6 5 -1/1 0/1 3/1 4/1 -0/1 4/1 3/1 4/1 -3/1 4/1 5/1 8/1 -3/1 4/1 6/1 6/1 -3/1 4/1 7/1 4/1 +1 0 3 4 +0 4 3 4 +3 4 5 8 +3 4 6 6 +3 4 7 4 6 -0/1 4/1 -1/1 0/1 -3/1 4/1 -5/1 8/1 -6/1 6/1 -7/1 4/1 -1 -3/1 4/1 +0 4 +1 0 +3 4 +5 8 +6 6 +7 4 1 +3 4 +# No. of faces: 1 5 -1/1 0/1 3/1 4/1 -0/1 4/1 3/1 4/1 -3/1 4/1 5/1 8/1 -3/1 4/1 6/1 6/1 -3/1 4/1 7/1 4/1 - +1 0 3 4 +0 4 3 4 +3 4 5 8 +3 4 6 6 +3 4 7 4 From b781d6a2f83b152eacb1d0aae8b47aaf044fcb7c Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 28 May 2023 17:25:06 +0300 Subject: [PATCH 059/139] Fixed default polyline traits --- .../include/CGAL/Surface_sweep_2_algorithms.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2_algorithms.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2_algorithms.h index f18f1018db3..18f5554dde7 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2_algorithms.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2_algorithms.h @@ -33,6 +33,7 @@ #include #include #include +#include namespace CGAL { @@ -54,11 +55,13 @@ struct Default_arr_traits > typedef CGAL::Arr_segment_traits_2 Traits; }; -template -struct Default_arr_traits > +template +struct Default_arr_traits, + typename Kernel::Point_2>> { - typedef CGAL::Arr_polyline_traits_2 Traits; + using Subtraits = CGAL::Arr_segment_traits_2; + typedef CGAL::Arr_polyline_traits_2 Traits; }; template From f247756bfbc21eaa5126453d85fe45c8a000c434 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 28 May 2023 17:26:04 +0300 Subject: [PATCH 060/139] Enhanced test --- .../test/Surface_sweep_2/CMakeLists.txt | 17 +- .../test/Surface_sweep_2/Compare_curves.h | 53 ++- .../test/Surface_sweep_2/cgal_test_base | 26 +- .../test/Surface_sweep_2/cgal_test_with_cmake | 1 - .../test/Surface_sweep_2/test_sweep.cpp | 322 +++++++++--------- 5 files changed, 211 insertions(+), 208 deletions(-) diff --git a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt index 6bc64ec7601..3471c16f715 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt @@ -7,7 +7,6 @@ project(Surface_sweep_2_Tests) find_package(CGAL REQUIRED COMPONENTS Core) set(CGAL_SEGMENT_TRAITS 1) -set(CGAL_SEGMENT_LEDA_TRAITS 2) set(CGAL_POLYLINE_TRAITS 11) set(CGAL_CONIC_TRAITS 21) @@ -38,16 +37,18 @@ function(compile_and_run_sweep name source_file point_location traits data_set) file( GLOB files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - "${CMAKE_CURRENT_SOURCE_DIR}/${data_set}/*") + "${CMAKE_CURRENT_SOURCE_DIR}/${data_set}/*.txt") foreach(file ${files}) - # message("test ${source_file} ${file}") + # message("test ${source_file} ${file}") string(MAKE_C_IDENTIFIER "${name} ${file}" test_name) - # message(" --> ${test_name}") + # message(" --> ${test_name}") cgal_add_test(${name} TEST_NAME ${test_name} ARGUMENTS ${file}) endforeach() endfunction() -compile_and_run_sweep(test_sweep test_sweep.cpp ${NAIVE} ${CGAL_SEGMENT_TRAITS} - "DATA/segments_tight") -compile_and_run_sweep(test_sweep_conic test_sweep_conic.cpp ${NAIVE} - ${CGAL_CONIC_TRAITS} "DATA/conics") +# compile_and_run_sweep(test_sweep test_sweep.cpp ${NAIVE} ${CGAL_SEGMENT_TRAITS} +# "DATA/segments_tight") +# compile_and_run_sweep(test_sweep_conic test_sweep_conic.cpp ${NAIVE} +# ${CGAL_CONIC_TRAITS} "DATA/conics") +compile_and_run_sweep(test_sweep_polyline test_sweep.cpp ${NAIVE} + ${CGAL_POLYLINE_TRAITS} "DATA/polylines") diff --git a/Surface_sweep_2/test/Surface_sweep_2/Compare_curves.h b/Surface_sweep_2/test/Surface_sweep_2/Compare_curves.h index ff43d9b73a4..311f26746d4 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/Compare_curves.h +++ b/Surface_sweep_2/test/Surface_sweep_2/Compare_curves.h @@ -1,47 +1,44 @@ -#ifndef _COMPARE_CURVE_LIST_H -#define _COMPARE_CURVE_LIST_H +#ifndef _COMPARE_CURVES_H +#define _COMPARE_CURVES_H #include #include - -template -class Equal_pred -{ +template +class Equal_pred { public: - typedef typename Traits::Point_2 Point_2; - typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; + using Point_2 = typename Traits::Point_2; + using X_monotone_curve_2 = typename Traits::X_monotone_curve_2; + + Equal_pred(const Traits& traits) : m_traits(traits) {} bool operator()(const Point_2& p1, const Point_2& p2) - { - return(Traits().equal_2_object()(p1, p2)); - } + { return(m_traits.equal_2_object()(p1, p2)); } bool operator()(const X_monotone_curve_2& c1, const X_monotone_curve_2& c2) - { - return(Traits().equal_2_object()(c1, c2)); - } + { return(m_traits.equal_2_object()(c1, c2)); } + +private: + const Traits& m_traits; }; -template - bool compare_lists(const List& list1, const List& list2, Traits& /*tr*/) -{ - typedef typename List::const_iterator Iter; - Iter begin1 = list1.begin(); - Iter end1 = list1.end(); - - Iter begin2 = list2.begin(); - - if(! (list1.size() == list2.size())) - { - std::cout << "The lists are not of the same lengths (" +template +bool compare_lists(const List& list1, const List& list2, Traits& traits) { + if(! (list1.size() == list2.size())) { + std::cerr << "Error: The lists are not of the same lengths (" << list1.size() << "," << list2.size() << ")\n"; return false; } - Equal_pred eq; - return std::equal(begin1, end1, begin2, eq); + Equal_pred eq(traits); + auto rc = std::equal(list1.begin(), list1.end(), list2.begin(), eq); + if (! rc) { + std::cerr << "Error: The curves do not match\n"; + return false; + } + + return true; } diff --git a/Surface_sweep_2/test/Surface_sweep_2/cgal_test_base b/Surface_sweep_2/test/Surface_sweep_2/cgal_test_base index c6c8af71e9a..2612c02c50f 100755 --- a/Surface_sweep_2/test/Surface_sweep_2/cgal_test_base +++ b/Surface_sweep_2/test/Surface_sweep_2/cgal_test_base @@ -78,12 +78,11 @@ compile() compile_and_run() { - echo "---$1---" # running general test if compile $1 $2 $3 ; then - echo " compilation of $1 succeeded" >> $ERRORFILE + echo " compilation of $1 succeeded" >> $ERRORFILE SUBCURVES="" run $1 $2 $3 $4 SUBCURVES="subcurves" @@ -93,14 +92,13 @@ compile_and_run() fi eval "2>&1 ${MAKE_CMD} CGAL_MAKEFILE=$CGAL_MAKEFILE clean > /dev/null " - } clean_tests() { if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then # - # The clean target generated by CMake under cygwin + # The clean target generated by CMake under cygwin # always fails for some reason # if ! ( uname | grep -q "CYGWIN" ) ; then @@ -117,7 +115,7 @@ compile_and_run_sweep() # running general test if compile $1 $2 $3 ; then - echo " compilation of $1 succeeded" >> $ERRORFILE + echo " compilation of $1 succeeded" >> $ERRORFILE run $1 $2 $3 $4 else echo " ERROR: compilation of $1 failed" >> $ERRORFILE @@ -134,7 +132,7 @@ run() for DATAFILE in ${datafiles} do if [ -d $DATAFILE ]; then - echo "$DATEFILE is a directory" + echo "$DATEFILE is a directory" continue fi @@ -158,7 +156,6 @@ run() echo " ERROR: could not execute $1 $DATAFILE $SUBCURVES" >> $ERRORFILE fi done - } run_io() @@ -178,20 +175,20 @@ run_io() for DATAFILE in ${datafiles} do - + if [ -d $DATAFILE ]; then - echo "$DATEFILE is a directory" + echo "$DATEFILE is a directory" continue fi - + IOFILE="${iofiles}`basename ${DATAFILE}`_${SUFFIO}" echo $IOFILE - + if [ -f $1 ] ; then rm -f arr.txt - + DATANAME=`basename $DATAFILE` - IONAME=`basename $IOFILE` + IONAME=`basename $IOFILE` OUTPUTFILE=ProgramOutput.$3.$1.$DATANAME.$PLATFORM.$2 rm -f $OUTPUTFILE @@ -246,6 +243,7 @@ TRAP=1 # Trapezoidal decomposition NAIVE=2 WALK=3 - #run the test for new sweep +#run the test for new sweep (compile_and_run_sweep test_sweep $NAIVE $CGAL_SEGMENT_TRAITS "DATA/segments_tight") (compile_and_run_sweep test_sweep_conic $NAIVE $CGAL_CONIC_TRAITS "DATA/conics") +(compile_and_run_sweep test_sweep $NAIVE $CGAL_POLYLINE_TRAITS "DATA/polylines diff --git a/Surface_sweep_2/test/Surface_sweep_2/cgal_test_with_cmake b/Surface_sweep_2/test/Surface_sweep_2/cgal_test_with_cmake index 8c72a52e332..60483af61d6 100755 --- a/Surface_sweep_2/test/Surface_sweep_2/cgal_test_with_cmake +++ b/Surface_sweep_2/test/Surface_sweep_2/cgal_test_with_cmake @@ -1,4 +1,3 @@ #! /bin/bash ./cgal_test_base -cmake - diff --git a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp index 23ceebf559d..7af2076d7a8 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp +++ b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp @@ -1,6 +1,5 @@ // examples/Pm_with_intersections/example4 // --------------------------------------- -#include #include #include #include @@ -8,10 +7,12 @@ #include #include +#include + #define CGAL_SEGMENT_TRAITS 1 -#define CGAL_SEGMENT_LEDA_TRAITS 2 #define CGAL_POLYLINE_TRAITS 11 #define CGAL_CONIC_TRAITS 21 +#define CGAL_POLYCONIC_TRAITS 22 // Picking a default Traits class (this, with the // PL flag enables the running of the test independently of cgal_make.) @@ -19,13 +20,12 @@ #define CGAL_ARR_TEST_TRAITS CGAL_SEGMENT_TRAITS #endif -// Making sure test doesn't fail if LEDA is not installed -#if ! defined(CGAL_USE_LEDA) && \ - (CGAL_ARR_TEST_TRAITS == CGAL_SEGMENT_LEDA_TRAITS || \ - CGAL_ARR_TEST_TRAITS == CGAL_CONIC_TRAITS ) +// Making sure test doesn't fail if CORE is not installed +#if ! defined(CGAL_USE_CORE) && \ + ((CGAL_ARR_TEST_TRAITS == CGAL_CONIC_TRAITS) || \ + (CGAL_ARR_TEST_TRAITS == CGAL_POLYCONIC_TRAITS)) -int main() -{ +int main() { std::cout << "A try to run test with LEDA traits but LEDA is not installed."; std::cout << std::endl; std::cout << "Test is not performed."; @@ -33,11 +33,12 @@ int main() return 0; } -#elif ! defined(CGAL_USE_GMP) && \ - (CGAL_ARR_TEST_TRAITS == CGAL_SEGMENT_TRAITS) -int main() -{ +#elif ! defined(CGAL_USE_GMP) && \ + ((CGAL_ARR_TEST_TRAITS == CGAL_SEGMENT_TRAITS) || \ + (CGAL_ARR_TEST_TRAITS == CGAL_POLYLINE_TRAITS)) + +int main() { std::cout << "A try to run test with GMP number type but GMP is not installed."; std::cout << std::endl; std::cout << "Test is not performed."; @@ -48,117 +49,123 @@ int main() #else - - // Choose traits #if CGAL_ARR_TEST_TRAITS==CGAL_SEGMENT_TRAITS #include -#include -#include +#include #include -#include -#elif CGAL_ARR_TEST_TRAITS == CGAL_SEGMENT_LEDA_TRAITS -#include -#include -#include #elif CGAL_ARR_TEST_TRAITS == CGAL_POLYLINE_TRAITS +#include #include -#include -#include #include #include #elif CGAL_ARR_TEST_TRAITS == CGAL_CONIC_TRAITS #include -#include #include +#elif CGAL_ARR_TEST_TRAITS == CGAL_POLYCONIC_TRAITS +#include +#include +#include #else #error No traits defined for test #endif #include #include -#include -#include "CompareCurveList.h" -#if CGAL_ARR_TEST_TRAITS==CGAL_SEGMENT_TRAITS +#include + +#include "Compare_curves.h" + +#if CGAL_ARR_TEST_TRAITS == CGAL_SEGMENT_TRAITS typedef CGAL::Gmpq NT; typedef CGAL::Cartesian Kernel; typedef CGAL::Arr_segment_traits_2 Traits; -#elif CGAL_ARR_TEST_TRAITS == CGAL_SEGMENT_LEDA_TRAITS - typedef leda_rational NT; - typedef CGAL::Pm_segment_traits_leda_kernel_2 Kernel; - typedef CGAL::Arr_leda_segment_traits_2 Traits; - #elif CGAL_ARR_TEST_TRAITS == CGAL_POLYLINE_TRAITS - typedef CGAL::Quotient NT; + typedef CGAL::Gmpq NT; typedef CGAL::Cartesian Kernel; - typedef CGAL::Arr_segment_cached_traits_2 Seg_traits; + typedef CGAL::Arr_segment_traits_2 Seg_traits; typedef CGAL::Arr_polyline_traits_2 Traits; #elif CGAL_ARR_TEST_TRAITS == CGAL_CONIC_TRAITS -typedef leda_real NT; -typedef CGAL::Cartesian Kernel; -typedef CGAL::Arr_conic_traits_2 Traits; + typedef CGAL::Arr_conic_traits_2 Traits; + +#elif CGAL_ARR_TEST_TRAITS == CGAL_POLYCURVE_TRAITS + typedef CGAL::Arr_conic_traits_2 Conic_traits; + typedef CGAL::Arr_polycurve_traits_2 Traits; + #endif -typedef Traits::Point_2 Point_2; -typedef Traits::X_monotone_curve_2 X_monotone_curve_2; +typedef Traits::Point_2 Point_2; +typedef Traits::Curve_2 Curve_2; +typedef Traits::X_monotone_curve_2 X_monotone_curve_2; -typedef std::list PointList; -typedef PointList::iterator PointListIter; +typedef std::list Points; +typedef std::list Curves; +typedef std::list X_monotone_curves; -typedef std::list CurveList; -typedef CurveList::iterator CurveListIter; +bool read_curves(std::ifstream& inp, Curves& curves, const Traits& traits); +bool read_xcurves(std::ifstream& inp, X_monotone_curves& xcurves, + const Traits& traits); +bool read_points(std::ifstream& inp, Points& points, const Traits& traits); +bool curves_identical(X_monotone_curves& list1, X_monotone_curves& list2); +bool points_identical(Points& list1, Points& list2); -void ReadCurveList(std::ifstream &inp, CurveList &clist); -void ReadCurveListRational(std::ifstream &inp, CurveList &clist); -void ReadPointList(std::ifstream &inp, PointList &plist); -bool IsCurveListIdentical(CurveList &list1, CurveList &list2); -bool IsPointListIdentical(PointList &list1, PointList &list2); +// istream modifier skips chars until end of line. +std::istream& skip_until_eol(std::istream& in) { + if (in.eof()) return in; + char c; + while (in.get(c) && (c != '\n')); + return in; +} -int main(int argc, char * argv[]) -{ +// istream modifier that checks for OFF comments and removes them. +std::istream& skip_comment(std::istream& in) { + char c; + while ((in >> c) && (c == '#')) in >> skip_until_eol; + in.putback(c); + return in; +} - if ( argc != 2 ) - { +int main(int argc, char* argv[]) { + if (argc != 2) { std::cout << "Specify a file name " << std::endl; return -1; } std::ifstream inp(argv[1]); - if (!inp.is_open()) { - std::cerr << "Cannot open file " << argv[1] << "!" << std::endl; + if (! inp.is_open()) { + std::cerr << "Error: Cannot open file " << argv[1] << "!" << std::endl; return -1; } - CurveList curves; - ReadCurveList(inp, curves); - Traits tr; + Curves curves; + if (! read_curves(inp, curves, tr)) return -1; + // get subcurves w/o overlapping - CurveList curves_no_overlap_list_out; - CGAL::compute_subcurves(curves.begin(), - curves.end(), - std::back_inserter(curves_no_overlap_list_out)); + X_monotone_curves curves_no_overlap_out; + CGAL::compute_subcurves(curves.begin(), curves.end(), + std::back_inserter(curves_no_overlap_out), + false, tr); // get subcurves w/ overlapping - CurveList curves_with_overlap_list_out; - CGAL::compute_subcurves(curves.begin(), - curves.end(), - std::back_inserter(curves_with_overlap_list_out), - true); + X_monotone_curves curves_with_overlap_out; + CGAL::compute_subcurves(curves.begin(), curves.end(), + std::back_inserter(curves_with_overlap_out), + true, tr); - /*std::copy(curves_no_overlap_list_out.begin(), - curves_no_overlap_list_out.end(), + /*std::copy(curves_no_overlap_out.begin(), + curves_no_overlap_out.end(), std::ostream_iterator(std::cout, "\n")); std::cout<<"\n\n*******************\n\n"; - std::copy(curves_with_overlap_list_out.begin(), - curves_with_overlap_list_out.end(), + std::copy(curves_with_overlap_out.begin(), + curves_with_overlap_out.end(), std::ostream_iterator(std::cout, "\n")); return 0;*/ @@ -166,134 +173,135 @@ int main(int argc, char * argv[]) // get intersection points (with endpoints) - PointList points_with_ends_list_out; - CGAL::compute_intersection_points(curves.begin(), - curves.end(), - std::back_inserter(points_with_ends_list_out), - true); + Points points_with_ends_out; + CGAL::compute_intersection_points(curves.begin(), curves.end(), + std::back_inserter(points_with_ends_out), + true, tr); // get intersection points w/o end points - PointList points_without_ends_list_out; - CGAL::compute_intersection_points(curves.begin(), - curves.end(), - std::back_inserter(points_without_ends_list_out), - false); - std::cout << points_without_ends_list_out.size() - << " points_without_ends_list_out(size)\n"; + Points points_without_ends_out; + CGAL::compute_intersection_points(curves.begin(), curves.end(), + std::back_inserter(points_without_ends_out), + false, tr); + + std::cout << points_without_ends_out.size() + << " points_without_ends_out(size)\n"; // check the do_curves_intersecting method bool do_intersect_out = CGAL::do_curves_intersect(curves.begin(), curves.end()); - // read curves and points from file - CurveList curves_no_overlap_list; - ReadCurveListRational(inp, curves_no_overlap_list); + X_monotone_curves curves_no_overlap; + if (! read_xcurves(inp, curves_no_overlap, tr)) return -1; - PointList points_with_ends_list; - ReadPointList(inp, points_with_ends_list); + Points points_with_ends; + if (! read_points(inp, points_with_ends, tr)) return -1; - PointList points_without_ends_list; - ReadPointList(inp, points_without_ends_list); + Points points_without_ends; + if (! read_points(inp, points_without_ends, tr)) return -1; - int num_faces; - inp >> num_faces; + X_monotone_curves curves_with_overlap; + if (! read_xcurves(inp, curves_with_overlap, tr)) return -1; - CurveList curves_with_overlap_list; - ReadCurveListRational(inp, curves_with_overlap_list); - - if ( !compare_lists(curves_no_overlap_list_out, - curves_no_overlap_list, tr) ) + if (! compare_lists(curves_no_overlap_out, curves_no_overlap, tr)) return -1; - if ( !compare_lists(curves_with_overlap_list_out, - curves_with_overlap_list, tr) ) + if (! compare_lists(curves_with_overlap_out, curves_with_overlap, tr)) return -1; - if ( !compare_lists(points_with_ends_list_out, - points_with_ends_list, tr)) + if (! compare_lists(points_with_ends_out, points_with_ends, tr)) return -1; - if ( !compare_lists(points_without_ends_list_out, - points_without_ends_list, tr)) + if (! compare_lists(points_without_ends_out, points_without_ends, tr)) return -1; bool do_intersect = false; - if((points_without_ends_list.size() != 0) || - (curves_no_overlap_list_out.size() != - curves_with_overlap_list_out.size())) + if ((points_without_ends.size() != 0) || + (curves_no_overlap_out.size() != curves_with_overlap_out.size())) do_intersect = true; - if (do_intersect_out != do_intersect) + if (do_intersect_out != do_intersect) { + std::cerr << "Error: do_intersect()\n"; return -1; + } - std::cout<<"OK\n"; + std::cout << "OK\n"; return 0; } -void ReadCurveList(std::ifstream& inp, CurveList& clist) -{ - int count; - inp >> count; - //std::cout << "ReadCurveList " << count << "\n"; +#if CGAL_ARR_TEST_TRAITS == CGAL_SEGMENT_TRAITS - for (int i = 0; i < count; i++) { +bool read_curves(std::ifstream& inp, Curves& curves, const Traits&) { + int count; + inp >> skip_comment >> count; + std::cout << "read_curves " << count << "\n"; + + for (int i = 0; i < count; ++i) { NT x0, y0, x1, y1; - int ix0, iy0, ix1, iy1; - inp >> ix0 >> iy0 >> ix1 >> iy1; - x0 = ix0; y0 = iy0; x1 = ix1; y1 = iy1; - + inp >> skip_comment >> x0 >> y0 >> x1 >> y1; Point_2 p1(x0, y0); Point_2 p2(x1, y1); - X_monotone_curve_2 curve(p1, p2); - clist.push_back(curve); - //std::cout << curve << "\n"; - } -} - -void ReadCurveListRational(std::ifstream& inp, CurveList& clist) -{ - int count; - inp >> count; - std::cout << "ReadCurveListRational " << count << "\n"; - char ch; - - for (int i = 0; i < count; i++) { - int a, b; - inp >> a >> ch >> b; - NT x0(a,b); - inp >> a >> ch >> b; - NT y0(a,b); - Point_2 p1(x0, y0); - - inp >> a >> ch >> b; - NT x1(a,b); - inp >> a >> ch >> b; - NT y1(a,b); - Point_2 p2(x1, y1); - - X_monotone_curve_2 curve(p1, p2); - clist.push_back(curve); + Curve_2 curve(p1, p2); + curves.push_back(curve); std::cout << curve << "\n"; } + return true; } -void ReadPointList(std::ifstream &inp, PointList &plist) -{ + +bool read_xcurves(std::ifstream& inp, X_monotone_curves& xcurves, + const Traits& traits) +{ return read_curves(inp, xcurves, traits); } + +#elif CGAL_ARR_TEST_TRAITS == CGAL_POLYLINE_TRAITS + +template +bool read_curves_(std::ifstream& inp, Curves_& curves, const Traits& traits, + const Ctr& ctr) { int count; - inp >> count; + inp >> skip_comment >> count; + std::cout << "read_curves " << count << "\n"; + for (int i = 0; i < count; ++i) { + Points points; + auto rc = read_points(inp, points, traits); + if (! rc) return false; + auto cv = ctr(points.begin(), points.end()); + std::cout << cv << "\n"; + curves.push_back(cv); + } + return true; +} + +bool read_curves(std::ifstream& inp, Curves& curves, const Traits& traits) { + auto ctr_cv = traits.construct_curve_2_object(); + return read_curves_(inp, curves, traits, ctr_cv); +} + +bool read_xcurves(std::ifstream& inp, X_monotone_curves& xcurves, + const Traits& traits) { + auto ctr_xcv = traits.construct_x_monotone_curve_2_object(); + return read_curves_(inp, xcurves, traits, ctr_xcv); +} + +#else +#error No traits defined for test +#endif + +bool read_points(std::ifstream& inp, Points& points, const Traits&) { + int count; + inp >> skip_comment >> count; char ch; - std::cout << "ReadPointList " << count << "\n"; + std::cout << "read_points " << count << "\n"; for (int i = 0; i < count; i++) { - int a, b; - inp >> a >> ch >> b; - NT x0(a,b); - inp >> a >> ch >> b; - NT y0(a,b); - Point_2 p(x0, y0); - plist.push_back(p); + NT x, y; + inp >> skip_comment >> x >> y; + Point_2 p(x, y); + points.push_back(p); + std::cout << p << "\n"; } + return true; } #endif From 81fd350a79c4788a34024fa27aad8aa2f10935f5 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 28 May 2023 21:52:40 +0300 Subject: [PATCH 061/139] Fixed 1st test --- .../test/Surface_sweep_2/Compare_curves.h | 2 +- .../DATA/polylines/big_overlap.txt | 31 ++++++ .../test/Surface_sweep_2/test_sweep.cpp | 94 +++++++++---------- 3 files changed, 78 insertions(+), 49 deletions(-) create mode 100644 Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/big_overlap.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/Compare_curves.h b/Surface_sweep_2/test/Surface_sweep_2/Compare_curves.h index 311f26746d4..2727e737570 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/Compare_curves.h +++ b/Surface_sweep_2/test/Surface_sweep_2/Compare_curves.h @@ -34,7 +34,7 @@ bool compare_lists(const List& list1, const List& list2, Traits& traits) { Equal_pred eq(traits); auto rc = std::equal(list1.begin(), list1.end(), list2.begin(), eq); if (! rc) { - std::cerr << "Error: The curves do not match\n"; + std::cerr << "Error: The lists do not match\n"; return false; } diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/big_overlap.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/big_overlap.txt new file mode 100644 index 00000000000..60cda75d7fd --- /dev/null +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/big_overlap.txt @@ -0,0 +1,31 @@ +# No. of input polylines followed by polylines +2 +5 0 0 20 0 30 20 40 0 60 0 +6 10 10 25 10 30 20 40 0 50 0 50 -10 +# No. of output polylines followed by polylines +5 +3 0 0 20 0 25 10 +2 10 10 25 10 +2 50 0 50 -10 +4 25 10 30 20 40 0 50 0 +2 50 0 60 0 +# No. of output points followed by points +6 +0 0 +10 10 +25 10 +50 -10 +50 0 +60 0 +# No. of intersection points followed by points +2 +25 10 +50 0 +# No. of output polylines with overlaps followed by polylines +6 +3 0 0 20 0 25 10 +2 10 10 25 10 +2 50 0 50 -10 +4 25 10 30 20 40 0 50 0 +4 25 10 30 20 40 0 50 0 +2 50 0 60 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp index 7af2076d7a8..d85bf455ccf 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp +++ b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp @@ -146,76 +146,70 @@ int main(int argc, char* argv[]) { Curves curves; if (! read_curves(inp, curves, tr)) return -1; - // get subcurves w/o overlapping + // Test subcurves w/o overlapping X_monotone_curves curves_no_overlap_out; CGAL::compute_subcurves(curves.begin(), curves.end(), std::back_inserter(curves_no_overlap_out), false, tr); - // get subcurves w/ overlapping - X_monotone_curves curves_with_overlap_out; - CGAL::compute_subcurves(curves.begin(), curves.end(), - std::back_inserter(curves_with_overlap_out), - true, tr); + X_monotone_curves curves_no_overlap; + if (! read_xcurves(inp, curves_no_overlap, tr)) return -1; - /*std::copy(curves_no_overlap_out.begin(), - curves_no_overlap_out.end(), - std::ostream_iterator(std::cout, "\n")); - std::cout<<"\n\n*******************\n\n"; + if (! compare_lists(curves_no_overlap_out, curves_no_overlap, tr)) { + std::cerr << "Curves w/o overlapping do not match!\n"; + for (const auto& xcv : curves_no_overlap_out) std::cerr << xcv << std::endl; + return -1; + } - std::copy(curves_with_overlap_out.begin(), - curves_with_overlap_out.end(), - std::ostream_iterator(std::cout, "\n")); - return 0;*/ - - //std::cout << mylist1.size() << " curves\n"; - - - // get intersection points (with endpoints) + // Test intersection points (with endpoints) Points points_with_ends_out; CGAL::compute_intersection_points(curves.begin(), curves.end(), std::back_inserter(points_with_ends_out), true, tr); + Points points_with_ends; + if (! read_points(inp, points_with_ends, tr)) return -1; - // get intersection points w/o end points + if (! compare_lists(points_with_ends_out, points_with_ends, tr)) { + std::cerr << "Endpoints do not match!\n"; + for (const auto& p : points_with_ends_out) std::cerr << p << std::endl; + return -1; + } + + // Test intersection points w/o end points Points points_without_ends_out; CGAL::compute_intersection_points(curves.begin(), curves.end(), std::back_inserter(points_without_ends_out), false, tr); - std::cout << points_without_ends_out.size() - << " points_without_ends_out(size)\n"; - - // check the do_curves_intersecting method - bool do_intersect_out = - CGAL::do_curves_intersect(curves.begin(), curves.end()); - - // read curves and points from file - X_monotone_curves curves_no_overlap; - if (! read_xcurves(inp, curves_no_overlap, tr)) return -1; - - Points points_with_ends; - if (! read_points(inp, points_with_ends, tr)) return -1; - Points points_without_ends; if (! read_points(inp, points_without_ends, tr)) return -1; + if (! compare_lists(points_without_ends_out, points_without_ends, tr)) { + std::cerr << "Intersection points do not match!\n"; + for (const auto& p : points_without_ends_out) std::cerr << p << std::endl; + return -1; + } + + // Test subcurves w/ overlapping + X_monotone_curves curves_with_overlap_out; + CGAL::compute_subcurves(curves.begin(), curves.end(), + std::back_inserter(curves_with_overlap_out), + true, tr); + X_monotone_curves curves_with_overlap; if (! read_xcurves(inp, curves_with_overlap, tr)) return -1; - if (! compare_lists(curves_no_overlap_out, curves_no_overlap, tr)) + if (! compare_lists(curves_with_overlap_out, curves_with_overlap, tr)) { + std::cerr << "Curves w/ overlapping do not match!\n"; + for (const auto& xcv : curves_with_overlap_out) std::cerr << xcv << std::endl; return -1; + } - if (! compare_lists(curves_with_overlap_out, curves_with_overlap, tr)) - return -1; - - if (! compare_lists(points_with_ends_out, points_with_ends, tr)) - return -1; - - if (! compare_lists(points_without_ends_out, points_without_ends, tr)) - return -1; + // Test the do_curves_intersecting method + bool do_intersect_out = + CGAL::do_curves_intersect(curves.begin(), curves.end()); bool do_intersect = false; if ((points_without_ends.size() != 0) || @@ -227,7 +221,7 @@ int main(int argc, char* argv[]) { return -1; } - std::cout << "OK\n"; + std::cout << "Passed\n"; return 0; } @@ -261,23 +255,27 @@ bool read_curves_(std::ifstream& inp, Curves_& curves, const Traits& traits, const Ctr& ctr) { int count; inp >> skip_comment >> count; - std::cout << "read_curves " << count << "\n"; + // std::cout << "read_curves " << count << "\n"; for (int i = 0; i < count; ++i) { Points points; auto rc = read_points(inp, points, traits); if (! rc) return false; auto cv = ctr(points.begin(), points.end()); - std::cout << cv << "\n"; + // std::cout << cv << "\n"; curves.push_back(cv); } return true; } +/*! Read curves. + */ bool read_curves(std::ifstream& inp, Curves& curves, const Traits& traits) { auto ctr_cv = traits.construct_curve_2_object(); return read_curves_(inp, curves, traits, ctr_cv); } +/*! Read x-monotone curves. + */ bool read_xcurves(std::ifstream& inp, X_monotone_curves& xcurves, const Traits& traits) { auto ctr_xcv = traits.construct_x_monotone_curve_2_object(); @@ -293,13 +291,13 @@ bool read_points(std::ifstream& inp, Points& points, const Traits&) { inp >> skip_comment >> count; char ch; - std::cout << "read_points " << count << "\n"; + // std::cout << "read_points " << count << "\n"; for (int i = 0; i < count; i++) { NT x, y; inp >> skip_comment >> x >> y; Point_2 p(x, y); + // std::cout << p << "\n"; points.push_back(p); - std::cout << p << "\n"; } return true; } From 28c669dd9c24a09391d077f2adaab85b64811520 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 28 May 2023 23:41:37 +0300 Subject: [PATCH 062/139] 1st revision --- .../Surface_sweep_2/DATA/polylines/test00.txt | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/test00.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/test00.txt b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/test00.txt new file mode 100644 index 00000000000..a024e6ccf8f --- /dev/null +++ b/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/test00.txt @@ -0,0 +1,56 @@ +# No. of input polylines followed by polylines +4 +3 0 1 1 0 4 0 +3 1 1 2 0 8 0 +3 1 2 3 0 6 0 +3 4 1 5 0 7 0 +# No. of output polylines followed by polylines +10 +3 0 1 1 0 2 0 +2 1 1 2 0 +2 2 0 3 0 +2 1 2 3 0 +2 3 0 4 0 +2 4 0 5 0 +2 4 1 5 0 +2 5 0 6 0 +2 6 0 7 0 +2 7 0 8 0 +# No. of output points followed by points +11 +0 1 +1 1 +1 2 +2 0 +3 0 +4 0 +4 1 +5 0 +6 0 +7 0 +8 0 +# No. of intersection points followed by points +4 +2 0 +4 0 +6 0 +7 0 +# No. of output polylines with overlaps followed by polylines +17 +3 0 1 1 0 2 0 +2 1 1 2 0 +2 2 0 3 0 +2 2 0 3 0 +2 1 2 3 0 +2 3 0 4 0 +2 3 0 4 0 +2 3 0 4 0 +2 4 0 5 0 +2 4 0 5 0 +2 4 1 5 0 +2 5 0 6 0 +2 5 0 6 0 +2 5 0 6 0 +2 6 0 7 0 +2 6 0 7 0 +2 7 0 8 0 From ebdada0b29d73308d2f80b40ec76a8901a43af02 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 28 May 2023 23:52:17 +0300 Subject: [PATCH 063/139] Updated (renamed DATA => data) --- .../test/Surface_sweep_2/CMakeLists.txt | 11 ++--- .../{DATA => data}/conics/con01.txt | 0 .../{DATA => data}/conics/con02.txt | 0 .../{DATA => data}/conics/con03.txt | 0 .../{DATA => data}/conics/con04.txt | 0 .../{DATA => data}/conics/con05.txt | 0 .../{DATA => data}/conics/con06.txt | 0 .../{DATA => data}/conics/con07.txt | 0 .../{DATA => data}/conics/con08.txt | 0 .../{DATA => data}/conics/con09.txt | 0 .../{DATA => data}/conics/con10.txt | 0 .../{DATA => data}/polylines/big_overlap | 0 .../{DATA => data}/polylines/big_overlap.txt | 0 .../{DATA => data}/polylines/big_overlap2 | 0 .../{DATA => data}/polylines/closed_polyline | 0 .../{DATA => data}/polylines/collinears | 0 .../polylines/edge_vertex_intersection | 0 .../polylines/endpoint_intersection | 0 .../{DATA => data}/polylines/partial_overlap | 0 .../{DATA => data}/polylines/partial_overlap2 | 0 .../{DATA => data}/polylines/segment_overlap | 0 .../{DATA => data}/polylines/self_cut | 0 .../polylines/simple_intersection | 0 .../{DATA => data}/polylines/test00.txt | 0 .../{DATA => data}/polylines/total_overlap | 0 .../{DATA => data}/polylines/triangle | 0 .../{DATA => data}/polylines/two_segments | 0 .../polylines/vertex_intersection | 0 .../{DATA => data}/polylines/vertical_segment | 0 .../segment_circles/edge_vertex_intersection | 0 .../segment_circles/segs_and_circles | 0 .../segment_circles/simple_intersection | 0 .../{DATA => data}/segment_circles/triangle | 0 .../segment_circles/two_segments | 0 .../segment_circles/vertex_intersection | 0 .../segment_circles/vertical_segment | 0 .../{DATA => data}/segments/H_degeneracy | 0 .../segments/edge_vertex_intersection | 0 .../segments/simple_intersection | 0 .../{DATA => data}/segments/star_4 | 0 .../{DATA => data}/segments/triangle | 0 .../{DATA => data}/segments/two_segments | 0 .../segments/vertex_intersection | 0 .../{DATA => data}/segments/vertical_segment | 0 .../{DATA => data}/segments_tight/test00.txt | 0 .../{DATA => data}/segments_tight/test01.txt | 0 .../{DATA => data}/segments_tight/test02.txt | 0 .../{DATA => data}/segments_tight/test03.txt | 0 .../{DATA => data}/segments_tight/test04.txt | 0 .../{DATA => data}/segments_tight/test05.txt | 0 .../{DATA => data}/segments_tight/test06.txt | 0 .../{DATA => data}/segments_tight/test07.txt | 0 .../{DATA => data}/segments_tight/test08.txt | 0 .../{DATA => data}/segments_tight/test09.txt | 0 .../{DATA => data}/segments_tight/test10.txt | 0 .../{DATA => data}/segments_tight/test11.txt | 0 .../{DATA => data}/segments_tight/test12.txt | 0 .../{DATA => data}/segments_tight/test13.txt | 0 .../{DATA => data}/segments_tight/test14.txt | 0 .../{DATA => data}/segments_tight/test15.txt | 0 .../{DATA => data}/segments_tight/test16.txt | 0 .../{DATA => data}/segments_tight/test17.txt | 0 .../{DATA => data}/segments_tight/test18.txt | 0 .../{DATA => data}/segments_tight/test19.txt | 0 .../{DATA => data}/segments_tight/test20.txt | 0 .../{DATA => data}/segments_tight/test21.txt | 0 .../{DATA => data}/segments_tight/test22.txt | 0 .../{DATA => data}/segments_tight/test23.txt | 0 .../{DATA => data}/segments_tight/test24.txt | 0 .../{DATA => data}/segments_tight/test25.txt | 0 .../{DATA => data}/segments_tight/test26.txt | 0 .../{DATA => data}/segments_tight/test27.txt | 0 .../{DATA => data}/segments_tight/test28.txt | 0 .../{DATA => data}/segments_tight/test29.txt | 0 .../{DATA => data}/segments_tight/test30.txt | 0 .../{DATA => data}/segments_tight/test31.txt | 0 .../{DATA => data}/segments_tight/test32.txt | 0 .../{DATA => data}/segments_tight/test33.txt | 0 .../{DATA => data}/segments_tight/test34.txt | 0 .../{DATA => data}/segments_tight/test35.txt | 0 .../{DATA => data}/segments_tight/test36.txt | 0 .../{DATA => data}/segments_tight/test37.txt | 0 .../{DATA => data}/segments_tight/test40.txt | 0 .../{DATA => data}/segments_tight/test41.txt | 0 .../{DATA => data}/segments_tight/test42.txt | 0 .../{DATA => data}/segments_tight/test43.txt | 0 .../{DATA => data}/segments_tight/test44.txt | 0 .../{DATA => data}/segments_tight/test45.txt | 0 .../{DATA => data}/segments_tight/test46.txt | 0 .../{DATA => data}/segments_tight/test47.txt | 0 .../{DATA => data}/segments_tight/test48.txt | 0 .../{DATA => data}/segments_tight/test49.txt | 0 .../{DATA => data}/segments_tight/test50.txt | 0 .../{DATA => data}/segments_tight/test51.txt | 0 .../{DATA => data}/segments_tight/test52.txt | 0 .../{DATA => data}/segments_tight/test53.txt | 0 .../{DATA => data}/segments_tight/test54.txt | 0 .../{DATA => data}/segments_tight/test55.txt | 0 .../{DATA => data}/segments_tight/test56.txt | 0 .../{DATA => data}/segments_tight/test60.txt | 0 .../{DATA => data}/segments_tight/test61.txt | 0 .../{DATA => data}/segments_tight/test62.txt | 0 .../{DATA => data}/segments_tight/test63.txt | 0 .../{DATA => data}/segments_tight/test64.txt | 0 .../{DATA => data}/segments_tight/test65.txt | 0 .../{DATA => data}/segments_tight/test66.txt | 0 .../{DATA => data}/segments_tight/test67.txt | 0 .../{DATA => data}/segments_tight/test68.txt | 0 .../{DATA => data}/segments_tight/test69.txt | 0 .../{DATA => data}/segments_tight/test70.txt | 0 .../{DATA => data}/segments_tight/test71.txt | 0 .../{DATA => data}/segments_tight/test72.txt | 0 .../{DATA => data}/segments_tight/test73.txt | 0 .../{DATA => data}/segments_tight/test74.txt | 0 .../{DATA => data}/segments_tight/test75.txt | 0 .../{DATA => data}/segments_tight/test76.txt | 0 .../{DATA => data}/segments_tight/test77.txt | 0 .../{DATA => data}/segments_tight/test78.txt | 0 .../{DATA => data}/segments_tight/test79.txt | 0 .../{DATA => data}/segments_tight/test80.txt | 0 .../{DATA => data}/segments_tight/test81.txt | 0 .../{DATA => data}/segments_tight/test82.txt | 0 .../{DATA => data}/segments_tight/test83.txt | 0 .../{DATA => data}/segments_tight/test84.txt | 0 .../{DATA => data}/segments_tight/test85.txt | 0 .../{DATA => data}/segments_tight/test86.txt | 0 .../{DATA => data}/segments_tight/test87.txt | 0 .../{DATA => data}/segments_tight/test88.txt | 0 .../test/Surface_sweep_2/test_sweep.cpp | 44 ++++++++++++++----- 129 files changed, 38 insertions(+), 17 deletions(-) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/conics/con01.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/conics/con02.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/conics/con03.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/conics/con04.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/conics/con05.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/conics/con06.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/conics/con07.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/conics/con08.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/conics/con09.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/conics/con10.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/big_overlap (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/big_overlap.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/big_overlap2 (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/closed_polyline (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/collinears (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/edge_vertex_intersection (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/endpoint_intersection (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/partial_overlap (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/partial_overlap2 (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/segment_overlap (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/self_cut (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/simple_intersection (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/test00.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/total_overlap (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/triangle (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/two_segments (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/vertex_intersection (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/polylines/vertical_segment (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segment_circles/edge_vertex_intersection (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segment_circles/segs_and_circles (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segment_circles/simple_intersection (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segment_circles/triangle (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segment_circles/two_segments (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segment_circles/vertex_intersection (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segment_circles/vertical_segment (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments/H_degeneracy (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments/edge_vertex_intersection (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments/simple_intersection (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments/star_4 (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments/triangle (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments/two_segments (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments/vertex_intersection (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments/vertical_segment (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test00.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test01.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test02.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test03.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test04.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test05.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test06.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test07.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test08.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test09.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test10.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test11.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test12.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test13.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test14.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test15.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test16.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test17.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test18.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test19.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test20.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test21.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test22.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test23.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test24.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test25.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test26.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test27.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test28.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test29.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test30.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test31.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test32.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test33.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test34.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test35.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test36.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test37.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test40.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test41.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test42.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test43.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test44.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test45.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test46.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test47.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test48.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test49.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test50.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test51.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test52.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test53.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test54.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test55.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test56.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test60.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test61.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test62.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test63.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test64.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test65.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test66.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test67.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test68.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test69.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test70.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test71.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test72.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test73.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test74.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test75.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test76.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test77.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test78.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test79.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test80.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test81.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test82.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test83.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test84.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test85.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test86.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test87.txt (100%) rename Surface_sweep_2/test/Surface_sweep_2/{DATA => data}/segments_tight/test88.txt (100%) diff --git a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt index 3471c16f715..ac96a58ca42 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt @@ -9,6 +9,7 @@ find_package(CGAL REQUIRED COMPONENTS Core) set(CGAL_SEGMENT_TRAITS 1) set(CGAL_POLYLINE_TRAITS 11) set(CGAL_CONIC_TRAITS 21) +set(CGAL_POLYCONIC_TRAITS 22) set(TRAP 1) # Trapezoidal decomposition set(NAIVE 2) @@ -46,9 +47,9 @@ function(compile_and_run_sweep name source_file point_location traits data_set) endforeach() endfunction() -# compile_and_run_sweep(test_sweep test_sweep.cpp ${NAIVE} ${CGAL_SEGMENT_TRAITS} -# "DATA/segments_tight") -# compile_and_run_sweep(test_sweep_conic test_sweep_conic.cpp ${NAIVE} -# ${CGAL_CONIC_TRAITS} "DATA/conics") +compile_and_run_sweep(test_sweep test_sweep.cpp ${NAIVE} + ${CGAL_SEGMENT_TRAITS} "data/segments_tight") +compile_and_run_sweep(test_sweep_conic test_sweep_conic.cpp ${NAIVE} + ${CGAL_CONIC_TRAITS} "data/conics") compile_and_run_sweep(test_sweep_polyline test_sweep.cpp ${NAIVE} - ${CGAL_POLYLINE_TRAITS} "DATA/polylines") + ${CGAL_POLYLINE_TRAITS} "data/polylines") diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con01.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con01.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con01.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/conics/con01.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con02.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con02.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con02.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/conics/con02.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con03.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con03.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con03.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/conics/con03.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con04.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con04.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con04.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/conics/con04.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con05.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con05.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con05.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/conics/con05.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con06.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con06.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con06.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/conics/con06.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con07.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con07.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con07.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/conics/con07.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con08.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con08.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con08.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/conics/con08.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con09.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con09.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con09.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/conics/con09.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con10.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con10.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/conics/con10.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/conics/con10.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/big_overlap b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/big_overlap similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/big_overlap rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/big_overlap diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/big_overlap.txt b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/big_overlap.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/big_overlap.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/big_overlap.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/big_overlap2 b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/big_overlap2 similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/big_overlap2 rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/big_overlap2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/closed_polyline b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/closed_polyline similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/closed_polyline rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/closed_polyline diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/collinears b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/collinears similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/collinears rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/collinears diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/edge_vertex_intersection b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/edge_vertex_intersection similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/edge_vertex_intersection rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/edge_vertex_intersection diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/endpoint_intersection b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/endpoint_intersection similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/endpoint_intersection rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/endpoint_intersection diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/partial_overlap b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/partial_overlap similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/partial_overlap rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/partial_overlap diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/partial_overlap2 b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/partial_overlap2 similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/partial_overlap2 rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/partial_overlap2 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/segment_overlap b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/segment_overlap similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/segment_overlap rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/segment_overlap diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/self_cut b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/self_cut similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/self_cut rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/self_cut diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/simple_intersection b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/simple_intersection similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/simple_intersection rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/simple_intersection diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/test00.txt b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test00.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/test00.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/test00.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/total_overlap b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/total_overlap similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/total_overlap rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/total_overlap diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/triangle b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/triangle similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/triangle rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/triangle diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/two_segments b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/two_segments similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/two_segments rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/two_segments diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/vertex_intersection b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/vertex_intersection similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/vertex_intersection rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/vertex_intersection diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/vertical_segment b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/vertical_segment similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/polylines/vertical_segment rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/vertical_segment diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/edge_vertex_intersection b/Surface_sweep_2/test/Surface_sweep_2/data/segment_circles/edge_vertex_intersection similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/edge_vertex_intersection rename to Surface_sweep_2/test/Surface_sweep_2/data/segment_circles/edge_vertex_intersection diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/segs_and_circles b/Surface_sweep_2/test/Surface_sweep_2/data/segment_circles/segs_and_circles similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/segs_and_circles rename to Surface_sweep_2/test/Surface_sweep_2/data/segment_circles/segs_and_circles diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/simple_intersection b/Surface_sweep_2/test/Surface_sweep_2/data/segment_circles/simple_intersection similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/simple_intersection rename to Surface_sweep_2/test/Surface_sweep_2/data/segment_circles/simple_intersection diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/triangle b/Surface_sweep_2/test/Surface_sweep_2/data/segment_circles/triangle similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/triangle rename to Surface_sweep_2/test/Surface_sweep_2/data/segment_circles/triangle diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/two_segments b/Surface_sweep_2/test/Surface_sweep_2/data/segment_circles/two_segments similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/two_segments rename to Surface_sweep_2/test/Surface_sweep_2/data/segment_circles/two_segments diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/vertex_intersection b/Surface_sweep_2/test/Surface_sweep_2/data/segment_circles/vertex_intersection similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/vertex_intersection rename to Surface_sweep_2/test/Surface_sweep_2/data/segment_circles/vertex_intersection diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/vertical_segment b/Surface_sweep_2/test/Surface_sweep_2/data/segment_circles/vertical_segment similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segment_circles/vertical_segment rename to Surface_sweep_2/test/Surface_sweep_2/data/segment_circles/vertical_segment diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/H_degeneracy b/Surface_sweep_2/test/Surface_sweep_2/data/segments/H_degeneracy similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments/H_degeneracy rename to Surface_sweep_2/test/Surface_sweep_2/data/segments/H_degeneracy diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/edge_vertex_intersection b/Surface_sweep_2/test/Surface_sweep_2/data/segments/edge_vertex_intersection similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments/edge_vertex_intersection rename to Surface_sweep_2/test/Surface_sweep_2/data/segments/edge_vertex_intersection diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/simple_intersection b/Surface_sweep_2/test/Surface_sweep_2/data/segments/simple_intersection similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments/simple_intersection rename to Surface_sweep_2/test/Surface_sweep_2/data/segments/simple_intersection diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/star_4 b/Surface_sweep_2/test/Surface_sweep_2/data/segments/star_4 similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments/star_4 rename to Surface_sweep_2/test/Surface_sweep_2/data/segments/star_4 diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/triangle b/Surface_sweep_2/test/Surface_sweep_2/data/segments/triangle similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments/triangle rename to Surface_sweep_2/test/Surface_sweep_2/data/segments/triangle diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/two_segments b/Surface_sweep_2/test/Surface_sweep_2/data/segments/two_segments similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments/two_segments rename to Surface_sweep_2/test/Surface_sweep_2/data/segments/two_segments diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/vertex_intersection b/Surface_sweep_2/test/Surface_sweep_2/data/segments/vertex_intersection similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments/vertex_intersection rename to Surface_sweep_2/test/Surface_sweep_2/data/segments/vertex_intersection diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments/vertical_segment b/Surface_sweep_2/test/Surface_sweep_2/data/segments/vertical_segment similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments/vertical_segment rename to Surface_sweep_2/test/Surface_sweep_2/data/segments/vertical_segment diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test00.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test00.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test00.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test00.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test01.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test01.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test01.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test01.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test02.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test02.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test02.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test02.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test03.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test03.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test03.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test03.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test04.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test04.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test04.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test04.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test05.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test05.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test05.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test05.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test06.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test06.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test06.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test06.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test07.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test07.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test07.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test07.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test08.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test08.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test08.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test08.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test09.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test09.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test09.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test09.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test10.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test10.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test10.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test10.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test11.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test11.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test11.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test11.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test12.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test12.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test12.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test12.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test13.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test13.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test13.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test13.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test14.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test14.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test14.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test14.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test15.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test15.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test15.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test15.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test16.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test16.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test16.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test16.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test17.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test17.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test17.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test17.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test18.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test18.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test18.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test18.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test19.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test19.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test19.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test19.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test20.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test20.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test20.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test20.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test21.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test21.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test21.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test21.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test22.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test22.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test22.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test22.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test23.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test23.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test23.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test23.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test24.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test24.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test24.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test24.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test25.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test25.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test25.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test25.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test26.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test26.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test26.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test26.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test27.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test27.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test27.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test27.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test28.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test28.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test28.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test28.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test29.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test29.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test29.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test29.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test30.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test30.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test30.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test30.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test31.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test31.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test31.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test31.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test32.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test32.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test32.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test32.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test33.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test33.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test33.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test33.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test34.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test34.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test34.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test34.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test35.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test35.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test35.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test35.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test36.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test36.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test36.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test36.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test37.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test37.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test37.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test37.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test40.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test40.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test40.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test40.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test41.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test41.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test41.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test41.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test42.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test42.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test42.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test42.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test43.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test43.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test43.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test43.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test44.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test44.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test44.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test44.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test45.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test45.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test45.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test45.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test46.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test46.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test46.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test46.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test47.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test47.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test47.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test47.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test48.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test48.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test48.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test48.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test49.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test49.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test49.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test49.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test50.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test50.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test50.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test50.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test51.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test51.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test51.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test51.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test52.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test52.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test52.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test52.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test53.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test53.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test53.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test53.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test54.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test54.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test54.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test54.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test55.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test55.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test55.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test55.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test56.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test56.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test56.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test56.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test60.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test60.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test60.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test60.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test61.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test61.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test61.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test61.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test62.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test62.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test62.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test62.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test63.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test63.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test63.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test63.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test64.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test64.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test64.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test64.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test65.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test65.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test65.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test65.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test66.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test66.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test66.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test66.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test67.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test67.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test67.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test67.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test68.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test68.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test68.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test68.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test69.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test69.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test69.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test69.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test70.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test70.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test70.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test70.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test71.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test71.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test71.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test71.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test72.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test72.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test72.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test72.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test73.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test73.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test73.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test73.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test74.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test74.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test74.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test74.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test75.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test75.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test75.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test75.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test76.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test76.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test76.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test76.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test77.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test77.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test77.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test77.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test78.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test78.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test78.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test78.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test79.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test79.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test79.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test79.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test80.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test80.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test80.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test80.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test81.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test81.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test81.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test81.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test82.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test82.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test82.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test82.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test83.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test83.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test83.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test83.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test84.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test84.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test84.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test84.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test85.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test85.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test85.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test85.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test86.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test86.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test86.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test86.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test87.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test87.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test87.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test87.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test88.txt b/Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test88.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/DATA/segments_tight/test88.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/segments_tight/test88.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp index d85bf455ccf..97265afa626 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp +++ b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp @@ -63,9 +63,11 @@ int main() { #elif CGAL_ARR_TEST_TRAITS == CGAL_CONIC_TRAITS #include #include +#include #elif CGAL_ARR_TEST_TRAITS == CGAL_POLYCONIC_TRAITS #include #include +#include #include #else #error No traits defined for test @@ -79,22 +81,39 @@ int main() { #include "Compare_curves.h" #if CGAL_ARR_TEST_TRAITS == CGAL_SEGMENT_TRAITS - typedef CGAL::Gmpq NT; - typedef CGAL::Cartesian Kernel; - typedef CGAL::Arr_segment_traits_2 Traits; +typedef CGAL::Gmpq NT; +typedef CGAL::Cartesian Kernel; +typedef CGAL::Arr_segment_traits_2 Traits; #elif CGAL_ARR_TEST_TRAITS == CGAL_POLYLINE_TRAITS - typedef CGAL::Gmpq NT; - typedef CGAL::Cartesian Kernel; - typedef CGAL::Arr_segment_traits_2 Seg_traits; - typedef CGAL::Arr_polyline_traits_2 Traits; +typedef CGAL::Gmpq NT; +typedef CGAL::Cartesian Kernel; +typedef CGAL::Arr_segment_traits_2 Seg_traits; +typedef CGAL::Arr_polyline_traits_2 Traits; #elif CGAL_ARR_TEST_TRAITS == CGAL_CONIC_TRAITS - typedef CGAL::Arr_conic_traits_2 Traits; - +typedef CGAL::CORE_algebraic_number_traits Nt_traits; +typedef Nt_traits::Rational Rational; +typedef Nt_traits::Algebraic Algebraic; +typedef CGAL::Cartesian Rat_kernel; +typedef Rat_kernel::Point_2 Rat_point_2; +typedef Rat_kernel::Segment_2 Rat_segment_2; +typedef Rat_kernel::Circle_2 Rat_circle_2; +typedef CGAL::Cartesian Alg_kernel; +typedef CGAL::Arr_conic_traits_2 + Traits_2; #elif CGAL_ARR_TEST_TRAITS == CGAL_POLYCURVE_TRAITS - typedef CGAL::Arr_conic_traits_2 Conic_traits; - typedef CGAL::Arr_polycurve_traits_2 Traits; +typedef CGAL::CORE_algebraic_number_traits Nt_traits; +typedef Nt_traits::Rational Rational; +typedef Nt_traits::Algebraic Algebraic; +typedef CGAL::Cartesian Rat_kernel; +typedef Rat_kernel::Point_2 Rat_point_2; +typedef Rat_kernel::Segment_2 Rat_segment_2; +typedef Rat_kernel::Circle_2 Rat_circle_2; +typedef CGAL::Cartesian Alg_kernel; +typedef CGAL::Arr_conic_traits_2 + Conic_traits; +typedef CGAL::Arr_polycurve_traits_2 Traits; #endif @@ -203,7 +222,8 @@ int main(int argc, char* argv[]) { if (! compare_lists(curves_with_overlap_out, curves_with_overlap, tr)) { std::cerr << "Curves w/ overlapping do not match!\n"; - for (const auto& xcv : curves_with_overlap_out) std::cerr << xcv << std::endl; + for (const auto& xcv : curves_with_overlap_out) + std::cerr << xcv << std::endl; return -1; } From 1c1ed53c76457c841dab781f76f3eacfb299071c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 30 May 2023 08:03:29 +0100 Subject: [PATCH 064/139] Parallelize deduplicate_segments() --- .../Polygon_mesh_processing/autorefinement.h | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index e862d683960..ad88f3a6ace 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1178,7 +1178,8 @@ void autorefine_soup_output(const PointRange& input_points, std::vector< std::vector > all_in_triangle_ids(triangles.size()); CGAL_PMP_AUTOREFINE_VERBOSE("compute intersections"); - + Real_timer t; + t.start(); std::set > intersecting_triangles; //TODO: PARALLEL_FOR #2 for (const Pair_of_triangle_ids& p : si_pairs) @@ -1225,16 +1226,22 @@ void autorefine_soup_output(const PointRange& input_points, intersecting_triangles.insert(CGAL::make_sorted_pair(i1, i2)); } } + std::cout << t.time() << " sec. for #2" << std::endl; #ifdef DEDUPLICATE_SEGMENTS // deduplicate inserted segments //TODO: PARALLEL_FOR #3 + Real_timer t3; + t3.start(); std::vector>> all_segments_ids(all_segments.size()); - for(std::size_t ti=0; ti point_id_map; + + auto get_point_id = [&](const typename EK::Point_3& pt) { auto insert_res = point_id_map.insert(std::make_pair(pt, all_points[ti].size())); @@ -1243,6 +1250,7 @@ void autorefine_soup_output(const PointRange& input_points, return insert_res.first->second; }; + if (!all_points[ti].empty()) { std::vector tmp; @@ -1271,9 +1279,25 @@ void autorefine_soup_output(const PointRange& input_points, if (all_segments_ids[ti].size()!=nbs) filtered_in_triangle_ids.swap(all_in_triangle_ids[ti]); } + }; + +#ifdef CGAL_LINKED_WITH_TBB + tbb::parallel_for(tbb::blocked_range(0, triangles.size()), + [&](const tbb::blocked_range& r) { + for (size_t ti = r.begin(); ti != r.end(); ++ti) + deduplicate_inserted_segments(ti); + } + ); +#else + for (std::size_t ti = 0; ti < triangles.size(); ++ti) { + deduplicate_inserted_segments(ti); } #endif + + std::cout << t.time() << " sec. for #3" << std::endl; +#endif + CGAL_PMP_AUTOREFINE_VERBOSE("triangulate faces"); // now refine triangles #ifdef CGAL_LINKED_WITH_TBB From 2695834873b41052bb2b8669d74e93de41fb89ea Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 30 May 2023 08:10:06 +0100 Subject: [PATCH 065/139] Rename lambdas --- .../Polygon_mesh_processing/soup_autorefinement.cpp | 2 +- .../CGAL/Polygon_mesh_processing/autorefinement.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp index f1230668948..d5ebeb78c3f 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp @@ -36,7 +36,7 @@ int main(int argc, char** argv) std::vector> output_triangles; PMP::autorefine_soup_output(input_points, input_triangles, output_points, output_triangles); std::cout << "#points = " << output_points.size() << " and #triangles = " << output_triangles.size() << " in " << t.time() << " sec." << std::endl; - // CGAL::IO::write_polygon_soup("autorefined.off", output_points, output_triangles, CGAL::parameters::stream_precision(17)); + CGAL::IO::write_polygon_soup("autorefined.off", output_points, output_triangles, CGAL::parameters::stream_precision(17)); return 0; } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index ad88f3a6ace..40a3ed87cbc 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1226,7 +1226,7 @@ void autorefine_soup_output(const PointRange& input_points, intersecting_triangles.insert(CGAL::make_sorted_pair(i1, i2)); } } - std::cout << t.time() << " sec. for #2" << std::endl; + std::cout << t.time() << " sec. for compute_intersections()" << std::endl; #ifdef DEDUPLICATE_SEGMENTS // deduplicate inserted segments @@ -1295,7 +1295,7 @@ void autorefine_soup_output(const PointRange& input_points, #endif - std::cout << t.time() << " sec. for #3" << std::endl; + std::cout << t.time() << " sec. for deduplicate_segments()" << std::endl; #endif CGAL_PMP_AUTOREFINE_VERBOSE("triangulate faces"); @@ -1311,7 +1311,7 @@ void autorefine_soup_output(const PointRange& input_points, #endif - auto func = [&](std::size_t ti) + auto refine_triangles = [&](std::size_t ti) { if (all_segments[ti].empty() && all_points[ti].empty()) new_triangles.push_back(triangles[ti]); @@ -1351,12 +1351,12 @@ void autorefine_soup_output(const PointRange& input_points, tbb::parallel_for(tbb::blocked_range(0, triangles.size()), [&](const tbb::blocked_range& r) { for (size_t ti = r.begin(); ti != r.end(); ++ti) - func(ti); + refine_triangles(ti); } ); #else for (std::size_t ti = 0; ti < triangles.size(); ++ti) { - func(ti); + refine_triangles(ti); } #endif From e34a79864a78c7a19402af066698881d54a22d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 30 May 2023 10:13:28 +0200 Subject: [PATCH 066/139] debug macro --- .../Polygon_mesh_processing/autorefinement.h | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 40a3ed87cbc..eb24d60804a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -48,15 +48,20 @@ #define TEST_RESOLVE_INTERSECTION #define DEDUPLICATE_SEGMENTS +#define USE_DEBUG_PARALLEL_TIMERS //#define DEBUG_COUNTERS //#define USE_FIXED_PROJECTION_TRAITS //#define DEBUG_DEPTH +#ifdef USE_DEBUG_PARALLEL_TIMERS +#include +#endif + #ifdef USE_FIXED_PROJECTION_TRAITS #include #endif -#ifdef DEBUG_COUNTERS +#if defined(DEBUG_COUNTERS) || defined(USE_DEBUG_PARALLEL_TIMERS) #include #endif @@ -1178,8 +1183,10 @@ void autorefine_soup_output(const PointRange& input_points, std::vector< std::vector > all_in_triangle_ids(triangles.size()); CGAL_PMP_AUTOREFINE_VERBOSE("compute intersections"); +#ifdef USE_DEBUG_PARALLEL_TIMERS Real_timer t; t.start(); +#endif std::set > intersecting_triangles; //TODO: PARALLEL_FOR #2 for (const Pair_of_triangle_ids& p : si_pairs) @@ -1226,7 +1233,9 @@ void autorefine_soup_output(const PointRange& input_points, intersecting_triangles.insert(CGAL::make_sorted_pair(i1, i2)); } } - std::cout << t.time() << " sec. for compute_intersections()" << std::endl; +#ifdef USE_DEBUG_PARALLEL_TIMERS + std::cout << t.time() << " sec. for #2" << std::endl; +#endif #ifdef DEDUPLICATE_SEGMENTS // deduplicate inserted segments @@ -1294,8 +1303,9 @@ void autorefine_soup_output(const PointRange& input_points, } #endif - - std::cout << t.time() << " sec. for deduplicate_segments()" << std::endl; +#ifdef USE_DEBUG_PARALLEL_TIMERS + std::cout << t.time() << " sec. for #3" << std::endl; +#endif #endif CGAL_PMP_AUTOREFINE_VERBOSE("triangulate faces"); @@ -1347,6 +1357,11 @@ void autorefine_soup_output(const PointRange& input_points, #endif }; + +#ifdef USE_DEBUG_PARALLEL_TIMERS + t.reset(); + t.start(); +#endif #ifdef CGAL_LINKED_WITH_TBB tbb::parallel_for(tbb::blocked_range(0, triangles.size()), [&](const tbb::blocked_range& r) { @@ -1360,7 +1375,11 @@ void autorefine_soup_output(const PointRange& input_points, } #endif - +#ifdef USE_DEBUG_PARALLEL_TIMERS + t.stop(); + std::cout << t.time() << " sec. for #1" << std::endl; + t.reset(); +#endif // brute force output: create a soup, orient and to-mesh CGAL_PMP_AUTOREFINE_VERBOSE("create output soup"); @@ -1408,10 +1427,19 @@ void autorefine_soup_output(const PointRange& input_points, // import refined triangles //TODO: PARALLEL_FOR #4 +#ifdef USE_DEBUG_PARALLEL_TIMERS + t.reset(); + t.start(); +#endif for (const std::array& t : new_triangles) { soup_triangles.emplace_back(CGAL::make_array(get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2]))); } +#ifdef USE_DEBUG_PARALLEL_TIMERS + t.stop(); + std::cout << t.time() << " sec. for #4" << std::endl; + t.reset(); +#endif #ifndef CGAL_NDEBUG CGAL_PMP_AUTOREFINE_VERBOSE("check soup"); From 3d6d9b3edce9890d2b0dae38c2d1231602f98411 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 30 May 2023 11:10:36 +0100 Subject: [PATCH 067/139] parallelize unique points --- .../Polygon_mesh_processing/autorefinement.h | 73 ++++++++++++++++++- 1 file changed, 70 insertions(+), 3 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index eb24d60804a..e5f96d26c3b 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -41,6 +41,7 @@ #ifdef CGAL_LINKED_WITH_TBB #include +#include #include #endif @@ -1386,11 +1387,18 @@ void autorefine_soup_output(const PointRange& input_points, Cartesian_converter to_input; // TODO: reuse the fact that maps per triangle are already sorted + +#ifdef CGAL_LINKED_WITH_TBB + tbb::concurrent_map point_id_map; +#else std::map point_id_map; +#endif + #if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) std::vector exact_soup_points; #endif + /// Lambda get_point_id() auto get_point_id = [&](const typename EK::Point_3& pt) { auto insert_res = point_id_map.insert(std::make_pair(pt, soup_points.size())); @@ -1404,6 +1412,8 @@ void autorefine_soup_output(const PointRange& input_points, return insert_res.first->second; }; + + std::vector input_point_ids; input_point_ids.reserve(input_points.size()); for (const auto& p : input_points) @@ -1431,13 +1441,70 @@ void autorefine_soup_output(const PointRange& input_points, t.reset(); t.start(); #endif - for (const std::array& t : new_triangles) - { + + bool sequential = +#ifdef CGAL_LINKED_WITH_TBB + false; +#else + true; +#endif + + + std::size_t offset = soup_triangles.size(); + std::string mode; + if(sequential || new_triangles.size() < 100){ + mode = "sequential"; + soup_triangles.reserve(offset + new_triangles.size()); + for (const std::array& t : new_triangles) + { soup_triangles.emplace_back(CGAL::make_array(get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2]))); + } } + else { + mode = "parallel"; +#ifdef CGAL_LINKED_WITH_TBB + + tbb::concurrent_vector concurrent_soup_points; + /// Lambda concurrent_get_point_id() + auto concurrent_get_point_id = [&](const typename EK::Point_3& pt) + { + auto insert_res = point_id_map.insert(std::make_pair(pt, concurrent_soup_points.size())); + if (insert_res.second) + { + concurrent_soup_points.push_back(to_input(pt)); +#if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) + exact_soup_points.push_back(pt); +#endif + } + return insert_res.first->second; + }; + + + soup_triangles.resize(offset + new_triangles.size()); + std::cout << "soup_triangles.size() = " << soup_triangles.size() << std::endl; + std::cout << "new_triangles.size() = " << new_triangles.size() << std::endl; + tbb::parallel_for(tbb::blocked_range(0, new_triangles.size()), + [&](const tbb::blocked_range& r) { + for (size_t ti = r.begin(); ti != r.end(); ++ti) { + if (offset + ti > soup_triangles.size()) { + std::cout << "ti = " << ti << std::endl; + } + const std::array& t = new_triangles[ti]; + soup_triangles[offset + ti] = CGAL::make_array(concurrent_get_point_id(t[0]), concurrent_get_point_id(t[1]), concurrent_get_point_id(t[2])); + } + } + ); + + soup_points.reserve(soup_points.size() + concurrent_soup_points.size()); + soup_points.insert(soup_points.end(), concurrent_soup_points.begin(), concurrent_soup_points.end()); + } +#endif + + + #ifdef USE_DEBUG_PARALLEL_TIMERS t.stop(); - std::cout << t.time() << " sec. for #4" << std::endl; + std::cout << t.time() << " sec. for #4 (" << mode << ")" << std::endl; t.reset(); #endif From a1fbd105dacff034f89de7db2b5086c2f24999ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 30 May 2023 15:07:13 +0200 Subject: [PATCH 068/139] add TODO --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index e5f96d26c3b..16c788c22ec 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -164,7 +164,9 @@ do_coplanar_segments_intersect(std::size_t pi, std::size_t qi, } } + // supporting_line intersects: points are coplanar + // TODO: check if we can write a dedicated predicate taking advantage of p,q being shared ::CGAL::Orientation pqr = cpl_orient(p, q, r); ::CGAL::Orientation pqs = cpl_orient(p, q, s); From 4b2f3e6ec7c10e0d7acf8d40608f4e548db7e091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 30 May 2023 16:01:05 +0200 Subject: [PATCH 069/139] take np into account for concurrency --- .../soup_autorefinement.cpp | 4 +- .../Polygon_mesh_processing/autorefinement.h | 219 ++++++++++-------- 2 files changed, 119 insertions(+), 104 deletions(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp index d5ebeb78c3f..823c50974dc 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp @@ -34,7 +34,9 @@ int main(int argc, char** argv) t.start(); std::vector output_points; std::vector> output_triangles; - PMP::autorefine_soup_output(input_points, input_triangles, output_points, output_triangles); + PMP::autorefine_soup_output(input_points, input_triangles, + output_points, output_triangles, + CGAL::parameters::concurrency_tag(CGAL::Parallel_if_available_tag())); std::cout << "#points = " << output_points.size() << " and #triangles = " << output_triangles.size() << " in " << t.time() << " sec." << std::endl; CGAL::IO::write_polygon_soup("autorefined.off", output_points, output_triangles, CGAL::parameters::stream_precision(17)); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 16c788c22ec..ae383a4af29 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -658,10 +658,11 @@ void collect_intersections(const std::array& t1, ////////////////////////////////// ////////////////////////////////// -template void generate_subtriangles(std::size_t ti, std::vector>& segments, @@ -669,11 +670,7 @@ void generate_subtriangles(std::size_t ti, const std::vector& in_triangle_ids, const std::set >& intersecting_triangles, const std::vector>& triangles, -#ifdef CGAL_LINKED_WITH_TBB - tbb::concurrent_vector>& new_triangles -#else - std::vector>& new_triangles -#endif + PointVector& new_triangles ) { // std::cout << "generate_subtriangles()\n"; @@ -1131,6 +1128,14 @@ void autorefine_soup_output(const PointRange& input_points, Sequential_tag > ::type Concurrency_tag; + constexpr bool parallel_execution = std::is_same_v; + +#ifndef CGAL_LINKED_WITH_TBB + CGAL_static_assertion_msg (parallel_execution, + "Parallel_tag is enabled but TBB is unavailable."); +#endif + + typedef std::size_t Input_TID; typedef std::pair Pair_of_triangle_ids; @@ -1294,16 +1299,20 @@ void autorefine_soup_output(const PointRange& input_points, }; #ifdef CGAL_LINKED_WITH_TBB - tbb::parallel_for(tbb::blocked_range(0, triangles.size()), - [&](const tbb::blocked_range& r) { - for (size_t ti = r.begin(); ti != r.end(); ++ti) - deduplicate_inserted_segments(ti); - } - ); -#else - for (std::size_t ti = 0; ti < triangles.size(); ++ti) { - deduplicate_inserted_segments(ti); + if (parallel_execution) + { + tbb::parallel_for(tbb::blocked_range(0, triangles.size()), + [&](const tbb::blocked_range& r) { + for (size_t ti = r.begin(); ti != r.end(); ++ti) + deduplicate_inserted_segments(ti); + } + ); } + else +#else + for (std::size_t ti = 0; ti < triangles.size(); ++ti) { + deduplicate_inserted_segments(ti); + } #endif #ifdef USE_DEBUG_PARALLEL_TIMERS @@ -1314,7 +1323,9 @@ void autorefine_soup_output(const PointRange& input_points, CGAL_PMP_AUTOREFINE_VERBOSE("triangulate faces"); // now refine triangles #ifdef CGAL_LINKED_WITH_TBB - tbb::concurrent_vector> new_triangles; + std::conditional_t>, + std::vector>> new_triangles; #else std::vector> new_triangles; #endif @@ -1325,40 +1336,40 @@ void autorefine_soup_output(const PointRange& input_points, auto refine_triangles = [&](std::size_t ti) + { + if (all_segments[ti].empty() && all_points[ti].empty()) + new_triangles.push_back(triangles[ti]); + else { - if (all_segments[ti].empty() && all_points[ti].empty()) - new_triangles.push_back(triangles[ti]); - else - { #ifdef USE_FIXED_PROJECTION_TRAITS - const std::array& t = triangles[ti]; - auto is_constant_in_dim = [](const std::array& t, int dim) - { - return t[0][dim] == t[1][dim] && t[0][dim] != t[2][dim]; - }; + const std::array& t = triangles[ti]; + auto is_constant_in_dim = [](const std::array& t, int dim) + { + return t[0][dim] == t[1][dim] && t[0][dim] != t[2][dim]; + }; - typename EK::Vector_3 orth = CGAL::normal(t[0], t[1], t[2]); // TODO::avoid construction? - int c = CGAL::abs(orth[0]) > CGAL::abs(orth[1]) ? 0 : 1; - c = CGAL::abs(orth[2]) > CGAL::abs(orth[c]) ? 2 : c; + typename EK::Vector_3 orth = CGAL::normal(t[0], t[1], t[2]); // TODO::avoid construction? + 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) { - autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); - } - else if (c == 1) { - autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); - } - else if (c == 2) { - autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); - } + if (c == 0) { + autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); + } + else if (c == 1) { + autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); + } + else if (c == 2) { + autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); + } #else - autorefine_impl::generate_subtriangles(ti, all_segments_ids[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); + autorefine_impl::generate_subtriangles(ti, all_segments_ids[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); #endif - } + } #ifdef USE_PROGRESS_DISPLAY - ++pd; + ++pd; #endif - }; + }; #ifdef USE_DEBUG_PARALLEL_TIMERS @@ -1366,16 +1377,20 @@ void autorefine_soup_output(const PointRange& input_points, t.start(); #endif #ifdef CGAL_LINKED_WITH_TBB - tbb::parallel_for(tbb::blocked_range(0, triangles.size()), - [&](const tbb::blocked_range& r) { - for (size_t ti = r.begin(); ti != r.end(); ++ti) - refine_triangles(ti); - } - ); -#else - for (std::size_t ti = 0; ti < triangles.size(); ++ti) { - refine_triangles(ti); + if (parallel_execution) + { + tbb::parallel_for(tbb::blocked_range(0, triangles.size()), + [&](const tbb::blocked_range& r) { + for (size_t ti = r.begin(); ti != r.end(); ++ti) + refine_triangles(ti); + } + ); } + else +#else + for (std::size_t ti = 0; ti < triangles.size(); ++ti) { + refine_triangles(ti); + } #endif #ifdef USE_DEBUG_PARALLEL_TIMERS @@ -1391,7 +1406,9 @@ void autorefine_soup_output(const PointRange& input_points, // TODO: reuse the fact that maps per triangle are already sorted #ifdef CGAL_LINKED_WITH_TBB - tbb::concurrent_map point_id_map; + std::conditional_t, + std::map> point_id_map; #else std::map point_id_map; #endif @@ -1444,63 +1461,59 @@ void autorefine_soup_output(const PointRange& input_points, t.start(); #endif - bool sequential = -#ifdef CGAL_LINKED_WITH_TBB - false; -#else - true; + std::size_t offset = soup_triangles.size(); +#ifdef USE_DEBUG_PARALLEL_TIMERS + std::string mode = "parallel"; #endif + //TODO: 100 should be fined tune and depends on #threads +#ifdef CGAL_LINKED_WITH_TBB + if(parallel_execution && new_triangles.size() > 100) + { + tbb::concurrent_vector concurrent_soup_points; + /// Lambda concurrent_get_point_id() + auto concurrent_get_point_id = [&](const typename EK::Point_3& pt) + { + auto insert_res = point_id_map.insert(std::make_pair(pt, concurrent_soup_points.size())); + if (insert_res.second) + { + concurrent_soup_points.push_back(to_input(pt)); +#if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) + exact_soup_points.push_back(pt); +#endif + } + return insert_res.first->second; + }; - std::size_t offset = soup_triangles.size(); - std::string mode; - if(sequential || new_triangles.size() < 100){ - mode = "sequential"; + + soup_triangles.resize(offset + new_triangles.size()); + std::cout << "soup_triangles.size() = " << soup_triangles.size() << std::endl; + std::cout << "new_triangles.size() = " << new_triangles.size() << std::endl; + tbb::parallel_for(tbb::blocked_range(0, new_triangles.size()), + [&](const tbb::blocked_range& r) { + for (size_t ti = r.begin(); ti != r.end(); ++ti) { + if (offset + ti > soup_triangles.size()) { + std::cout << "ti = " << ti << std::endl; + } + const std::array& t = new_triangles[ti]; + soup_triangles[offset + ti] = CGAL::make_array(concurrent_get_point_id(t[0]), concurrent_get_point_id(t[1]), concurrent_get_point_id(t[2])); + } + } + ); + + soup_points.reserve(soup_points.size() + concurrent_soup_points.size()); + soup_points.insert(soup_points.end(), concurrent_soup_points.begin(), concurrent_soup_points.end()); + } + else +#endif + { +#ifdef USE_DEBUG_PARALLEL_TIMERS + mode = "sequential"; +#endif soup_triangles.reserve(offset + new_triangles.size()); for (const std::array& t : new_triangles) - { - soup_triangles.emplace_back(CGAL::make_array(get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2]))); - } + soup_triangles.emplace_back(CGAL::make_array(get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2]))); } - else { - mode = "parallel"; -#ifdef CGAL_LINKED_WITH_TBB - - tbb::concurrent_vector concurrent_soup_points; - /// Lambda concurrent_get_point_id() - auto concurrent_get_point_id = [&](const typename EK::Point_3& pt) - { - auto insert_res = point_id_map.insert(std::make_pair(pt, concurrent_soup_points.size())); - if (insert_res.second) - { - concurrent_soup_points.push_back(to_input(pt)); -#if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) - exact_soup_points.push_back(pt); -#endif - } - return insert_res.first->second; - }; - - - soup_triangles.resize(offset + new_triangles.size()); - std::cout << "soup_triangles.size() = " << soup_triangles.size() << std::endl; - std::cout << "new_triangles.size() = " << new_triangles.size() << std::endl; - tbb::parallel_for(tbb::blocked_range(0, new_triangles.size()), - [&](const tbb::blocked_range& r) { - for (size_t ti = r.begin(); ti != r.end(); ++ti) { - if (offset + ti > soup_triangles.size()) { - std::cout << "ti = " << ti << std::endl; - } - const std::array& t = new_triangles[ti]; - soup_triangles[offset + ti] = CGAL::make_array(concurrent_get_point_id(t[0]), concurrent_get_point_id(t[1]), concurrent_get_point_id(t[2])); - } - } - ); - - soup_points.reserve(soup_points.size() + concurrent_soup_points.size()); - soup_points.insert(soup_points.end(), concurrent_soup_points.begin(), concurrent_soup_points.end()); - } -#endif From 2e99b211b0e22579f76093eec62cfbb1697e17d9 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Tue, 30 May 2023 17:10:58 +0300 Subject: [PATCH 070/139] Ported test_sweep_conic to test_sweep and fixed the conic test cases --- .../test/Surface_sweep_2/CMakeLists.txt | 2 +- .../Surface_sweep_2/data/conics/con01.txt | 1 - .../Surface_sweep_2/data/conics/con02.txt | 2 - .../Surface_sweep_2/data/conics/con03.txt | 5 - .../Surface_sweep_2/data/conics/con04.txt | 4 +- .../Surface_sweep_2/data/conics/con05.txt | 4 - .../Surface_sweep_2/data/conics/con06.txt | 1 - .../Surface_sweep_2/data/conics/con07.txt | 1 - .../Surface_sweep_2/data/conics/con08.txt | 2 - .../Surface_sweep_2/data/conics/con09.txt | 3 +- .../Surface_sweep_2/data/conics/con10.txt | 3 +- .../polylines/{big_overlap.txt => test01.txt} | 0 .../Surface_sweep_2/data/polylines/test02.txt | 51 ++ .../test/Surface_sweep_2/test_sweep.cpp | 438 +++++++++++++----- .../test/Surface_sweep_2/test_sweep_conic.cpp | 279 ----------- 15 files changed, 378 insertions(+), 418 deletions(-) rename Surface_sweep_2/test/Surface_sweep_2/data/polylines/{big_overlap.txt => test01.txt} (100%) create mode 100644 Surface_sweep_2/test/Surface_sweep_2/data/polylines/test02.txt delete mode 100644 Surface_sweep_2/test/Surface_sweep_2/test_sweep_conic.cpp diff --git a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt index ac96a58ca42..9e96fa6dc1c 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt @@ -49,7 +49,7 @@ endfunction() compile_and_run_sweep(test_sweep test_sweep.cpp ${NAIVE} ${CGAL_SEGMENT_TRAITS} "data/segments_tight") -compile_and_run_sweep(test_sweep_conic test_sweep_conic.cpp ${NAIVE} +compile_and_run_sweep(test_sweep_conic test_sweep.cpp ${NAIVE} ${CGAL_CONIC_TRAITS} "data/conics") compile_and_run_sweep(test_sweep_polyline test_sweep.cpp ${NAIVE} ${CGAL_POLYLINE_TRAITS} "data/polylines") diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con01.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con01.txt index a3464614b95..1ff457efdb1 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con01.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con01.txt @@ -8,4 +8,3 @@ e 3 3 7 5 4 5 10 5 {1*x^2 + 1*y^2 + 0*xy + -14*x + -10*y + 65} : (4.66667,6.88562) --cw--> (10,5) 5 1 - diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con02.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con02.txt index f3ca4fd2817..c404b51caa1 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con02.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con02.txt @@ -10,5 +10,3 @@ e 3 3 4 9 7 9 1 9 {1*x^2 + 1*y^2 + 0*xy + -8*x + -18*y + 88} : (7,9) --cw--> (5.45237,6.375) 6 2 - - diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con03.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con03.txt index 6ed5fcbab23..599a66f9b14 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con03.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con03.txt @@ -12,8 +12,3 @@ f 3 3 4 9 {1*x^2 + 1*y^2 + 0*xy + -8*x + -18*y + 88} : (1,9) --cw--> (7,9) 6 2 - - - - - diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con04.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con04.txt index d9a9875cdeb..eb6a5c18711 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con04.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con04.txt @@ -12,6 +12,4 @@ f 1 1 3 2 {1*x^2 + 1*y^2 + 0*xy + -6*x + -4*y + 12} : (4,2) --cw--> (2,2) {1*x^2 + 1*y^2 + 0*xy + -6*x + -4*y + 12} : (2,2) --cw--> (4,2) 6 -0 - - +1 diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con05.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con05.txt index 224bbc2397a..e68e06cb488 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con05.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con05.txt @@ -12,7 +12,3 @@ f 3 3 4 9 {1*x^2 + 1*y^2 + 0*xy + -8*x + -18*y + 88} : (1,9) --cw--> (7,9) 6 2 - - - - diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con06.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con06.txt index 59ac8c5f663..f82851db1c1 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con06.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con06.txt @@ -14,4 +14,3 @@ f 1 1 1 1 {1*x^2 + 1*y^2 + 0*xy + -4*x + 0*y + 3} : (2,1) --cw--> (3,0) 5 3 - diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con07.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con07.txt index 2b2253b5594..e884bd40154 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con07.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con07.txt @@ -10,4 +10,3 @@ f 2 2 2 2 {1*x^2 + 1*y^2 + 0*xy + -4*x + -4*y + 4} : (0,2) --cw--> (4,2) 5 1 - diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con08.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con08.txt index 54aae8118a0..63063346910 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con08.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con08.txt @@ -26,5 +26,3 @@ f 3 1 0 0 {4*x^2 + 25*y^2 + 0*xy + -16*x + 0*y + -84} : (2.75552,1.97704) --cw--> (7,0) 10 6 - - diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con09.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con09.txt index 543d1cff813..6afc8ee809c 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con09.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con09.txt @@ -121,5 +121,4 @@ f 1 1 -4 0 {1*x^2 + 1*y^2 + 0*xy + -8*x + 0*y + 0} : (8,0) --cw--> (4.5,-3.96863) {1*x^2 + 1*y^2 + 0*xy + -8*x + 0*y + 0} : (4.5,3.96863) --cw--> (8,0) 59 -34 - +41 diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con10.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con10.txt index 51c9e3ffb2a..d5f29cc3101 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con10.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con10.txt @@ -18,5 +18,4 @@ s 7 -2 3 2 {1*x^2 + 1*y^2 + 0*xy + -14*x + 2*y + 49} : (8,-1) --cw--> (7,-2) {1*x^2 + 1*y^2 + 0*xy + -14*x + 2*y + 49} : (7,0) --cw--> (8,-1) 8 -7 - +5 diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/polylines/big_overlap.txt b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test01.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/data/polylines/big_overlap.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/test01.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test02.txt b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test02.txt new file mode 100644 index 00000000000..7af88f99c7a --- /dev/null +++ b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test02.txt @@ -0,0 +1,51 @@ +# No. of input polylines followed by polylines +4 +2 0 0 7 0 +2 1 0 6 0 +2 2 0 5 0 +2 3 0 4 0 +# No. of output polylines followed by polylines +7 +2 0 0 1 0 +2 1 0 2 0 +2 2 0 3 0 +2 3 0 4 0 +2 4 0 5 0 +2 5 0 6 0 +2 6 0 7 0 +# No. of output points followed by points +8 +0 0 +1 0 +2 0 +3 0 +4 0 +5 0 +6 0 +7 0 +# No. of intersection points followed by points +6 +1 0 +2 0 +3 0 +4 0 +5 0 +6 0 +# No. of output polylines with overlaps followed by polylines +16 +2 0 0 1 0 +2 1 0 2 0 +2 1 0 2 0 +2 2 0 3 0 +2 2 0 3 0 +2 2 0 3 0 +2 3 0 4 0 +2 3 0 4 0 +2 3 0 4 0 +2 3 0 4 0 +2 4 0 5 0 +2 4 0 5 0 +2 4 0 5 0 +2 5 0 6 0 +2 5 0 6 0 +2 6 0 7 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp index 97265afa626..cc11bbabac3 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp +++ b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp @@ -101,8 +101,8 @@ typedef Rat_kernel::Segment_2 Rat_segment_2; typedef Rat_kernel::Circle_2 Rat_circle_2; typedef CGAL::Cartesian Alg_kernel; typedef CGAL::Arr_conic_traits_2 - Traits_2; -#elif CGAL_ARR_TEST_TRAITS == CGAL_POLYCURVE_TRAITS + Traits; +#elif CGAL_ARR_TEST_TRAITS == CGAL_POLYCONIC_TRAITS typedef CGAL::CORE_algebraic_number_traits Nt_traits; typedef Nt_traits::Rational Rational; typedef Nt_traits::Algebraic Algebraic; @@ -125,10 +125,6 @@ typedef std::list Points; typedef std::list Curves; typedef std::list X_monotone_curves; -bool read_curves(std::ifstream& inp, Curves& curves, const Traits& traits); -bool read_xcurves(std::ifstream& inp, X_monotone_curves& xcurves, - const Traits& traits); -bool read_points(std::ifstream& inp, Points& points, const Traits& traits); bool curves_identical(X_monotone_curves& list1, X_monotone_curves& list2); bool points_identical(Points& list1, Points& list2); @@ -148,109 +144,32 @@ std::istream& skip_comment(std::istream& in) { return in; } -int main(int argc, char* argv[]) { - if (argc != 2) { - std::cout << "Specify a file name " << std::endl; - return -1; +#if CGAL_ARR_TEST_TRAITS != CGAL_CONIC_TRAITS + +bool read_points(std::ifstream& inp, Points& points, const Traits&) { + int count; + inp >> skip_comment >> count; + char ch; + + // std::cout << "read_points " << count << "\n"; + for (int i = 0; i < count; i++) { + NT x, y; + inp >> skip_comment >> x >> y; + Point_2 p(x, y); + // std::cout << p << "\n"; + points.push_back(p); } - - std::ifstream inp(argv[1]); - if (! inp.is_open()) { - std::cerr << "Error: Cannot open file " << argv[1] << "!" << std::endl; - return -1; - } - - Traits tr; - - Curves curves; - if (! read_curves(inp, curves, tr)) return -1; - - // Test subcurves w/o overlapping - X_monotone_curves curves_no_overlap_out; - CGAL::compute_subcurves(curves.begin(), curves.end(), - std::back_inserter(curves_no_overlap_out), - false, tr); - - - X_monotone_curves curves_no_overlap; - if (! read_xcurves(inp, curves_no_overlap, tr)) return -1; - - if (! compare_lists(curves_no_overlap_out, curves_no_overlap, tr)) { - std::cerr << "Curves w/o overlapping do not match!\n"; - for (const auto& xcv : curves_no_overlap_out) std::cerr << xcv << std::endl; - return -1; - } - - // Test intersection points (with endpoints) - Points points_with_ends_out; - CGAL::compute_intersection_points(curves.begin(), curves.end(), - std::back_inserter(points_with_ends_out), - true, tr); - - Points points_with_ends; - if (! read_points(inp, points_with_ends, tr)) return -1; - - if (! compare_lists(points_with_ends_out, points_with_ends, tr)) { - std::cerr << "Endpoints do not match!\n"; - for (const auto& p : points_with_ends_out) std::cerr << p << std::endl; - return -1; - } - - // Test intersection points w/o end points - Points points_without_ends_out; - CGAL::compute_intersection_points(curves.begin(), curves.end(), - std::back_inserter(points_without_ends_out), - false, tr); - - Points points_without_ends; - if (! read_points(inp, points_without_ends, tr)) return -1; - - if (! compare_lists(points_without_ends_out, points_without_ends, tr)) { - std::cerr << "Intersection points do not match!\n"; - for (const auto& p : points_without_ends_out) std::cerr << p << std::endl; - return -1; - } - - // Test subcurves w/ overlapping - X_monotone_curves curves_with_overlap_out; - CGAL::compute_subcurves(curves.begin(), curves.end(), - std::back_inserter(curves_with_overlap_out), - true, tr); - - X_monotone_curves curves_with_overlap; - if (! read_xcurves(inp, curves_with_overlap, tr)) return -1; - - if (! compare_lists(curves_with_overlap_out, curves_with_overlap, tr)) { - std::cerr << "Curves w/ overlapping do not match!\n"; - for (const auto& xcv : curves_with_overlap_out) - std::cerr << xcv << std::endl; - return -1; - } - - // Test the do_curves_intersecting method - bool do_intersect_out = - CGAL::do_curves_intersect(curves.begin(), curves.end()); - - bool do_intersect = false; - if ((points_without_ends.size() != 0) || - (curves_no_overlap_out.size() != curves_with_overlap_out.size())) - do_intersect = true; - - if (do_intersect_out != do_intersect) { - std::cerr << "Error: do_intersect()\n"; - return -1; - } - - std::cout << "Passed\n"; - return 0; + return true; } +#endif + #if CGAL_ARR_TEST_TRAITS == CGAL_SEGMENT_TRAITS bool read_curves(std::ifstream& inp, Curves& curves, const Traits&) { int count; inp >> skip_comment >> count; - std::cout << "read_curves " << count << "\n"; + // std::cout << "read_curves " << count << "\n"; for (int i = 0; i < count; ++i) { NT x0, y0, x1, y1; @@ -259,7 +178,7 @@ bool read_curves(std::ifstream& inp, Curves& curves, const Traits&) { Point_2 p2(x1, y1); Curve_2 curve(p1, p2); curves.push_back(curve); - std::cout << curve << "\n"; + // std::cout << curve << "\n"; } return true; } @@ -302,24 +221,313 @@ bool read_xcurves(std::ifstream& inp, X_monotone_curves& xcurves, return read_curves_(inp, xcurves, traits, ctr_xcv); } -#else -#error No traits defined for test -#endif +#elif CGAL_ARR_TEST_TRAITS == CGAL_CONIC_TRAITS -bool read_points(std::ifstream& inp, Points& points, const Traits&) { +void read_curve(std::ifstream& is, Curve_2& cv) { + // Read a line from the input file. + char one_line[128]; + + is >> skip_comment; + is.getline(one_line, 128); + std::string stringvalues(one_line); + std::istringstream str_line(stringvalues, std::istringstream::in); + + // Get the arc type. + // Supported types are: 'f' - Full ellipse (or circle). + // 'e' - Elliptic arc (or circular arc). + // 's' - Line segment. + char type; + bool is_circle = false; // Is this a circle. + Rat_circle_2 circle; + Rational r, s, t, u, v, w; // The conic coefficients. + + str_line >> type; + + // An ellipse (full ellipse or a partial ellipse): + if (type == 'f' || type == 'F' || type == 'e' || type == 'E') { + // Read the ellipse (using the format "a b x0 y0"): + // + // x - x0 2 y - y0 2 + // ( -------- ) + ( -------- ) = 1 + // a b + // + int a, b, x0, y0; + + str_line >> a >> b >> x0 >> y0; + + Rational a_sq = Rational(a*a); + Rational b_sq = Rational(b*b); + + if (a == b) { + is_circle = true; + circle = + Rat_circle_2(Rat_point_2(Rational(x0), Rational(y0)), Rational(a*b)); + } + else { + r = b_sq; + s = a_sq; + t = 0; + u = Rational(-2*x0*b_sq); + v = Rational(-2*y0*a_sq); + w = Rational(x0*x0*b_sq + y0*y0*a_sq - a_sq*b_sq); + } + + if (type == 'f' || type == 'F') { + // Create a full ellipse (or circle). + if (is_circle) cv = Curve_2 (circle); + else cv = Curve_2(r, s, t, u, v, w); + } + else { + // Read the endpointd of the arc. + int x1, y1, x2, y2; + + str_line >> x1 >> y1 >> x2 >> y2; + + Point_2 source = Point_2(Algebraic(x1), Algebraic(y1)); + Point_2 target = Point_2(Algebraic(x2), Algebraic(y2)); + + // Create the arc. Note that it is always clockwise oriented. + if (is_circle) cv = Curve_2(circle, CGAL::CLOCKWISE, source, target); + else cv = Curve_2(r, s, t, u, v, w, CGAL::CLOCKWISE, source, target); + } + } + else if (type == 's' || type == 'S') { + // Read a segment, given by its endpoints (x1,y1) and (x2,y2); + int x1, y1, x2, y2; + + str_line >> x1 >> y1 >> x2 >> y2; + + // Create the segment. + Rat_point_2 source = Rat_point_2 (Rational(x1), Rational(y1)); + Rat_point_2 target = Rat_point_2 (Rational(x2), Rational(y2)); + + cv = Curve_2(Rat_segment_2 (source, target)); + } + + // std::cout << cv << std::endl; +} + +/*! Read curves. + */ +bool read_curves(std::ifstream& inp, Curves& curves, const Traits&) { + // auto ctr_cv = traits.construct_curve_2_object(); int count; inp >> skip_comment >> count; - char ch; - - // std::cout << "read_points " << count << "\n"; - for (int i = 0; i < count; i++) { - NT x, y; - inp >> skip_comment >> x >> y; - Point_2 p(x, y); - // std::cout << p << "\n"; - points.push_back(p); + Curve_2 cv; + char dummy[256]; + inp.getline(dummy, sizeof(dummy)); + for (int i = 0; i < count; ++i) { + read_curve(inp, cv); + curves.push_back(cv); } return true; } +#else +#error No traits defined for test +#endif + +#if CGAL_ARR_TEST_TRAITS != CGAL_CONIC_TRAITS + +// Test subcurves w/o overlapping +bool test_curves_no_overlap(std::ifstream& inp, Curves& curves, + const X_monotone_curves& curves_no_overlap_out, + const Traits& tr) { + X_monotone_curves curves_no_overlap; + if (! read_xcurves(inp, curves_no_overlap, tr)) return false; + + if (! compare_lists(curves_no_overlap_out, curves_no_overlap, tr)) { + std::cerr << "Error: Curves w/o overlapping do not match!\n"; + for (const auto& xcv : curves_no_overlap_out) std::cerr << xcv << std::endl; + return false; + } + + return true; +} + +// Test subcurves w/ overlapping +bool test_curves_with_overlap(std::ifstream& inp, Curves& curves, + const X_monotone_curves& curves_with_overlap_out, + const Traits& tr) { + X_monotone_curves curves_with_overlap; + if (! read_xcurves(inp, curves_with_overlap, tr)) return false; + + if (! compare_lists(curves_with_overlap_out, curves_with_overlap, tr)) { + std::cerr << "Error: Curves w/ overlapping do not match!\n"; + for (const auto& xcv : curves_with_overlap_out) + std::cerr << xcv << std::endl; + return false; + } + + return true; +} + +// Test intersection points (with endpoints) +bool test_points_with_ends(std::ifstream& inp, Curves& curves, + const Points& points_with_ends_out, + const Traits& tr) { + Points points_with_ends; + if (! read_points(inp, points_with_ends, tr)) return false; + + if (! compare_lists(points_with_ends_out, points_with_ends, tr)) { + std::cerr << "Error: Endpoints do not match!\n"; + for (const auto& p : points_with_ends_out) std::cerr << p << std::endl; + return false; + } + + return true; +} + +// Test intersection points w/o end points +bool test_points_no_ends(std::ifstream& inp, Curves& curves, + const Points& points_no_ends_out, + const Traits& tr) { + Points points_no_ends; + if (! read_points(inp, points_no_ends, tr)) return -1; + + if (! compare_lists(points_no_ends_out, points_no_ends, tr)) { + std::cerr << "Error: Intersection points do not match!\n"; + for (const auto& p : points_no_ends_out) std::cerr << p << std::endl; + return false; + } + + return true; +} + +#else + +/*! Test the surface sweep with conic traits. + */ +bool test_conic(std::ifstream& inp, Curves& curves, + const X_monotone_curves& curves_no_overlap_out, + const Points& points_with_ends_out, + const Points& points_no_ends_out, + const Traits&) { + char dummy[256]; + + CGAL::Bbox_2 bbox = curves.front().bbox(); + for (auto it = std::next(curves.begin()); it != curves.end(); ++it) + bbox = bbox + it->bbox(); + + // generate the string for the output + std::stringstream out1; + for (const auto& xcv : curves_no_overlap_out) out1 << xcv << "\n"; + + // read the output from the file + std::stringstream out2; + char buf[1024]; + int count = 0; + + inp >> count; + inp.getline(buf, 1024); // to get rid of the new line + for (int i = 0; i < count; ++i) { + inp.getline(buf, 1024); + out2 << buf << "\n"; + } + + // std::cout << "Result: \n" << curves_no_overlap_out.size() << "\n"; + // for (const auto& xcv : curves_no_overlap_out) + // std::cout << xcv << "\n"; + + std::string calculated = out1.str(); + std::string infile = out2.str(); + + if (infile != calculated) { + std::cerr << "Error\n"; + std::cerr << "\ncalculated:\n"; + std::cerr << calculated << std::endl; + std::cerr << "\nin file:\n"; + std::cerr << infile << std::endl; + std::cerr << "--" << std::endl; + return false; + } + + std::size_t points_with_ends_size, points_no_ends_size; + inp >> skip_comment >> points_with_ends_size >> points_no_ends_size; + + auto points_with_ends_out_size = points_with_ends_out.size(); + if (points_with_ends_size != points_with_ends_out_size ) { + std::cerr << "Error: Number of endpoints do not match (" + << points_with_ends_out_size << ", " + << points_with_ends_size << ")\n"; + return false; + } + + auto points_no_ends_out_size = points_no_ends_out.size(); + if (points_no_ends_size != points_no_ends_out_size) { + std::cerr << "Error: Number of intersection points do not match (" + << points_no_ends_out_size << ", " + << points_no_ends_size << ")\n"; + return false; + } + + return true; +} + +#endif + +int main(int argc, char* argv[]) { + if (argc != 2) { + std::cout << "Specify a file name " << std::endl; + return -1; + } + + std::ifstream inp(argv[1]); + if (! inp.is_open()) { + std::cerr << "Error: Cannot open file " << argv[1] << "!" << std::endl; + return -1; + } + + Traits tr; + + Curves curves; + if (! read_curves(inp, curves, tr)) return -1; + + X_monotone_curves curves_no_overlap_out; + CGAL::compute_subcurves(curves.begin(), curves.end(), + std::back_inserter(curves_no_overlap_out), + false, tr); + + X_monotone_curves curves_with_overlap_out; + CGAL::compute_subcurves(curves.begin(), curves.end(), + std::back_inserter(curves_with_overlap_out), + true, tr); + + Points points_with_ends_out; + CGAL::compute_intersection_points(curves.begin(), curves.end(), + std::back_inserter(points_with_ends_out), + true, tr); + + Points points_no_ends_out; + CGAL::compute_intersection_points(curves.begin(), curves.end(), + std::back_inserter(points_no_ends_out), + false, tr); + +#if CGAL_ARR_TEST_TRAITS == CGAL_CONIC_TRAITS + if (! test_conic(inp, curves, curves_no_overlap_out, + points_with_ends_out, points_no_ends_out, tr)) + return -1; +#else + if (! test_curves_no_overlap(inp, curves, curves_no_overlap_out, tr)) + return -1; + if (! test_points_with_ends(inp, curves, points_with_ends_out, tr)) return -1; + if (! test_points_no_ends(inp, curves, points_no_ends_out, tr)) return -1; + if (! test_curves_with_overlap(inp, curves, curves_with_overlap_out, tr)) + return -1; +#endif + + // Test the do_curves_intersecting method + bool do_intersect_out = + CGAL::do_curves_intersect(curves.begin(), curves.end()); + bool do_intersect = ! points_no_ends_out.empty() || + (curves_no_overlap_out.size() != curves_with_overlap_out.size()); + if (do_intersect_out != do_intersect) { + std::cerr << "Error: do_intersect()\n"; + return -1; + } + + std::cout << "Passed\n"; + return 0; +} + #endif diff --git a/Surface_sweep_2/test/Surface_sweep_2/test_sweep_conic.cpp b/Surface_sweep_2/test/Surface_sweep_2/test_sweep_conic.cpp deleted file mode 100644 index 45ae9544851..00000000000 --- a/Surface_sweep_2/test/Surface_sweep_2/test_sweep_conic.cpp +++ /dev/null @@ -1,279 +0,0 @@ -#include - -#if !defined(CGAL_USE_CORE) -#include -int main() -{ - std::cout << "CORE is not installed. Test aborted!" << std::endl; - return 0; -} -#else - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -typedef CGAL::CORE_algebraic_number_traits Nt_traits; -typedef Nt_traits::Rational Rational; -typedef Nt_traits::Algebraic Algebraic; -typedef CGAL::Cartesian Rat_kernel; -typedef Rat_kernel::Point_2 Rat_point_2; -typedef Rat_kernel::Segment_2 Rat_segment_2; -typedef Rat_kernel::Circle_2 Rat_circle_2; -typedef CGAL::Cartesian Alg_kernel; -typedef CGAL::Arr_conic_traits_2 - Traits_2; - -typedef Traits_2::Curve_2 Curve_2; -typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; -typedef Traits_2::Point_2 Point_2; -typedef std::list CurveList; - -typedef std::list PointList; -typedef PointList::iterator PointListIter; - - -/*! Conic reader */ -template -class Conic_reader { -public: - int ReadData(const char* filename, CurveList& curves, CGAL::Bbox_2& bbox) - { - Curve_2 cv; - char dummy[256]; - - std::ifstream inp(filename); - if (!inp.is_open()) { - std::cerr << "Cannot open file " << filename << "!" << std::endl; - return -1; - } - int count; - inp >> count; - inp.getline(dummy, sizeof(dummy)); - for (int i = 0; i < count; i++) { - ReadCurve(inp, cv); - curves.push_back(cv); - CGAL::Bbox_2 curve_bbox = cv.bbox(); - if (i == 0) bbox = curve_bbox; - else bbox = bbox + curve_bbox; - } - inp.close(); - return 0; - } - - void ReadCurve(std::ifstream & is, Curve_2 & cv) - { - // Read a line from the input file. - char one_line[128]; - - skip_comments (is, one_line); - std::string stringvalues(one_line); - std::istringstream str_line (stringvalues, std::istringstream::in); - - // Get the arc type. - // Supported types are: 'f' - Full ellipse (or circle). - // 'e' - Elliptic arc (or circular arc). - // 's' - Line segment. - char type; - bool is_circle = false; // Is this a circle. - Rat_circle_2 circle; - Rational r, s, t, u, v, w; // The conic coefficients. - - str_line >> type; - - // An ellipse (full ellipse or a partial ellipse): - if (type == 'f' || type == 'F' || type == 'e' || type == 'E') - { - // Read the ellipse (using the format "a b x0 y0"): - // - // x - x0 2 y - y0 2 - // ( -------- ) + ( -------- ) = 1 - // a b - // - int a, b, x0, y0; - - str_line >> a >> b >> x0 >> y0; - - Rational a_sq = Rational(a*a); - Rational b_sq = Rational(b*b); - - if (a == b) - { - is_circle = true; - circle = Rat_circle_2 (Rat_point_2 (Rational(x0), Rational(y0)), - Rational(a*b)); - } - else - { - r = b_sq; - s = a_sq; - t = 0; - u = Rational(-2*x0*b_sq); - v = Rational(-2*y0*a_sq); - w = Rational(x0*x0*b_sq + y0*y0*a_sq - a_sq*b_sq); - } - - if (type == 'f' || type == 'F') - { - // Create a full ellipse (or circle). - if (is_circle) - cv = Curve_2 (circle); - else - cv = Curve_2 (r, s, t, u, v, w); - } - else - { - // Read the endpointd of the arc. - int x1, y1, x2, y2; - - str_line >> x1 >> y1 >> x2 >> y2; - - Point_2 source = Point_2 (Algebraic(x1), Algebraic(y1)); - Point_2 target = Point_2 (Algebraic(x2), Algebraic(y2)); - - // Create the arc. Note that it is always clockwise oriented. - if (is_circle) - cv = Curve_2 (circle, - CGAL::CLOCKWISE, - source, target); - else - cv = Curve_2 (r, s, t, u, v, w, - CGAL::CLOCKWISE, - source, target); - } - } - else if (type == 's' || type == 'S') - { - // Read a segment, given by its endpoints (x1,y1) and (x2,y2); - int x1, y1, x2, y2; - - str_line >> x1 >> y1 >> x2 >> y2; - - // Create the segment. - Rat_point_2 source = Rat_point_2 (Rational(x1), Rational(y1)); - Rat_point_2 target = Rat_point_2 (Rational(x2), Rational(y2)); - - cv = Curve_2(Rat_segment_2 (source, target)); - } - - return; - } - - void skip_comments( std::ifstream& is, char* one_line ) - { - while( !is.eof() ){ - is.getline( one_line, 128 ); - if( one_line[0] != '#' ){ - break; - } - } - } -}; - -//--------------------------------------------------------------------------- -// The main: -// -int main (int argc, char** argv) -{ - bool verbose = false; - - // Define a test objects to read the conic arcs from it. - if (argc<2) - { - std::cerr << "Usage: Conic_traits_test " << std::endl; - exit(1); - } - - CGAL::Bbox_2 bbox; - CurveList curves; - - Conic_reader reader; - reader.ReadData(argv[1], curves, bbox); - - // run the sweep - std::list mylist; - - CGAL::compute_subcurves(curves.begin(), curves.end(), - std::back_inserter(mylist), false); - - - PointList point_list_with_ends; - CGAL::compute_intersection_points(curves.begin(), curves.end(), - std::back_inserter(point_list_with_ends), true); - std::size_t point_count_with_ends_calculated = point_list_with_ends.size(); - - // generate the string for the output - std::stringstream out1; - for ( std::list::iterator iter = mylist.begin() ; - iter != mylist.end() ; ++iter ) - { - out1 << *iter << "\n"; - } - - // read the output from the file - std::stringstream out2; - char buf[1024]; - int count = 0; - - std::ifstream in_file(argv[1]); - in_file >> count; - in_file.getline(buf, 1024); // to get rid of the new line - for ( int i = 0 ; i < count ; i++ ) { - in_file.getline(buf, 1024); - } - in_file >> count; - in_file.getline(buf, 1024); // to get rid of the new line - for (int i = 0; i < count; i++) { - in_file.getline(buf, 1024); - out2 << buf << "\n"; - } - std::size_t point_count_with_ends_from_file = 0; - in_file >> point_count_with_ends_from_file; - in_file.close(); - - if ( verbose ) - { - std::cout << "Result: \n" << mylist.size() << "\n"; - for ( std::list::iterator i = mylist.begin() ; - i != mylist.end() ; ++i ) - { - std::cout << *i << "\n"; - } - } - - std::string calculated = out1.str(); - std::string infile = out2.str(); - - if ( infile == calculated ) { - if ( point_count_with_ends_from_file != - point_count_with_ends_calculated ) { - std::cout << "number of intersection points (with ends):" - << point_count_with_ends_calculated << ". Should be " - << point_count_with_ends_from_file << "\n"; - std::cout << argv[1] << " Error\n"; - return -1; - } else { - std::cout << argv[1] << " OK!\n"; - } - } else { - std::cout << argv[1] << " Error\n"; - std::cout << "\ncalculated:\n"; - std::cout << calculated << std::endl; - std::cout << "\nin file:\n"; - std::cout << infile << std::endl; - std::cout << "--" << std::endl; - return -1; - } - - return 0; -} - -#endif From 3d6c0da44cdf28be1ebfc4e7818ba78987c7209c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 31 May 2023 09:14:42 +0200 Subject: [PATCH 071/139] remove debug --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index ae383a4af29..18bbfa2ce40 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1323,9 +1323,9 @@ void autorefine_soup_output(const PointRange& input_points, CGAL_PMP_AUTOREFINE_VERBOSE("triangulate faces"); // now refine triangles #ifdef CGAL_LINKED_WITH_TBB - std::conditional_t>, - std::vector>> new_triangles; + std::conditional_t>, + std::vector>> new_triangles; #else std::vector> new_triangles; #endif @@ -1487,8 +1487,6 @@ void autorefine_soup_output(const PointRange& input_points, soup_triangles.resize(offset + new_triangles.size()); - std::cout << "soup_triangles.size() = " << soup_triangles.size() << std::endl; - std::cout << "new_triangles.size() = " << new_triangles.size() << std::endl; tbb::parallel_for(tbb::blocked_range(0, new_triangles.size()), [&](const tbb::blocked_range& r) { for (size_t ti = r.begin(); ti != r.end(); ++ti) { From 854aacd671b9936730e97f8bf003bf2969e016fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 6 Jun 2023 15:31:19 +0200 Subject: [PATCH 072/139] add comments --- .../Triangle_3_Triangle_3_intersection.h | 48 ++++++++++++------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h index 4cc5f9be560..99dcd24ff45 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h @@ -59,6 +59,19 @@ coplanar_segment_segment_alpha_intersection(const typename K::Point_3& p1, const template struct Point_on_triangle { + // triangle points are not stored in this class but are expected + // to always be passed in the same order. For a triangle pqr, + // edge 0 is pq, edge 1 qr and edge 2 rp. Point 0 is p, 1 is q and 2 is r. + // + // (id, -1) point on t1 + // (-1, id) point on t2 + // (id1, id2) intersection of edges + std::pair t1_t2_ids; + boost::container::flat_set extra_t1; // store other ids of edges containing the point + typename Kernel::FT alpha; // + +////// + static inline const typename Kernel::Point_3& @@ -83,13 +96,7 @@ struct Point_on_triangle , alpha(alpha) {} - // (id, -1) point on t1 - // (-1, id) point on t2 - // (id1, id2) intersection of edges - std::pair t1_t2_ids; - boost::container::flat_set extra_t1; - typename Kernel::FT alpha; - + // orientation of the current point wrt to edge id1 (p1q1) Orientation orientation (const typename Kernel::Point_3& p1, // source of edge edge_id1 const typename Kernel::Point_3& q1, // target of edge edge_id1 @@ -116,7 +123,7 @@ struct Point_on_triangle CGAL_assertion((t1_t2_ids.first+1)%3==edge_id1); if (alpha==1) return ZERO; return alpha<=1?POSITIVE:NEGATIVE; - } + } else { //this is an input point of t2 @@ -129,6 +136,7 @@ struct Point_on_triangle int id1() const { return t1_t2_ids.first; } int id2() const { return t1_t2_ids.second; } + // construct the intersection point from the info stored typename Kernel::Point_3 point(const typename Kernel::Point_3& p1, const typename Kernel::Point_3& q1, @@ -147,6 +155,12 @@ struct Point_on_triangle } }; +// the intersection of two triangles is computed by interatively intersection t2 +// with halfspaces defined by edges of t1. The following function is called +// for each each on t1 on edge of the current intersection. +// pq is such an edge and p1q1 from t1 defines the halfspace intersection +// we are currently interseted in. We return the intersection point of +// pq with p1q1 template Point_on_triangle intersection(const Point_on_triangle& p, @@ -172,7 +186,7 @@ intersection(const Point_on_triangle& p, { switch(q.id1()) { - case -1: // (-1, ip2) - (-1, iq2) + case -1: // A: (-1, ip2) - (-1, iq2) { CGAL_assertion((p.id2()+1)%3 == q.id2() || (q.id2()+1)%3 == p.id2()); // CGAL_assertion(p.extra_t1.empty() && q.extra_t1.empty()); // TMP to see if it's worth implementing special case @@ -187,7 +201,7 @@ intersection(const Point_on_triangle& p, return Point_on_triangle(edge_id_t1, id2, alpha); // intersection with an original edge of t2 } default: - if (q.id2()!=-1) // (-1, ip2) - (iq1, iq2) + if (q.id2()!=-1) // B: (-1, ip2) - (iq1, iq2) { if (p.id2() == q.id2() || p.id2() == (q.id2()+1)%3) { @@ -210,7 +224,7 @@ intersection(const Point_on_triangle& p, int eid1 = p.extra_t1.count(q.id1())!=0 ? q.id1() : 3-q.id1()-edge_id_t1; return Point_on_triangle((eid1+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3, -1); // vertex of t1 } - // (-1, ip2) - (iq1, -1) + // C: (-1, ip2) - (iq1, -1) //vertex of t1, special case t1 edge passed thru a vertex of t2 CGAL_assertion(edge_id_t1 == 2); #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION @@ -229,7 +243,7 @@ intersection(const Point_on_triangle& p, { switch(q.id1()) { - case -1: // (ip1, -1) - (-1, iq2) + case -1: // G: (ip1, -1) - (-1, iq2) //vertex of t1, special case t1 edge passed thru a vertex of t2 #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION std::cout << " -- case 5\n"; @@ -243,8 +257,8 @@ intersection(const Point_on_triangle& p, #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION std::cout << " -- case 6\n"; #endif - CGAL_assertion(q.id2()!=-1); // (ip1, -1) - (iq2, -1) - //(ip1,-1), (iq1, iq2) + CGAL_assertion(q.id2()!=-1); // I: (ip1, -1) - (iq2, -1) + //H: (ip1,-1), (iq1, iq2) CGAL_assertion(edge_id_t1==2); // p and q are on the same edge of t1 CGAL_assertion(p.id1()==q.id1() || p.id1()==(q.id1()+1)%3); @@ -256,7 +270,7 @@ intersection(const Point_on_triangle& p, { switch(q.id1()) { - case -1: // (ip1, ip2) - (-1, iq2) + case -1: // D: (ip1, ip2) - (-1, iq2) { if (q.id2() == p.id2() || q.id2() == (p.id2()+1)%3) { @@ -284,7 +298,7 @@ intersection(const Point_on_triangle& p, { switch(q.id2()) { - case -1: // (ip1, ip2) - (iq1, -1) + case -1: // F: (ip1, ip2) - (iq1, -1) { // p and q are on the same edge of t1 CGAL_assertion(q.id1()==p.id1() || q.id1()==(p.id1()+1)%3); @@ -293,7 +307,7 @@ intersection(const Point_on_triangle& p, #endif return Point_on_triangle((p.id1()+1)%3==edge_id_t1?edge_id_t1:(edge_id_t1+1)%3 , -1); } - default: // (ip1, ip2) - (iq1, iq2) + default: // E: (ip1, ip2) - (iq1, iq2) { if (p.id2()==q.id2()) { From 0551cefa5d315c4071dec5c1118bceaaa6bdfcdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 7 Jun 2023 15:02:10 +0200 Subject: [PATCH 073/139] add more test from errors while testing thingi10k models --- .../triangle_3_triangle_3_intersection.cpp | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/Intersections_3/test/Intersections_3/triangle_3_triangle_3_intersection.cpp b/Intersections_3/test/Intersections_3/triangle_3_triangle_3_intersection.cpp index 0098bcd0142..f0875a55ee8 100644 --- a/Intersections_3/test/Intersections_3/triangle_3_triangle_3_intersection.cpp +++ b/Intersections_3/test/Intersections_3/triangle_3_triangle_3_intersection.cpp @@ -96,6 +96,13 @@ void test_coplanar_triangles(){ assert(CGAL::object_cast(&obj)!=nullptr); obj=CGAL::intersection(t2,t1); assert(CGAL::object_cast(&obj)!=nullptr); + // TK10 case C' + t1=Triangle(Point(88.7921, 89.0007, 1.25), Point(88.1912, 88.3997, 1.25), Point(89.8224, 90.031, 1.25)); + t2=Triangle(Point(88.0497, 88.2583, 1.25), Point(82.9292, 81.8747, 1.25), Point(91.1726, 91.3812, 1.25)); + obj=CGAL::intersection(t1,t2); + assert(CGAL::object_cast(&obj)!=nullptr); + obj=CGAL::intersection(t2,t1); + assert(CGAL::object_cast(&obj)!=nullptr); //Intersection is a point //edges are collinear, one vertex in common t1=Triangle( Point(0,0,0),Point(0,1,0),Point(1,0,0) ); @@ -153,6 +160,13 @@ void test_coplanar_triangles(){ assert(CGAL::object_cast(&obj)!=nullptr); obj=CGAL::intersection(t2,t1); assert(CGAL::object_cast(&obj)!=nullptr); + // TK10 case D + t1=Triangle(Point(-34.893700000000003, -16.0351, 3.1334899999999998e-12), Point(-34.893700000000003, -18.5351, 3.1334899999999998e-12), Point(-42.393700000000003, -16.0351, 3.1334899999999998e-12)); + t2=Triangle(Point(-34.893700000000003, -32.0351, 3.1334899999999998e-12), Point(-34.893700000000003, -9.7851400000000002, 3.1334899999999998e-12), Point(-31.643699999999999, -17.201799999999999, 3.1334899999999998e-12)); + obj=CGAL::intersection(t1,t2); + assert(CGAL::object_cast(&obj)!=nullptr); + obj=CGAL::intersection(t2,t1); + assert(CGAL::object_cast(&obj)!=nullptr); //Intersection is a polygon //David's star t1=Triangle( Point(0,0,0),Point(1,0,0),Point(0.5,1.5,0) ); @@ -181,6 +195,51 @@ void test_coplanar_triangles(){ obj=CGAL::intersection(t2,t1); assert(CGAL::object_cast(&obj)!=nullptr); assert(CGAL::object_cast(&obj)->size()==4); + // TK10 case A + t1=Triangle(Point(3.74861, 12.4822, 14.0112), Point(5.40582, 12.4822, 15.6895), Point(5.37748, 12.4822, 15.7206)); + t2=Triangle(Point(5.49972, 12.4822, 13.491), Point(5.27627, 12.4822, 15.8106), Point(5.32119, 12.4822, 15.8126)); + obj=CGAL::intersection(t1,t2); + assert(CGAL::object_cast(&obj)!=nullptr); + assert(CGAL::object_cast(&obj)->size()==4); + obj=CGAL::intersection(t2,t1); + assert(CGAL::object_cast(&obj)!=nullptr); + assert(CGAL::object_cast(&obj)->size()==4); + // TK10 case C + t1=Triangle(Point(5, -94.6659, 3.85175), Point(5, -94.5682, 3.08638), Point(5, -94.8182, 3.08638)); + t2=Triangle(Point(5, -94.4317, 3.76399), Point(5, -97.6182, 3.08638), Point(5, -94.5659, 2.99682)); + obj=CGAL::intersection(t1,t2); + assert(CGAL::object_cast(&obj)!=nullptr); + assert(CGAL::object_cast(&obj)->size()==4); + obj=CGAL::intersection(t2,t1); + assert(CGAL::object_cast(&obj)!=nullptr); + assert(CGAL::object_cast(&obj)->size()==4); + // TK10 case E + t1=Triangle(Point(-955.858, -45.032, -0.016), Point(-955.856, -45.032, -0.004), Point(-955.856, -45.032, -0.002)); + t2=Triangle(Point(-955.856, -45.032, 0.006), Point(-955.854, -45.032, -0.002), Point(-955.876, -45.032, -0.034)); + obj=CGAL::intersection(t1,t2); + assert(CGAL::object_cast(&obj)!=nullptr); + assert(CGAL::object_cast(&obj)->size()==4); + obj=CGAL::intersection(t2,t1); + assert(CGAL::object_cast(&obj)!=nullptr); + assert(CGAL::object_cast(&obj)->size()==4); + // TK10 case F + t1=Triangle(Point(141.172, 20.576, 155.764), Point(141.172, 20.588, 155.766), Point(141.172, 20.59, 155.766)); + t2=Triangle(Point(141.172, 20.602, 155.768), Point(141.172, 20.594, 155.766), Point(141.172, 20.574, 155.764)); + obj=CGAL::intersection(t1,t2); + assert(CGAL::object_cast(&obj)!=nullptr); + assert(CGAL::object_cast(&obj)->size()==4); + obj=CGAL::intersection(t2,t1); + assert(CGAL::object_cast(&obj)!=nullptr); + assert(CGAL::object_cast(&obj)->size()==4); + // TK10 case D + t1=Triangle(Point(152.864, 126.324, 0.950001), Point(152.77, 126.483, 0.950001), Point(153.072, 125.973, 0.950001)); + t2=Triangle(Point(153.322, 125.551, 0.950001), Point(152.218, 127.415, 0.950001), Point(153.66, 124.768, 0.950001)); + obj=CGAL::intersection(t1,t2); + assert(CGAL::object_cast(&obj)!=nullptr); + assert(CGAL::object_cast(&obj)->size()==4); + obj=CGAL::intersection(t2,t1); + assert(CGAL::object_cast(&obj)!=nullptr); + assert(CGAL::object_cast(&obj)->size()==4); //Intersection is empty t1=Triangle( Point(0,0,0),Point(0,1,0),Point(1,0,0) ); t2=Triangle( Point(-0.1,-0.1,0),Point(-0.1,-0.9,0),Point(-1,-0.1,0) ); From 48712f7862f02ce63558de039c603e0d018ae31d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 8 Jun 2023 14:04:55 +0200 Subject: [PATCH 074/139] don't use c++17 features --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 18bbfa2ce40..6b664ec360b 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1128,7 +1128,7 @@ void autorefine_soup_output(const PointRange& input_points, Sequential_tag > ::type Concurrency_tag; - constexpr bool parallel_execution = std::is_same_v; + constexpr bool parallel_execution = std::is_same::value; #ifndef CGAL_LINKED_WITH_TBB CGAL_static_assertion_msg (parallel_execution, From 003bf47781ef69354d9cd388f2fce00168c2e762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 8 Jun 2023 14:05:09 +0200 Subject: [PATCH 075/139] move alpha computation into a functor --- .../Triangle_3_Triangle_3_intersection.h | 52 +++++-------------- .../include/CGAL/Kernel/function_objects.h | 31 +++++++++++ .../include/CGAL/Kernel/interface_macros.h | 2 + .../Polygon_mesh_processing/autorefinement.h | 6 +-- 4 files changed, 50 insertions(+), 41 deletions(-) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h index 99dcd24ff45..68166f18c6e 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h @@ -34,28 +34,6 @@ namespace CGAL { namespace Intersections { namespace internal{ -//TODO: move into a functor -template -typename K::FT -coplanar_segment_segment_alpha_intersection(const typename K::Point_3& p1, const typename K::Point_3& p2, // segment 1 - const typename K::Point_3& p3, const typename K::Point_3& p4, // segment 2 - const K& k) -{ - const typename K::Vector_3 v1 = p2-p1; - const typename K::Vector_3 v2 = p4-p3; - - CGAL_assertion(k.coplanar_3_object()(p1,p2,p3,p4)); - - const typename K::Vector_3 v3 = p3 - p1; - const typename K::Vector_3 v3v2 = cross_product(v3,v2); - const typename K::Vector_3 v1v2 = cross_product(v1,v2); - const typename K::FT sl = v1v2.squared_length(); - CGAL_assertion(!certainly(is_zero(sl))); - - const typename K::FT t = ((v3v2.x()*v1v2.x()) + (v3v2.y()*v1v2.y()) + (v3v2.z()*v1v2.z())) / sl; - return t; // p1 + (p2-p1) * t -} - template struct Point_on_triangle { @@ -179,6 +157,8 @@ intersection(const Point_on_triangle& p, std::cout << " (" << p.id1() << "," << p.id2() << ",[" << p.alpha << "]) -"; std::cout << " (" << q.id1() << "," << q.id2() << ",[" << q.alpha << "]) || e" << edge_id_t1; #endif + typename Kernel::Compute_alpha_for_coplanar_triangle_intersection_3 compute_alpha + = k.compute_alpha_for_coplanar_triangle_intersection_3_object(); typedef Point_on_triangle Pot; switch(p.id1()) { @@ -193,10 +173,9 @@ intersection(const Point_on_triangle& p, #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION std::cout << " -- case 1\n"; #endif - typename Kernel::FT alpha = - coplanar_segment_segment_alpha_intersection(p1, q1, - Pot::point_from_id(p2, q2, r2, p.id2()), - Pot::point_from_id(p2, q2, r2, q.id2()), k); + typename Kernel::FT alpha = compute_alpha(p1, q1, + Pot::point_from_id(p2, q2, r2, p.id2()), + Pot::point_from_id(p2, q2, r2, q.id2())); int id2 = (p.id2()+1)%3 == q.id2() ? p.id2() : q.id2(); return Point_on_triangle(edge_id_t1, id2, alpha); // intersection with an original edge of t2 } @@ -209,10 +188,9 @@ intersection(const Point_on_triangle& p, std::cout << " -- case 2\n"; #endif // points are on the same edge of t2 --> we shorten an already cut edge - typename Kernel::FT alpha = - coplanar_segment_segment_alpha_intersection(p1, q1, - Pot::point_from_id(p2, q2, r2, q.id2()), - Pot::point_from_id(p2, q2, r2, (q.id2()+1)%3), k); + typename Kernel::FT alpha = compute_alpha(p1, q1, + Pot::point_from_id(p2, q2, r2, q.id2()), + Pot::point_from_id(p2, q2, r2, (q.id2()+1)%3)); return Point_on_triangle(edge_id_t1, q.id2(), alpha); } @@ -278,10 +256,9 @@ intersection(const Point_on_triangle& p, std::cout << " -- case 7\n"; #endif // points are on the same edge of t2 --> we shorten an already cut edge - typename Kernel::FT alpha = - coplanar_segment_segment_alpha_intersection(p1, q1, - Pot::point_from_id(p2, q2, r2, p.id2()), - Pot::point_from_id(p2, q2, r2, (p.id2()+1)%3), k); + typename Kernel::FT alpha = compute_alpha(p1, q1, + Pot::point_from_id(p2, q2, r2, p.id2()), + Pot::point_from_id(p2, q2, r2, (p.id2()+1)%3)); return Point_on_triangle(edge_id_t1, p.id2(), alpha); } @@ -314,10 +291,9 @@ intersection(const Point_on_triangle& p, #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION std::cout << " -- case 10\n"; #endif - typename Kernel::FT alpha = - coplanar_segment_segment_alpha_intersection(p1, q1, - Pot::point_from_id(p2, q2, r2, q.id2()), - Pot::point_from_id(p2, q2, r2, (q.id2()+1)%3), k); + typename Kernel::FT alpha = compute_alpha(p1, q1, + Pot::point_from_id(p2, q2, r2, q.id2()), + Pot::point_from_id(p2, q2, r2, (q.id2()+1)%3)); return Point_on_triangle(edge_id_t1, q.id2(), alpha); } // we are intersecting an edge of t1 diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 71aa268e6d3..780c0b2d4e5 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -2149,6 +2149,37 @@ namespace CommonKernelFunctors { } }; + template + class Compute_alpha_for_coplanar_triangle_intersection_3 + { + typedef typename K::Point_3 Point_3; + typedef typename K::Vector_3 Vector_3; + public: + typedef typename K::FT result_type; + result_type + operator()(const Point_3& p1, const Point_3& p2, // segment 1 + const Point_3& p3, const Point_3& p4) const // segment 2 + { + typename K::Construct_vector_3 vector = K().construct_vector_3_object(); + typename K::Construct_cross_product_vector_3 cross_product = + K().construct_cross_product_vector_3_object(); + + const Vector_3 v1 = vector(p1, p2); + const Vector_3 v2 = vector(p3, p4); + + CGAL_assertion(K().coplanar_3_object()(p1,p2,p3,p4)); + + const Vector_3 v3 = vector(p1, p3); + const Vector_3 v3v2 = cross_product(v3,v2); + const Vector_3 v1v2 = cross_product(v1,v2); + const typename K::FT sl = K().compute_squared_length_3_object()(v1v2); + CGAL_assertion(!certainly(is_zero(sl))); + + const typename K::FT t = ((v3v2.x()*v1v2.x()) + (v3v2.y()*v1v2.y()) + (v3v2.z()*v1v2.z())) / sl; + return t; // p1 + (p2-p1) * t + } + }; + template class Construct_point_on_2 { diff --git a/Kernel_23/include/CGAL/Kernel/interface_macros.h b/Kernel_23/include/CGAL/Kernel/interface_macros.h index 9c85643a977..e5a2ebf8121 100644 --- a/Kernel_23/include/CGAL/Kernel/interface_macros.h +++ b/Kernel_23/include/CGAL/Kernel/interface_macros.h @@ -396,6 +396,8 @@ CGAL_Kernel_cons(Construct_plane_3, construct_plane_3_object) CGAL_Kernel_cons(Construct_plane_line_intersection_point_3, construct_plane_line_intersection_point_3_object) +CGAL_Kernel_cons(Compute_alpha_for_coplanar_triangle_intersection_3, + compute_alpha_for_coplanar_triangle_intersection_3_object) CGAL_Kernel_cons(Construct_point_on_2, construct_point_on_2_object) CGAL_Kernel_cons(Construct_point_on_3, diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 6b664ec360b..6c8ba3f8cd2 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -386,7 +386,7 @@ void coplanar_intersections(const std::array& t1, //intersect t2 with the three half planes which intersection defines t1 K k; - intersection_coplanar_triangles_cutoff(p1,q1,r1,0,p2,q2,r2,k,l_inter_pts); //line p1q1 + Intersections::internal::intersection_coplanar_triangles_cutoff(p1,q1,r1,0,p2,q2,r2,k,l_inter_pts); //line p1q1 #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION std::cout << " ipts size: " << l_inter_pts.size() << "\n"; print_points(); @@ -401,7 +401,7 @@ void coplanar_intersections(const std::array& t1, } } #endif - intersection_coplanar_triangles_cutoff(q1,r1,p1,1,p2,q2,r2,k,l_inter_pts); //line q1r1 + Intersections::internal::intersection_coplanar_triangles_cutoff(q1,r1,p1,1,p2,q2,r2,k,l_inter_pts); //line q1r1 #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION std::cout << " ipts size: " << l_inter_pts.size() << "\n"; print_points(); @@ -416,7 +416,7 @@ void coplanar_intersections(const std::array& t1, } } #endif - intersection_coplanar_triangles_cutoff(r1,p1,q1,2,p2,q2,r2,k,l_inter_pts); //line r1p1 + Intersections::internal::intersection_coplanar_triangles_cutoff(r1,p1,q1,2,p2,q2,r2,k,l_inter_pts); //line r1p1 #ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION std::cout << " ipts size: " << l_inter_pts.size() << "\n"; print_points(); From 0684bd203fa818c1dbf6cb4b3fae839e08da94a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 8 Jun 2023 14:17:18 +0200 Subject: [PATCH 076/139] hide debug --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 6c8ba3f8cd2..90174e42753 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -49,7 +49,7 @@ #define TEST_RESOLVE_INTERSECTION #define DEDUPLICATE_SEGMENTS -#define USE_DEBUG_PARALLEL_TIMERS +//#define USE_DEBUG_PARALLEL_TIMERS //#define DEBUG_COUNTERS //#define USE_FIXED_PROJECTION_TRAITS //#define DEBUG_DEPTH @@ -1248,8 +1248,6 @@ void autorefine_soup_output(const PointRange& input_points, #ifdef DEDUPLICATE_SEGMENTS // deduplicate inserted segments //TODO: PARALLEL_FOR #3 - Real_timer t3; - t3.start(); std::vector>> all_segments_ids(all_segments.size()); auto deduplicate_inserted_segments = [&](std::size_t ti) From c5fab1c874248e87abe1f769616f624f8bd0efdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 8 Jun 2023 14:21:59 +0200 Subject: [PATCH 077/139] fix sequential run --- .../CGAL/Polygon_mesh_processing/autorefinement.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 90174e42753..11b15fa4ec4 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1307,11 +1307,10 @@ void autorefine_soup_output(const PointRange& input_points, ); } else -#else - for (std::size_t ti = 0; ti < triangles.size(); ++ti) { - deduplicate_inserted_segments(ti); - } #endif + for (std::size_t ti = 0; ti < triangles.size(); ++ti) { + deduplicate_inserted_segments(ti); + } #ifdef USE_DEBUG_PARALLEL_TIMERS std::cout << t.time() << " sec. for #3" << std::endl; @@ -1385,11 +1384,10 @@ void autorefine_soup_output(const PointRange& input_points, ); } else -#else - for (std::size_t ti = 0; ti < triangles.size(); ++ti) { - refine_triangles(ti); - } #endif + for (std::size_t ti = 0; ti < triangles.size(); ++ti) { + refine_triangles(ti); + } #ifdef USE_DEBUG_PARALLEL_TIMERS t.stop(); From 45c7b0015f8f54e8f2fb517b6f5bc54181979467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 12 Jun 2023 10:55:56 +0200 Subject: [PATCH 078/139] add stop --- .../examples/Polygon_mesh_processing/soup_autorefinement.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp index 823c50974dc..9e4999287f7 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp @@ -37,6 +37,7 @@ int main(int argc, char** argv) PMP::autorefine_soup_output(input_points, input_triangles, output_points, output_triangles, CGAL::parameters::concurrency_tag(CGAL::Parallel_if_available_tag())); + t.stop(); std::cout << "#points = " << output_points.size() << " and #triangles = " << output_triangles.size() << " in " << t.time() << " sec." << std::endl; CGAL::IO::write_polygon_soup("autorefined.off", output_points, output_triangles, CGAL::parameters::stream_precision(17)); From 41449d71cd3c3d7b8be578f0e3f56a3a14fc5842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 12 Jun 2023 11:05:11 +0200 Subject: [PATCH 079/139] fix bug when setting the ids of points 2 options, one with mutex and one without. As this section is not critical, we do not really see a runtime difference (without mutex seems faster so I pick that one as default) --- .../Polygon_mesh_processing/autorefinement.h | 129 ++++++++++++++---- 1 file changed, 103 insertions(+), 26 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 11b15fa4ec4..9bbc67efb48 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -43,6 +43,9 @@ #include #include #include +#ifdef SET_POINT_IDS_USING_MUTEX +#include +#endif #endif #include @@ -1242,12 +1245,17 @@ void autorefine_soup_output(const PointRange& input_points, } } #ifdef USE_DEBUG_PARALLEL_TIMERS + t.stop(); std::cout << t.time() << " sec. for #2" << std::endl; + t.reset(); #endif #ifdef DEDUPLICATE_SEGMENTS +#ifdef USE_DEBUG_PARALLEL_TIMERS + t.start(); +#endif + // deduplicate inserted segments - //TODO: PARALLEL_FOR #3 std::vector>> all_segments_ids(all_segments.size()); auto deduplicate_inserted_segments = [&](std::size_t ti) @@ -1313,7 +1321,9 @@ void autorefine_soup_output(const PointRange& input_points, } #ifdef USE_DEBUG_PARALLEL_TIMERS + t.stop(); std::cout << t.time() << " sec. for #3" << std::endl; + t.reset(); #endif #endif @@ -1370,7 +1380,6 @@ void autorefine_soup_output(const PointRange& input_points, #ifdef USE_DEBUG_PARALLEL_TIMERS - t.reset(); t.start(); #endif #ifdef CGAL_LINKED_WITH_TBB @@ -1427,8 +1436,7 @@ void autorefine_soup_output(const PointRange& input_points, return insert_res.first->second; }; - - + // TODO: parallel_for? std::vector input_point_ids; input_point_ids.reserve(input_points.size()); for (const auto& p : input_points) @@ -1451,9 +1459,7 @@ void autorefine_soup_output(const PointRange& input_points, } // import refined triangles - //TODO: PARALLEL_FOR #4 #ifdef USE_DEBUG_PARALLEL_TIMERS - t.reset(); t.start(); #endif @@ -1466,37 +1472,108 @@ void autorefine_soup_output(const PointRange& input_points, #ifdef CGAL_LINKED_WITH_TBB if(parallel_execution && new_triangles.size() > 100) { - tbb::concurrent_vector concurrent_soup_points; + +#ifdef SET_POINT_IDS_USING_MUTEX + //option 1 (using a mutex) + CGAL_MUTEX point_container_mutex; /// Lambda concurrent_get_point_id() - auto concurrent_get_point_id = [&](const typename EK::Point_3& pt) + auto concurrent_get_point_id = [&](const typename EK::Point_3 pt) { - auto insert_res = point_id_map.insert(std::make_pair(pt, concurrent_soup_points.size())); - if (insert_res.second) - { - concurrent_soup_points.push_back(to_input(pt)); + auto insert_res = point_id_map.insert(std::make_pair(pt, -1)); + + if (insert_res.second) + { + CGAL_SCOPED_LOCK(point_container_mutex); + insert_res.first->second=soup_points.size(); + soup_points.push_back(to_input(pt)); #if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) - exact_soup_points.push_back(pt); + exact_soup_points.push_back(pt); #endif - } - return insert_res.first->second; + } + return insert_res.first; }; - soup_triangles.resize(offset + new_triangles.size()); + //use map iterator triple for triangles to create them concurrently and safely + std::vector::iterator, 3>> triangle_buffer(new_triangles.size()); tbb::parallel_for(tbb::blocked_range(0, new_triangles.size()), - [&](const tbb::blocked_range& r) { - for (size_t ti = r.begin(); ti != r.end(); ++ti) { - if (offset + ti > soup_triangles.size()) { - std::cout << "ti = " << ti << std::endl; - } - const std::array& t = new_triangles[ti]; - soup_triangles[offset + ti] = CGAL::make_array(concurrent_get_point_id(t[0]), concurrent_get_point_id(t[1]), concurrent_get_point_id(t[2])); - } + [&](const tbb::blocked_range& r) { + for (size_t ti = r.begin(); ti != r.end(); ++ti) { + const std::array& t = new_triangles[ti]; + triangle_buffer[ti] = CGAL::make_array(concurrent_get_point_id(t[0]), concurrent_get_point_id(t[1]), concurrent_get_point_id(t[2])); + } + } + ); + tbb::parallel_for(tbb::blocked_range(0, new_triangles.size()), + [&](const tbb::blocked_range& r) { + for (size_t ti = r.begin(); ti != r.end(); ++ti) + { + soup_triangles[offset + ti] = + CGAL::make_array(triangle_buffer[ti][0]->second, + triangle_buffer[ti][1]->second, + triangle_buffer[ti][2]->second); + } } ); +#else + //option 2 (without mutex) + /// Lambda concurrent_get_point_id() + tbb::concurrent_vector::iterator> iterators; + auto concurrent_get_point_id = [&](const typename EK::Point_3 pt) + { + auto insert_res = point_id_map.insert(std::make_pair(pt, -1)); + if (insert_res.second) + iterators.push_back(insert_res.first); + return insert_res.first; + }; - soup_points.reserve(soup_points.size() + concurrent_soup_points.size()); - soup_points.insert(soup_points.end(), concurrent_soup_points.begin(), concurrent_soup_points.end()); + //use map iterator triple for triangles to create them concurrently and safely + soup_triangles.resize(offset + new_triangles.size()); + std::vector::iterator, 3>> triangle_buffer(new_triangles.size()); + tbb::parallel_for(tbb::blocked_range(0, new_triangles.size()), + [&](const tbb::blocked_range& r) { + for (size_t ti = r.begin(); ti != r.end(); ++ti) { + if (offset + ti > soup_triangles.size()) { + std::cout << "ti = " << ti << std::endl; + } + const std::array& t = new_triangles[ti]; + triangle_buffer[ti] = CGAL::make_array(concurrent_get_point_id(t[0]), concurrent_get_point_id(t[1]), concurrent_get_point_id(t[2])); + } + } + ); + + // the map is now filled we can safely set the point ids + std::size_t pid_offset=soup_points.size(); + soup_points.resize(pid_offset+iterators.size()); +#if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) + exact_soup_points.resize(soup_points.size()); +#endif + + tbb::parallel_for(tbb::blocked_range(0, iterators.size()), + [&](const tbb::blocked_range& r) { + for (size_t ti = r.begin(); ti != r.end(); ++ti) + { + soup_points[pid_offset+ti] = to_input(iterators[ti]->first); +#if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) + exact_soup_points[pid_offset+ti] = iterators[ti]->first; +#endif + iterators[ti]->second=pid_offset+ti; + } + } + ); + + tbb::parallel_for(tbb::blocked_range(0, new_triangles.size()), + [&](const tbb::blocked_range& r) { + for (size_t ti = r.begin(); ti != r.end(); ++ti) + { + soup_triangles[offset + ti] = + CGAL::make_array(triangle_buffer[ti][0]->second, + triangle_buffer[ti][1]->second, + triangle_buffer[ti][2]->second); + } + } + ); +#endif } else #endif From a8a3d8ab36cf3ad0880aa21dc49c2d29c96df656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 6 Jul 2023 15:39:08 +0200 Subject: [PATCH 080/139] add functor to compute the intersection of 3 independant planes --- .../include/CGAL/Kernel/function_objects.h | 36 +++++++++++++++++++ .../include/CGAL/Kernel/interface_macros.h | 2 ++ 2 files changed, 38 insertions(+) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index e307e28ae1f..438dc0de14b 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -2192,6 +2192,42 @@ namespace CommonKernelFunctors { } }; + template + class Construct_planes_intersection_point_3 + { + typedef typename K::Plane_3 Plane; + typedef typename K::Point_3 Point; + typename K::Construct_plane_3 construct_plane; + public: + typedef Point result_type; + + Point + operator()(const Point& p1, const Point& q1, const Point& r1, + const Point& p2, const Point& q2, const Point& r2, + const Point& p3, const Point& q3, const Point& r3) const + { + Plane plane1 = construct_plane(p1, q1, r1); + Plane plane2 = construct_plane(p2, q2, r2); + Plane plane3 = construct_plane(p3, q3, r3); + + const auto res = typename K::Intersect_3()(plane1, plane2, plane3); + CGAL_assertion(res!=boost::none); + const Point* e_pt = boost::get(&(*res)); + CGAL_assertion(e_pt!=nullptr); + return *e_pt; + } + + Point + operator()(const Plane& plane1, const Plane& plane2, const Plane& plane3) const + { + const auto res = typename K::Intersect_3()(plane1, plane2, plane3); + CGAL_assertion(res!=boost::none); + const Point* e_pt = boost::get(&(*res)); + CGAL_assertion(e_pt!=nullptr); + return *e_pt; + } + }; + template class Compute_alpha_for_coplanar_triangle_intersection_3 { diff --git a/Kernel_23/include/CGAL/Kernel/interface_macros.h b/Kernel_23/include/CGAL/Kernel/interface_macros.h index 1360aa1bbcd..0acc0a4c690 100644 --- a/Kernel_23/include/CGAL/Kernel/interface_macros.h +++ b/Kernel_23/include/CGAL/Kernel/interface_macros.h @@ -398,6 +398,8 @@ CGAL_Kernel_cons(Construct_plane_3, construct_plane_3_object) CGAL_Kernel_cons(Construct_plane_line_intersection_point_3, construct_plane_line_intersection_point_3_object) +CGAL_Kernel_cons(Construct_planes_intersection_point_3, + construct_planes_intersection_point_3_object) CGAL_Kernel_cons(Compute_alpha_for_coplanar_triangle_intersection_3, compute_alpha_for_coplanar_triangle_intersection_3_object) CGAL_Kernel_cons(Construct_point_on_2, From a0658b6423c95f108868f6ce5c65ad1b7b1149ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 6 Jul 2023 15:51:04 +0200 Subject: [PATCH 081/139] track coplanar triangles and use direct point construction --- .../Polygon_mesh_processing/autorefinement.h | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 9bbc67efb48..68241773f37 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -167,9 +167,7 @@ do_coplanar_segments_intersect(std::size_t pi, std::size_t qi, } } - // supporting_line intersects: points are coplanar - // TODO: check if we can write a dedicated predicate taking advantage of p,q being shared ::CGAL::Orientation pqr = cpl_orient(p, q, r); ::CGAL::Orientation pqs = cpl_orient(p, q, s); @@ -609,7 +607,7 @@ void test_edge(const typename K::Point_3& p, const typename K::Point_3& q, } template -void collect_intersections(const std::array& t1, +bool collect_intersections(const std::array& t1, const std::array& t2, std::vector& inter_pts) { @@ -626,7 +624,7 @@ void collect_intersections(const std::array& t1, if (depth(p)>2) throw std::runtime_error("Depth is not 4: "+std::to_string(depth(p))); #endif - return; + return true; } for (int i=0; i<3; ++i) @@ -653,6 +651,8 @@ void collect_intersections(const std::array& t1, for (auto p : inter_pts) if (depth(p)>2) throw std::runtime_error("Depth is not 2: "+std::to_string(depth(p))); #endif + + return false; } ////////////////////////////////// @@ -672,6 +672,7 @@ void generate_subtriangles(std::size_t ti, std::vector& points, const std::vector& in_triangle_ids, const std::set >& intersecting_triangles, + const std::set >& coplanar_triangles, const std::vector>& triangles, PointVector& new_triangles ) @@ -789,11 +790,6 @@ void generate_subtriangles(std::size_t ti, { std::size_t nbs = segments.size(); - auto supporting_plane = [](const std::array& t) - { - return typename EK::Plane_3(t[0], t[1], t[2]); - }; - std::vector< std::vector > points_on_segments(nbs); COUNTER_INSTRUCTION(counter.timer1.start();) @@ -868,17 +864,19 @@ void generate_subtriangles(std::size_t ti, } case POINT_INTERSECTION: { - // TODO: use version with no variant - COUNTER_INSTRUCTION(counter.timer6.start();) - auto res = CGAL::intersection(supporting_plane(triangles[in_triangle_ids[i]]), - supporting_plane(triangles[in_triangle_ids[j]]), - supporting_plane(triangles[ti])); - COUNTER_INSTRUCTION(counter.timer6.stop();) - - if (const typename EK::Point_3* pt_ptr = boost::get(&(*res))) + if ( coplanar_triangles.count(CGAL::make_sorted_pair(in_triangle_ids[i], in_triangle_ids[j])) == 0 + && coplanar_triangles.count(CGAL::make_sorted_pair(ti, in_triangle_ids[j])) == 0 + && coplanar_triangles.count(CGAL::make_sorted_pair(in_triangle_ids[i], ti)) == 0) { + COUNTER_INSTRUCTION(counter.timer6.start();) + typename EK::Point_3 pt = typename EK::Construct_planes_intersection_point_3()( + triangles[in_triangle_ids[i]][0], triangles[in_triangle_ids[i]][1],triangles[in_triangle_ids[i]][2], + triangles[in_triangle_ids[j]][0], triangles[in_triangle_ids[j]][1],triangles[in_triangle_ids[j]][2], + triangles[ti][0], triangles[ti][1],triangles[ti][2]); + COUNTER_INSTRUCTION(counter.timer6.stop();) + COUNTER_INSTRUCTION(++counter.c1;) - std::size_t pid = get_point_id(*pt_ptr); + std::size_t pid = get_point_id(pt); points_on_segments[i].push_back(pid); points_on_segments[j].push_back(pid); } @@ -1198,7 +1196,8 @@ void autorefine_soup_output(const PointRange& input_points, Real_timer t; t.start(); #endif - std::set > intersecting_triangles; + std::set > intersecting_triangles; // TODO replace with vector>> + std::set > coplanar_triangles; // TODO replace with vector>> //TODO: PARALLEL_FOR #2 for (const Pair_of_triangle_ids& p : si_pairs) { @@ -1211,7 +1210,7 @@ void autorefine_soup_output(const PointRange& input_points, const std::array& t2 = triangles[i2]; std::vector inter_pts; - autorefine_impl::collect_intersections(t1, t2, inter_pts); + bool triangles_are_coplanar = autorefine_impl::collect_intersections(t1, t2, inter_pts); CGAL_assertion( CGAL::do_intersect(typename EK::Triangle_3(t1[0], t1[1], t1[2]), typename EK::Triangle_3(t2[0], t2[1], t2[2])) @@ -1242,6 +1241,8 @@ void autorefine_soup_output(const PointRange& input_points, } } intersecting_triangles.insert(CGAL::make_sorted_pair(i1, i2)); + if (triangles_are_coplanar) + coplanar_triangles.insert(CGAL::make_sorted_pair(i1, i2)); } } #ifdef USE_DEBUG_PARALLEL_TIMERS @@ -1369,7 +1370,7 @@ void autorefine_soup_output(const PointRange& input_points, autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); } #else - autorefine_impl::generate_subtriangles(ti, all_segments_ids[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); + autorefine_impl::generate_subtriangles(ti, all_segments_ids[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, coplanar_triangles, triangles, new_triangles); #endif } From bab2c72674903679a632566debb595c34505efe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 6 Jul 2023 16:53:51 +0200 Subject: [PATCH 082/139] add functor to compute intersection point of coplanar segments --- .../include/CGAL/Kernel/function_objects.h | 34 +++++++++++++++++++ .../include/CGAL/Kernel/interface_macros.h | 2 ++ 2 files changed, 36 insertions(+) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 438dc0de14b..6917a06edcf 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -2228,6 +2228,40 @@ namespace CommonKernelFunctors { } }; + template + class Construct_coplanar_segments_intersection_point_3 + { + typedef typename K::Segment_3 Segment; + typedef typename K::Point_3 Point; + typename K::Construct_segment_3 construct_segment; + public: + typedef Point result_type; + + Point + operator()(const Point& p1, const Point& q1, + const Point& p2, const Point& q2) const + { + Segment s1 = construct_segment(p1, q1); + Segment s2 = construct_segment(p2, q2); + + const auto res = typename K::Intersect_3()(s1, s2); + CGAL_assertion(res!=boost::none); + const Point* e_pt = boost::get(&(*res)); + CGAL_assertion(e_pt!=nullptr); + return *e_pt; + } + + Point + operator()(const Segment& s1, const Segment& s2) const + { + const auto res = typename K::Intersect_3()(s1, s2); + CGAL_assertion(res!=boost::none); + const Point* e_pt = boost::get(&(*res)); + CGAL_assertion(e_pt!=nullptr); + return *e_pt; + } + }; + template class Compute_alpha_for_coplanar_triangle_intersection_3 { diff --git a/Kernel_23/include/CGAL/Kernel/interface_macros.h b/Kernel_23/include/CGAL/Kernel/interface_macros.h index 0acc0a4c690..a2314aef1b7 100644 --- a/Kernel_23/include/CGAL/Kernel/interface_macros.h +++ b/Kernel_23/include/CGAL/Kernel/interface_macros.h @@ -400,6 +400,8 @@ CGAL_Kernel_cons(Construct_plane_line_intersection_point_3, construct_plane_line_intersection_point_3_object) CGAL_Kernel_cons(Construct_planes_intersection_point_3, construct_planes_intersection_point_3_object) +CGAL_Kernel_cons(Construct_coplanar_segments_intersection_point_3, + construct_coplanar_segments_intersection_point_3_object) CGAL_Kernel_cons(Compute_alpha_for_coplanar_triangle_intersection_3, compute_alpha_for_coplanar_triangle_intersection_3_object) CGAL_Kernel_cons(Construct_point_on_2, From e7490ee31fe90b243c558b3742614bd0785f9796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 6 Jul 2023 16:54:37 +0200 Subject: [PATCH 083/139] use direct construction of coplanar segment intersection --- .../Polygon_mesh_processing/autorefinement.h | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 68241773f37..693c00676f0 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -884,20 +884,13 @@ void generate_subtriangles(std::size_t ti, { COUNTER_INSTRUCTION(++counter.c2;) COUNTER_INSTRUCTION(counter.timer4.start();) - //TODO find better! - typename EK::Segment_3 s1(points[segments[i].first], points[segments[i].second]); - typename EK::Segment_3 s2(points[segments[j].first], points[segments[j].second]);// TODO: avoid this construction - auto inter = CGAL::intersection(s1, s2); - if (inter == boost::none) throw std::runtime_error("Unexpected case #2"); - if (const typename EK::Point_3* pt_ptr = boost::get(&(*inter))) - { - std::size_t pid = get_point_id(*pt_ptr); - points_on_segments[i].push_back(pid); - points_on_segments[j].push_back(pid); - break; - } - else - throw std::runtime_error("Unexpected case 1"); + typename EK::Point_3 pt = typename EK::Construct_coplanar_segments_intersection_point_3()( + points[segments[i].first], points[segments[i].second], + points[segments[j].first], points[segments[j].second]); + + std::size_t pid = get_point_id(pt); + points_on_segments[i].push_back(pid); + points_on_segments[j].push_back(pid); COUNTER_INSTRUCTION(counter.timer4.stop();) //~ std::ofstream debug ("/tmp/triangles.polylines.txt"); //~ debug << "4 " << triangles[ti][0] << " " << triangles[ti][1] << " " << triangles[ti][2] << " " << triangles[ti][0] << "\n"; From 806ffa9385e985216b34f870ad21b32982c2272e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 6 Jul 2023 17:40:28 +0200 Subject: [PATCH 084/139] remove TODO I don't think a predicate sorting planes along a ray would be faster than directly using intersection coordinates --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 693c00676f0..122c595b13e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -959,7 +959,6 @@ void generate_subtriangles(std::size_t ti, { if(!points_on_segments[i].empty()) { - // TODO: predicate on input triangles int coord = 0; std::size_t src_id = segments[i].first, tgt_id = segments[i].second; typename EK::Point_3 src = points[src_id], tgt=points[tgt_id]; From fdb6b799a9f41d5cfea056801196504351b4da5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 21 Jul 2023 13:32:25 +0200 Subject: [PATCH 085/139] add doc + do the autorefine inplace for the soup --- .../PackageDescription.txt | 2 + .../soup_autorefinement.cpp | 11 +- .../Polygon_mesh_processing/autorefinement.h | 174 ++++++++++++------ 3 files changed, 119 insertions(+), 68 deletions(-) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt index b17c41399d0..95d8794cca1 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt @@ -109,6 +109,8 @@ The page \ref bgl_namedparameters "Named Parameters" describes their usage. - `CGAL::Polygon_mesh_processing::surface_intersection()` - `CGAL::Polygon_mesh_processing::clip()` - `CGAL::Polygon_mesh_processing::split()` +- `CGAL::Polygon_mesh_processing::autorefine_triangle_soup()` +- `CGAL::Polygon_mesh_processing::autorefine()` \cgalCRPSection{Meshing Functions} - \link PMP_meshing_grp `CGAL::Polygon_mesh_processing::isotropic_remeshing()` \endlink diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp index 9e4999287f7..a44d47c8b6d 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp @@ -32,14 +32,11 @@ int main(int argc, char** argv) CGAL::Real_timer t; t.start(); - std::vector output_points; - std::vector> output_triangles; - PMP::autorefine_soup_output(input_points, input_triangles, - output_points, output_triangles, - CGAL::parameters::concurrency_tag(CGAL::Parallel_if_available_tag())); + PMP::autorefine_triangle_soup(input_points, input_triangles, + CGAL::parameters::concurrency_tag(CGAL::Parallel_if_available_tag())); t.stop(); - std::cout << "#points = " << output_points.size() << " and #triangles = " << output_triangles.size() << " in " << t.time() << " sec." << std::endl; - CGAL::IO::write_polygon_soup("autorefined.off", output_points, output_triangles, CGAL::parameters::stream_precision(17)); + std::cout << "#points = " << input_points.size() << " and #triangles = " << input_triangles.size() << " in " << t.time() << " sec." << std::endl; + CGAL::IO::write_polygon_soup("autorefined.off", input_points, input_triangles, CGAL::parameters::stream_precision(17)); return 0; } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 122c595b13e..bfa65df1c73 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -31,10 +31,15 @@ #endif // output -#include +#include #include #include + +#ifdef CGAL_PMP_AUTOREFINE_USE_DEFAULT_VERBOSE +#define CGAL_PMP_AUTOREFINE_VERBOSE(X) std::cout << X << "\n"; +#endif + #ifndef CGAL_PMP_AUTOREFINE_VERBOSE #define CGAL_PMP_AUTOREFINE_VERBOSE(MSG) #endif @@ -1100,13 +1105,54 @@ void generate_subtriangles(std::size_t ti, } } // end of autorefine_impl +#endif -template -void autorefine_soup_output(const PointRange& input_points, - const TriIdsRange& id_triples, - std::vector& soup_points, - std::vector >& soup_triangles, - const NamedParameters& np = parameters::default_values()) +/** +* \ingroup PMP_corefinement_grp +* +* refines a soup of triangles so that no pair of triangles intersects in their interior. +* Note that points in `input_points` can only be added (intersection points) a the end of the container, with the initial order preserved. +* Note that if `input_points` contains two or more identical points and only the first copy (following the order in the `input_points`) +* will be used in `id_triples`. +* `id_triples` will be updated to contain both the input triangles and the new subdivides triangles. Degenerate triangles will be removed. +* Also triangles in `id_triples` will be triangles without intersection first, followed by triangles coming from a subdivision induced +* by an intersection. The named parameter `visitor()` can be used to track +* +* @tparam PointRange a model of the concept `RandomAccessContainer` +* whose value type is the point type +* @tparam TriIdsRange a model of the concepts `RandomAccessContainer`, `BackInsertionSequence` and `Swappable`, whose +* value type is a model of the concept `RandomAccessContainer` whose value type is convertible to `std::size_t` and that +* is constructible from an `std::initializer_list` of size 3. +* @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" +* +* @param input_points points of the soup of polygons +* @param id_triples each element in the range describes a triangle using the indexed position of the points in `input_points` +* @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below +* +* \cgalNamedParamsBegin +* \cgalParamNBegin{point_map} +* \cgalParamDescription{a property map associating points to the elements of the range `input_points`} +* \cgalParamType{a model of `ReadWritePropertyMap` whose value type is a point type} +* \cgalParamDefault{`CGAL::Identity_property_map`} +* \cgalParamNEnd +* \cgalParamNBegin{geom_traits} +* \cgalParamDescription{an instance of a geometric traits class} +* \cgalParamType{a class model of `Kernel`} +* \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} +* \cgalParamExtra{The geometric traits class must be compatible with the point type.} +* \cgalParamNEnd +* \cgalParamNBegin{visitor} +* \cgalParamDescription{a visitor used to track the creation of new faces} +* \cgalParamType{a class model of `PMPFooBar`} +* \cgalParamDefault{`Autorefinement::Default_visitor`} +* \cgalParamNEnd +* \cgalNamedParamsEnd +* +*/ +template +void autorefine_triangle_soup(PointRange& input_points, + TriIdsRange& id_triples, + const NamedParameters& np = parameters::default_values()) { using parameters::choose_parameter; using parameters::get_parameter; @@ -1121,14 +1167,13 @@ void autorefine_soup_output(const PointRange& input_points, Sequential_tag > ::type Concurrency_tag; - constexpr bool parallel_execution = std::is_same::value; + constexpr bool parallel_execution = std::is_same_v; #ifndef CGAL_LINKED_WITH_TBB - CGAL_static_assertion_msg (parallel_execution, - "Parallel_tag is enabled but TBB is unavailable."); + static_assert (!parallel_execution, + "Parallel_tag is enabled but TBB is unavailable."); #endif - typedef std::size_t Input_TID; typedef std::pair Pair_of_triangle_ids; @@ -1334,7 +1379,6 @@ void autorefine_soup_output(const PointRange& input_points, boost::timer::progress_display pd(triangles.size()); #endif - auto refine_triangles = [&](std::size_t ti) { if (all_segments[ti].empty() && all_points[ti].empty()) @@ -1371,7 +1415,6 @@ void autorefine_soup_output(const PointRange& input_points, #endif }; - #ifdef USE_DEBUG_PARALLEL_TIMERS t.start(); #endif @@ -1415,25 +1458,22 @@ void autorefine_soup_output(const PointRange& input_points, std::vector exact_soup_points; #endif - /// Lambda get_point_id() - auto get_point_id = [&](const typename EK::Point_3& pt) - { - auto insert_res = point_id_map.insert(std::make_pair(pt, soup_points.size())); - if (insert_res.second) - { - soup_points.push_back(to_input(pt)); -#if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) - exact_soup_points.push_back(pt); -#endif - } - return insert_res.first->second; - }; - // TODO: parallel_for? - std::vector input_point_ids; - input_point_ids.reserve(input_points.size()); - for (const auto& p : input_points) - input_point_ids.push_back(get_point_id(to_exact(get(pm,p)))); + // for input points, we on purpose keep duplicated points and isolated points + for (std::size_t pid = 0; pidfirst); +#endif + } + + TriIdsRange soup_triangles; + soup_triangles.reserve(id_triples.size()); // TODO: remove #deg tri? // raw copy of input triangles with no intersection for (Input_TID f=0; fsecond; + }; + #ifdef USE_DEBUG_PARALLEL_TIMERS t.start(); #endif @@ -1465,7 +1518,6 @@ void autorefine_soup_output(const PointRange& input_points, #ifdef CGAL_LINKED_WITH_TBB if(parallel_execution && new_triangles.size() > 100) { - #ifdef SET_POINT_IDS_USING_MUTEX //option 1 (using a mutex) CGAL_MUTEX point_container_mutex; @@ -1477,8 +1529,8 @@ void autorefine_soup_output(const PointRange& input_points, if (insert_res.second) { CGAL_SCOPED_LOCK(point_container_mutex); - insert_res.first->second=soup_points.size(); - soup_points.push_back(to_input(pt)); + insert_res.first->second=input_points.size(); + input_points.push_back(to_input(pt)); #if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) exact_soup_points.push_back(pt); #endif @@ -1502,9 +1554,9 @@ void autorefine_soup_output(const PointRange& input_points, for (size_t ti = r.begin(); ti != r.end(); ++ti) { soup_triangles[offset + ti] = - CGAL::make_array(triangle_buffer[ti][0]->second, - triangle_buffer[ti][1]->second, - triangle_buffer[ti][2]->second); + { triangle_buffer[ti][0]->second, + triangle_buffer[ti][1]->second, + triangle_buffer[ti][2]->second }; } } ); @@ -1536,17 +1588,17 @@ void autorefine_soup_output(const PointRange& input_points, ); // the map is now filled we can safely set the point ids - std::size_t pid_offset=soup_points.size(); - soup_points.resize(pid_offset+iterators.size()); + std::size_t pid_offset=input_points.size(); + input_points.resize(pid_offset+iterators.size()); #if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) - exact_soup_points.resize(soup_points.size()); + exact_soup_points.resize(input_points.size()); #endif tbb::parallel_for(tbb::blocked_range(0, iterators.size()), [&](const tbb::blocked_range& r) { for (size_t ti = r.begin(); ti != r.end(); ++ti) { - soup_points[pid_offset+ti] = to_input(iterators[ti]->first); + input_points[pid_offset+ti] = to_input(iterators[ti]->first); #if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) exact_soup_points[pid_offset+ti] = iterators[ti]->first; #endif @@ -1560,9 +1612,9 @@ void autorefine_soup_output(const PointRange& input_points, for (size_t ti = r.begin(); ti != r.end(); ++ti) { soup_triangles[offset + ti] = - CGAL::make_array(triangle_buffer[ti][0]->second, - triangle_buffer[ti][1]->second, - triangle_buffer[ti][2]->second); + { triangle_buffer[ti][0]->second, + triangle_buffer[ti][1]->second, + triangle_buffer[ti][2]->second }; } } ); @@ -1576,7 +1628,7 @@ void autorefine_soup_output(const PointRange& input_points, #endif soup_triangles.reserve(offset + new_triangles.size()); for (const std::array& t : new_triangles) - soup_triangles.emplace_back(CGAL::make_array(get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2]))); + soup_triangles.push_back({ get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2])}); } @@ -1597,9 +1649,11 @@ void autorefine_soup_output(const PointRange& input_points, throw std::runtime_error("ERROR: invalid output, there is most probably a bug"); #endif #endif + using std::swap; + swap(id_triples, soup_triangles); + CGAL_PMP_AUTOREFINE_VERBOSE("done"); } -#endif /** * \ingroup PMP_corefinement_grp @@ -1639,22 +1693,20 @@ autorefine( TriangleMesh& tm, using parameters::get_parameter; typedef typename GetGeomTraits::type GT; - GT traits = choose_parameter(get_parameter(np, internal_np::geom_traits)); + // GT traits = choose_parameter(get_parameter(np, internal_np::geom_traits)); - std::vector in_soup_points; - std::vector > in_soup_triangles; - std::vector out_soup_points; - std::vector > out_soup_triangles; + std::vector soup_points; + std::vector > soup_triangles; - polygon_mesh_to_polygon_soup(tm, in_soup_points, in_soup_triangles); + polygon_mesh_to_polygon_soup(tm, soup_points, soup_triangles, np); - autorefine_soup_output(in_soup_points, in_soup_triangles, - out_soup_points, out_soup_triangles); + autorefine_triangle_soup(soup_points, soup_triangles); clear(tm); - repair_polygon_soup(out_soup_points, out_soup_triangles); - orient_polygon_soup(out_soup_points, out_soup_triangles); - polygon_soup_to_polygon_mesh(out_soup_points, out_soup_triangles, tm); + repair_polygon_soup(soup_points, soup_triangles); + + duplicate_non_manifold_edges_in_polygon_soup(soup_points, soup_triangles); + polygon_soup_to_polygon_mesh(soup_points, soup_triangles, tm); } From d6fdc85be9bb5c95b4fdf59379a67033a98b2d36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 21 Jul 2023 13:38:10 +0200 Subject: [PATCH 086/139] rename variables --- .../Polygon_mesh_processing/autorefinement.h | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index bfa65df1c73..0054a9dcdb2 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1111,11 +1111,11 @@ void generate_subtriangles(std::size_t ti, * \ingroup PMP_corefinement_grp * * refines a soup of triangles so that no pair of triangles intersects in their interior. -* Note that points in `input_points` can only be added (intersection points) a the end of the container, with the initial order preserved. -* Note that if `input_points` contains two or more identical points and only the first copy (following the order in the `input_points`) -* will be used in `id_triples`. -* `id_triples` will be updated to contain both the input triangles and the new subdivides triangles. Degenerate triangles will be removed. -* Also triangles in `id_triples` will be triangles without intersection first, followed by triangles coming from a subdivision induced +* Note that points in `soup_points` can only be added (intersection points) a the end of the container, with the initial order preserved. +* Note that if `soup_points` contains two or more identical points and only the first copy (following the order in the `soup_points`) +* will be used in `soup_triangles`. +* `soup_triangles` will be updated to contain both the input triangles and the new subdivides triangles. Degenerate triangles will be removed. +* Also triangles in `soup_triangles` will be triangles without intersection first, followed by triangles coming from a subdivision induced * by an intersection. The named parameter `visitor()` can be used to track * * @tparam PointRange a model of the concept `RandomAccessContainer` @@ -1125,13 +1125,13 @@ void generate_subtriangles(std::size_t ti, * is constructible from an `std::initializer_list` of size 3. * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" * -* @param input_points points of the soup of polygons -* @param id_triples each element in the range describes a triangle using the indexed position of the points in `input_points` +* @param soup_points points of the soup of polygons +* @param soup_triangles each element in the range describes a triangle using the indexed position of the points in `soup_points` * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below * * \cgalNamedParamsBegin * \cgalParamNBegin{point_map} -* \cgalParamDescription{a property map associating points to the elements of the range `input_points`} +* \cgalParamDescription{a property map associating points to the elements of the range `soup_points`} * \cgalParamType{a model of `ReadWritePropertyMap` whose value type is a point type} * \cgalParamDefault{`CGAL::Identity_property_map`} * \cgalParamNEnd @@ -1150,8 +1150,8 @@ void generate_subtriangles(std::size_t ti, * */ template -void autorefine_triangle_soup(PointRange& input_points, - TriIdsRange& id_triples, +void autorefine_triangle_soup(PointRange& soup_points, + TriIdsRange& soup_triangles, const NamedParameters& np = parameters::default_values()) { using parameters::choose_parameter; @@ -1181,12 +1181,12 @@ void autorefine_triangle_soup(PointRange& input_points, // collect intersecting pairs of triangles CGAL_PMP_AUTOREFINE_VERBOSE("collect intersecting pairs"); - triangle_soup_self_intersections(input_points, id_triples, std::back_inserter(si_pairs), np); + triangle_soup_self_intersections(soup_points, soup_triangles, std::back_inserter(si_pairs), np); if (si_pairs.empty()) return; // mark degenerate faces so that we can ignore them - std::vector is_degen(id_triples.size(), false); + std::vector is_degen(soup_triangles.size(), false); for (const Pair_of_triangle_ids& p : si_pairs) if (p.first==p.second) // bbox inter reports (f,f) for degenerate faces @@ -1194,7 +1194,7 @@ void autorefine_triangle_soup(PointRange& input_points, // assign an id per triangle involved in an intersection // + the faces involved in the intersection - std::vector tri_inter_ids(id_triples.size(), -1); + std::vector tri_inter_ids(soup_triangles.size(), -1); std::vector intersected_faces; int tiid=-1; for (const Pair_of_triangle_ids& p : si_pairs) @@ -1219,9 +1219,9 @@ void autorefine_triangle_soup(PointRange& input_points, for(Input_TID f : intersected_faces) { triangles[tri_inter_ids[f]]= CGAL::make_array( - to_exact( get(pm, input_points[id_triples[f][0]]) ), - to_exact( get(pm, input_points[id_triples[f][1]]) ), - to_exact( get(pm, input_points[id_triples[f][2]]) ) ); + to_exact( get(pm, soup_points[soup_triangles[f][0]]) ), + to_exact( get(pm, soup_points[soup_triangles[f][1]]) ), + to_exact( get(pm, soup_points[soup_triangles[f][2]]) ) ); } std::vector< std::vector > > all_segments(triangles.size()); @@ -1460,31 +1460,31 @@ void autorefine_triangle_soup(PointRange& input_points, // TODO: parallel_for? // for input points, we on purpose keep duplicated points and isolated points - for (std::size_t pid = 0; pidfirst); #endif } - TriIdsRange soup_triangles; - soup_triangles.reserve(id_triples.size()); // TODO: remove #deg tri? + TriIdsRange soup_triangles_out; + soup_triangles_out.reserve(soup_triangles.size()); // TODO: remove #deg tri? // raw copy of input triangles with no intersection - for (Input_TID f=0; fsecond=input_points.size(); - input_points.push_back(to_input(pt)); + insert_res.first->second=soup_points.size(); + soup_points.push_back(to_input(pt)); #if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) exact_soup_points.push_back(pt); #endif @@ -1538,7 +1538,7 @@ void autorefine_triangle_soup(PointRange& input_points, return insert_res.first; }; - soup_triangles.resize(offset + new_triangles.size()); + soup_triangles_out.resize(offset + new_triangles.size()); //use map iterator triple for triangles to create them concurrently and safely std::vector::iterator, 3>> triangle_buffer(new_triangles.size()); tbb::parallel_for(tbb::blocked_range(0, new_triangles.size()), @@ -1553,7 +1553,7 @@ void autorefine_triangle_soup(PointRange& input_points, [&](const tbb::blocked_range& r) { for (size_t ti = r.begin(); ti != r.end(); ++ti) { - soup_triangles[offset + ti] = + soup_triangles_out[offset + ti] = { triangle_buffer[ti][0]->second, triangle_buffer[ti][1]->second, triangle_buffer[ti][2]->second }; @@ -1573,12 +1573,12 @@ void autorefine_triangle_soup(PointRange& input_points, }; //use map iterator triple for triangles to create them concurrently and safely - soup_triangles.resize(offset + new_triangles.size()); + soup_triangles_out.resize(offset + new_triangles.size()); std::vector::iterator, 3>> triangle_buffer(new_triangles.size()); tbb::parallel_for(tbb::blocked_range(0, new_triangles.size()), [&](const tbb::blocked_range& r) { for (size_t ti = r.begin(); ti != r.end(); ++ti) { - if (offset + ti > soup_triangles.size()) { + if (offset + ti > soup_triangles_out.size()) { std::cout << "ti = " << ti << std::endl; } const std::array& t = new_triangles[ti]; @@ -1588,17 +1588,17 @@ void autorefine_triangle_soup(PointRange& input_points, ); // the map is now filled we can safely set the point ids - std::size_t pid_offset=input_points.size(); - input_points.resize(pid_offset+iterators.size()); + std::size_t pid_offset=soup_points.size(); + soup_points.resize(pid_offset+iterators.size()); #if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) - exact_soup_points.resize(input_points.size()); + exact_soup_points.resize(soup_points.size()); #endif tbb::parallel_for(tbb::blocked_range(0, iterators.size()), [&](const tbb::blocked_range& r) { for (size_t ti = r.begin(); ti != r.end(); ++ti) { - input_points[pid_offset+ti] = to_input(iterators[ti]->first); + soup_points[pid_offset+ti] = to_input(iterators[ti]->first); #if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) exact_soup_points[pid_offset+ti] = iterators[ti]->first; #endif @@ -1611,7 +1611,7 @@ void autorefine_triangle_soup(PointRange& input_points, [&](const tbb::blocked_range& r) { for (size_t ti = r.begin(); ti != r.end(); ++ti) { - soup_triangles[offset + ti] = + soup_triangles_out[offset + ti] = { triangle_buffer[ti][0]->second, triangle_buffer[ti][1]->second, triangle_buffer[ti][2]->second }; @@ -1626,9 +1626,9 @@ void autorefine_triangle_soup(PointRange& input_points, #ifdef USE_DEBUG_PARALLEL_TIMERS mode = "sequential"; #endif - soup_triangles.reserve(offset + new_triangles.size()); + soup_triangles_out.reserve(offset + new_triangles.size()); for (const std::array& t : new_triangles) - soup_triangles.push_back({ get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2])}); + soup_triangles_out.push_back({ get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2])}); } @@ -1641,16 +1641,16 @@ void autorefine_triangle_soup(PointRange& input_points, #ifndef CGAL_NDEBUG CGAL_PMP_AUTOREFINE_VERBOSE("check soup"); - CGAL_assertion( !does_triangle_soup_self_intersect(exact_soup_points, soup_triangles) ); + CGAL_assertion( !does_triangle_soup_self_intersect(exact_soup_points, soup_triangles_out) ); #else #ifdef CGAL_DEBUG_PMP_AUTOREFINE CGAL_PMP_AUTOREFINE_VERBOSE("check soup"); - if (does_triangle_soup_self_intersect(exact_soup_points, soup_triangles)) + if (does_triangle_soup_self_intersect(exact_soup_points, soup_triangles_out)) throw std::runtime_error("ERROR: invalid output, there is most probably a bug"); #endif #endif using std::swap; - swap(id_triples, soup_triangles); + swap(soup_triangles, soup_triangles_out); CGAL_PMP_AUTOREFINE_VERBOSE("done"); } From e1d7105c1cf58cabbd38d71cc3a5be8aa871ddf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 21 Jul 2023 16:47:03 +0200 Subject: [PATCH 087/139] add visitor + add calls to the visitor --- .../Concepts/PMPAutorefinementVisitor.h | 25 +++++++ .../Polygon_mesh_processing/autorefinement.h | 75 +++++++++++++++---- 2 files changed, 84 insertions(+), 16 deletions(-) create mode 100644 Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPAutorefinementVisitor.h diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPAutorefinementVisitor.h b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPAutorefinementVisitor.h new file mode 100644 index 00000000000..e3ef90e9be0 --- /dev/null +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPAutorefinementVisitor.h @@ -0,0 +1,25 @@ +/// \ingroup PkgPolygonMeshProcessingConcepts +/// \cgalConcept +/// +/// The concept `PMPAutorefinementVisitor` defines the requirements for the visitor +/// used in `CGAL::Polygon_mesh_processing::autorefine_triangle_soup()` to track +/// the creation of new triangles. +/// +/// \cgalRefines{CopyConstructible} +/// \cgalHasModel `CGAL::Polygon_mesh_processing::Autorefinement::Default_visitor`. + +class PMPAutorefinementVisitor{ +public: + +/// @name Functions called only if at least one intersection has been found +/// @{ + /// called when the final number of output triangles is known, `nbt` being the total number of triangles in the output. + void number_of_output_triangles(std::size_t nbt); + /// called for triangle with no intersection, `tgt_id` is the position in the triangle container after calling + /// `autorefine_triangle_soup()`, while `src_id` was its position before calling the function. + void verbatim_triangle_copy(std::size_t tgt_id, std::size_t src_id); + /// called for each subtriangle created from a triangle with intersection, `tgt_id` is the position in the triangle container after calling + /// `autorefine_triangle_soup()` of the subtriangle, while `src_id` was the position of the original support triangle before calling the function. + void new_subtriangle(std::size_t tgt_id, std::size_t src_id); +/// @} +}; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 0054a9dcdb2..166c950a983 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -77,6 +77,24 @@ namespace CGAL { namespace Polygon_mesh_processing { +namespace Autorefinement { + +/** \ingroup PMP_corefinement_grp + * %Default visitor model of `PMPAutorefinementVisitor`. + * All of its functions have an empty body. This class can be used as a + * base class if only some of the functions of the concept require to be + * overridden. + */ +struct Default_visitor +{ + inline void number_of_output_triangles(std::size_t /*nbt*/) {} + inline void verbatim_triangle_copy(std::size_t /*tgt_id*/, std::size_t /*src_id*/) {} + inline void new_subtriangle(std::size_t /*tgt_id*/, std::size_t /*src_id*/) {} +}; + +} // end of Autorefinement visitor + + #ifndef DOXYGEN_RUNNING namespace autorefine_impl { @@ -1079,13 +1097,13 @@ void generate_subtriangles(std::size_t ti, for (typename CDT::Face_handle fh : cdt.finite_face_handles()) { if (orientation_flipped) - new_triangles.push_back( CGAL::make_array(fh->vertex(0)->point(), - fh->vertex(cdt.cw(0))->point(), - fh->vertex(cdt.ccw(0))->point()) ); + new_triangles.push_back( { CGAL::make_array(fh->vertex(0)->point(), + fh->vertex(cdt.cw(0))->point(), + fh->vertex(cdt.ccw(0))->point()), ti } ); else - new_triangles.push_back( CGAL::make_array(fh->vertex(0)->point(), - fh->vertex(cdt.ccw(0))->point(), - fh->vertex(cdt.cw(0))->point()) ); + new_triangles.push_back( { CGAL::make_array(fh->vertex(0)->point(), + fh->vertex(cdt.ccw(0))->point(), + fh->vertex(cdt.cw(0))->point()), ti } ); #ifdef CGAL_DEBUG_PMP_AUTOREFINE_DUMP_TRIANGULATIONS ++nbt; buffer << fh->vertex(0)->point() << "\n"; @@ -1143,8 +1161,9 @@ void generate_subtriangles(std::size_t ti, * \cgalParamNEnd * \cgalParamNBegin{visitor} * \cgalParamDescription{a visitor used to track the creation of new faces} -* \cgalParamType{a class model of `PMPFooBar`} -* \cgalParamDefault{`Autorefinement::Default_visitor`} +* \cgalParamType{a class model of `PMPAutorefinementVisitor`} +* \cgalParamDefault{`Autorefinement::Default_visitor`} +* \cgalParamExtra{The visitor will be copied.} * \cgalParamNEnd * \cgalNamedParamsEnd * @@ -1167,6 +1186,15 @@ void autorefine_triangle_soup(PointRange& soup_points, Sequential_tag > ::type Concurrency_tag; + // visitor + typedef typename internal_np::Lookup_named_param_def < + internal_np::visitor_t, + NamedParameters, + Autorefinement::Default_visitor//default + > ::type Visitor; + Visitor visitor(choose_parameter(get_parameter(np, internal_np::visitor))); + + constexpr bool parallel_execution = std::is_same_v; #ifndef CGAL_LINKED_WITH_TBB @@ -1369,10 +1397,10 @@ void autorefine_triangle_soup(PointRange& soup_points, // now refine triangles #ifdef CGAL_LINKED_WITH_TBB std::conditional_t>, - std::vector>> new_triangles; + tbb::concurrent_vector, std::size_t>>, + std::vector, std::size_t>>> new_triangles; #else - std::vector> new_triangles; + std::vector, std::size_t>> new_triangles; #endif #ifdef USE_PROGRESS_DISPLAY @@ -1382,7 +1410,7 @@ void autorefine_triangle_soup(PointRange& soup_points, auto refine_triangles = [&](std::size_t ti) { if (all_segments[ti].empty() && all_points[ti].empty()) - new_triangles.push_back(triangles[ti]); + new_triangles.push_back({triangles[ti], ti}); else { #ifdef USE_FIXED_PROJECTION_TRAITS @@ -1475,7 +1503,10 @@ void autorefine_triangle_soup(PointRange& soup_points, TriIdsRange soup_triangles_out; soup_triangles_out.reserve(soup_triangles.size()); // TODO: remove #deg tri? + visitor.number_of_output_triangles(soup_triangles.size()+new_triangles.size()); + // raw copy of input triangles with no intersection + std::vector tri_inter_ids_inverse(triangles.size()); for (Input_TID f=0; f(0, new_triangles.size()), [&](const tbb::blocked_range& r) { for (size_t ti = r.begin(); ti != r.end(); ++ti) { - const std::array& t = new_triangles[ti]; + const std::array& t = new_triangles[ti].first; + visitor.new_subtriangle(offset+ti, tri_inter_ids_inverse[new_triangles[ti].second]); triangle_buffer[ti] = CGAL::make_array(concurrent_get_point_id(t[0]), concurrent_get_point_id(t[1]), concurrent_get_point_id(t[2])); } } @@ -1581,7 +1618,8 @@ void autorefine_triangle_soup(PointRange& soup_points, if (offset + ti > soup_triangles_out.size()) { std::cout << "ti = " << ti << std::endl; } - const std::array& t = new_triangles[ti]; + const std::array& t = new_triangles[ti].first; + visitor.new_subtriangle(offset+ti, tri_inter_ids_inverse[new_triangles[ti].second]); triangle_buffer[ti] = CGAL::make_array(concurrent_get_point_id(t[0]), concurrent_get_point_id(t[1]), concurrent_get_point_id(t[2])); } } @@ -1627,8 +1665,13 @@ void autorefine_triangle_soup(PointRange& soup_points, mode = "sequential"; #endif soup_triangles_out.reserve(offset + new_triangles.size()); - for (const std::array& t : new_triangles) - soup_triangles_out.push_back({ get_point_id(t[0]), get_point_id(t[1]), get_point_id(t[2])}); + for (const std::pair, std::size_t>& t_and_id : new_triangles) + { + visitor.new_subtriangle(soup_triangles_out.size(), tri_inter_ids_inverse[t_and_id.second]); + soup_triangles_out.push_back({ get_point_id(t_and_id.first[0]), + get_point_id(t_and_id.first[1]), + get_point_id(t_and_id.first[2]) }); + } } From 9822f371dded06a2538281c5f97b0d343a5c0939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 21 Jul 2023 16:54:21 +0200 Subject: [PATCH 088/139] doc precision --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 166c950a983..6bbb5571e7a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1702,6 +1702,9 @@ void autorefine_triangle_soup(PointRange& soup_points, * \ingroup PMP_corefinement_grp * refines a triangle mesh so that no triangles intersects in their interior. * + * Note that this function is only provided as a shortcut for calling `autorefine_triangle_soup()` + * with a mesh. For any advance usage the aforementioned function should be called directly. + * * @tparam TriangleMesh a model of `HalfedgeListGraph`, `FaceListGraph`, and `MutableFaceGraph` * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" * @@ -1745,7 +1748,7 @@ autorefine( TriangleMesh& tm, autorefine_triangle_soup(soup_points, soup_triangles); - clear(tm); + clear(tm); //TODO: keep properties repair_polygon_soup(soup_points, soup_triangles); duplicate_non_manifold_edges_in_polygon_soup(soup_points, soup_triangles); From d1779ca36d18ecc1be5d1fb50e9f66a66d47ea61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 21 Jul 2023 17:03:34 +0200 Subject: [PATCH 089/139] doc concurrency_tag --- .../CGAL/Polygon_mesh_processing/autorefinement.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 6bbb5571e7a..0fb843c31c0 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1148,6 +1148,11 @@ void generate_subtriangles(std::size_t ti, * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below * * \cgalNamedParamsBegin +* \cgalParamNBegin{concurrency_tag} +* \cgalParamDescription{a tag indicating if the task should be done using one or several threads.} +* \cgalParamType{Either `CGAL::Sequential_tag`, or `CGAL::Parallel_tag`, or `CGAL::Parallel_if_available_tag`} +* \cgalParamDefault{`CGAL::Sequential_tag`} +* \cgalParamNEnd * \cgalParamNBegin{point_map} * \cgalParamDescription{a property map associating points to the elements of the range `soup_points`} * \cgalParamType{a model of `ReadWritePropertyMap` whose value type is a point type} @@ -1712,6 +1717,11 @@ void autorefine_triangle_soup(PointRange& soup_points, * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below * * \cgalNamedParamsBegin + * \cgalParamNBegin{concurrency_tag} + * \cgalParamDescription{a tag indicating if the task should be done using one or several threads.} + * \cgalParamType{Either `CGAL::Sequential_tag`, or `CGAL::Parallel_tag`, or `CGAL::Parallel_if_available_tag`} + * \cgalParamDefault{`CGAL::Sequential_tag`} + * \cgalParamNEnd * \cgalParamNBegin{geom_traits} * \cgalParamDescription{an instance of a geometric traits class} * \cgalParamType{a class model of `PMPSelfIntersectionTraits`} @@ -1746,7 +1756,7 @@ autorefine( TriangleMesh& tm, polygon_mesh_to_polygon_soup(tm, soup_points, soup_triangles, np); - autorefine_triangle_soup(soup_points, soup_triangles); + autorefine_triangle_soup(soup_points, soup_triangles, np); clear(tm); //TODO: keep properties repair_polygon_soup(soup_points, soup_triangles); From 1f61a84e495f62b71570ad5962411adf4680eb54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 2 Aug 2023 10:30:05 +0200 Subject: [PATCH 090/139] add demo plugin that support refinement of one or several items (soup or mesh) --- .../Polyhedron/Plugins/PMP/CMakeLists.txt | 6 +- .../Plugins/PMP/Repair_polyhedron_plugin.cpp | 105 +++++++++++++++++- 2 files changed, 105 insertions(+), 6 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt index 152d84952ae..658458acaad 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt @@ -119,7 +119,11 @@ target_link_libraries( qt5_wrap_ui( repairUI_FILES RemoveNeedlesDialog.ui SelfSnapDialog.ui) polyhedron_demo_plugin(repair_polyhedron_plugin Repair_polyhedron_plugin ${repairUI_FILES} KEYWORDS PMP) -target_link_libraries(repair_polyhedron_plugin PUBLIC scene_points_with_normal_item scene_surface_mesh_item) +target_link_libraries(repair_polyhedron_plugin PUBLIC scene_points_with_normal_item scene_surface_mesh_item scene_polygon_soup_item) +if(TARGET CGAL::TBB_support) + target_link_libraries(repair_polyhedron_plugin PUBLIC CGAL::TBB_support) +endif() + qt5_wrap_ui(isotropicRemeshingUI_FILES Isotropic_remeshing_dialog.ui) polyhedron_demo_plugin(isotropic_remeshing_plugin Isotropic_remeshing_plugin diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp index 5ecc8921433..dd4acb43427 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp @@ -1,6 +1,7 @@ #include #include "Scene_surface_mesh_item.h" +#include "Scene_polygon_soup_item.h" #include "Scene_points_with_normal_item.h" #include #include @@ -19,6 +20,8 @@ #include #include #include +#include +#include #include "ui_RemoveNeedlesDialog.h" #include "ui_SelfSnapDialog.h" @@ -52,8 +55,9 @@ public: actionDuplicateNMVertices = new QAction(tr("Duplicate Non-Manifold Vertices"), mw); actionExtractNMVertices = new QAction(tr("Extract Non-Manifold Vertices"), mw); actionMergeDuplicatedVerticesOnBoundaryCycles = new QAction(tr("Merge Duplicated Vertices on Boundary Cycles"), mw); - actionAutorefine = new QAction(tr("Autorefine Mesh"), mw); - actionAutorefineAndRMSelfIntersections = new QAction(tr("Autorefine and Remove Self-Intersections"), mw); + actionAutorefine = new QAction(tr("Autorefine Mesh (Deprecated)"), mw); + actionNewAutorefine = new QAction(tr("Autorefine"), mw); + actionAutorefineAndRMSelfIntersections = new QAction(tr("Autorefine and Remove Self-Intersections (Deprecated)"), mw); actionRemoveNeedlesAndCaps = new QAction(tr("Remove Needles And Caps")); actionSnapBorders = new QAction(tr("Snap Boundaries")); @@ -65,6 +69,7 @@ public: actionExtractNMVertices->setObjectName("actionExtractNMVertices"); actionMergeDuplicatedVerticesOnBoundaryCycles->setObjectName("actionMergeDuplicatedVerticesOnBoundaryCycles"); actionAutorefine->setObjectName("actionAutorefine"); + actionNewAutorefine->setObjectName("actionNewAutorefine"); actionAutorefineAndRMSelfIntersections->setObjectName("actionAutorefineAndRMSelfIntersections"); actionRemoveNeedlesAndCaps->setObjectName("actionRemoveNeedlesAndCaps"); actionSnapBorders->setObjectName("actionSnapBorders"); @@ -77,6 +82,7 @@ public: actionExtractNMVertices->setProperty("subMenuName", "Polygon Mesh Processing/Repair"); actionMergeDuplicatedVerticesOnBoundaryCycles->setProperty("subMenuName", "Polygon Mesh Processing/Repair"); actionAutorefine->setProperty("subMenuName", "Polygon Mesh Processing/Repair/Experimental"); + actionNewAutorefine->setProperty("subMenuName", "Polygon Mesh Processing/Repair"); actionAutorefineAndRMSelfIntersections->setProperty("subMenuName", "Polygon Mesh Processing/Repair/Experimental"); actionSnapBorders->setProperty("subMenuName", "Polygon Mesh Processing/Repair/Experimental"); @@ -93,16 +99,29 @@ public: << actionExtractNMVertices << actionMergeDuplicatedVerticesOnBoundaryCycles << actionAutorefine + << actionNewAutorefine << actionAutorefineAndRMSelfIntersections << actionRemoveNeedlesAndCaps << actionSnapBorders; } - bool applicable(QAction*) const + bool applicable(QAction* action) const { - int item_id = scene->mainSelectionIndex(); - return qobject_cast(scene->item(item_id)); + if (action!=actionNewAutorefine) + { + int item_id = scene->mainSelectionIndex(); + return qobject_cast(scene->item(item_id)); + } + for (Scene_interface::Item_id index : scene->selectionIndices()) + { + if (qobject_cast(scene->item(index))) + return true; + if (qobject_cast(scene->item(index))) + return true; + } + return false; } + template void on_actionRemoveIsolatedVertices_triggered(Scene_interface::Item_id index); template @@ -120,6 +139,8 @@ public: template void on_actionAutorefine_triggered(Scene_interface::Item_id index); template + void on_actionNewAutorefine_triggered(const std::vector& indices); + template void on_actionAutorefineAndRMSelfIntersections_triggered(Scene_interface::Item_id index); public Q_SLOTS: @@ -131,6 +152,7 @@ public Q_SLOTS: void on_actionExtractNMVertices_triggered(); void on_actionMergeDuplicatedVerticesOnBoundaryCycles_triggered(); void on_actionAutorefine_triggered(); + void on_actionNewAutorefine_triggered(); void on_actionAutorefineAndRMSelfIntersections_triggered(); void on_actionRemoveNeedlesAndCaps_triggered(); void on_actionSnapBorders_triggered(); @@ -144,6 +166,7 @@ private: QAction* actionExtractNMVertices; QAction* actionMergeDuplicatedVerticesOnBoundaryCycles; QAction* actionAutorefine; + QAction* actionNewAutorefine; QAction* actionAutorefineAndRMSelfIntersections; QAction* actionRemoveNeedlesAndCaps; QAction* actionSnapBorders; @@ -421,6 +444,78 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefine_triggered() QApplication::restoreOverrideCursor(); } +template +void Polyhedron_demo_repair_polyhedron_plugin::on_actionNewAutorefine_triggered(const std::vector& indices) +{ + namespace PMP = CGAL::Polygon_mesh_processing; + Polygon_soup::Points points; + Polygon_soup::Polygons polygons; + + if (indices.size()==1) + { + if (Scene_surface_mesh_item* smi_ptr = qobject_cast(scene->item(indices[0]))) + PMP::polygon_mesh_to_polygon_soup(*smi_ptr->polyhedron(), points, polygons); + else if (Scene_polygon_soup_item* spi_ptr = qobject_cast(scene->item(indices[0]))) + { + points = spi_ptr->points(); + polygons = spi_ptr->polygons(); + } + } + else + { + for (Scene_interface::Item_id id : indices) + { + Polygon_soup::Points l_points; + Polygon_soup::Polygons l_polygons; + + if (Scene_surface_mesh_item* smi_ptr = qobject_cast(scene->item(id))) + PMP::polygon_mesh_to_polygon_soup(*smi_ptr->polyhedron(), l_points, l_polygons); + else if (Scene_polygon_soup_item* spi_ptr = qobject_cast(scene->item(id))) + { + l_points = spi_ptr->points(); + l_polygons = spi_ptr->polygons(); + } + std::size_t offset=points.size(); + points.insert(points.end(), l_points.begin(), l_points.end()); + std::size_t psize=polygons.size(); + polygons.insert(polygons.end(), l_polygons.begin(), l_polygons.end()); + for (std::size_t i=psize; iload(points, polygons); + QString name = scene->item(indices[0])->name(); + for (std::size_t k=1; kitem(indices[k])->name(); + new_item->setName(name+" autorefined"); + + scene->addItem(new_item); + new_item->invalidateOpenGLBuffers(); + Q_EMIT new_item->itemChanged(); +} + +void Polyhedron_demo_repair_polyhedron_plugin::on_actionNewAutorefine_triggered() +{ + std::vector indices; + for (Scene_interface::Item_id index : scene->selectionIndices()) + { + if (qobject_cast(scene->item(index))) + indices.push_back(index); + else if (qobject_cast(scene->item(index))) + indices.push_back(index); + } + QApplication::setOverrideCursor(Qt::WaitCursor); + on_actionNewAutorefine_triggered(indices); + QApplication::restoreOverrideCursor(); +} + template void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefineAndRMSelfIntersections_triggered(Scene_interface::Item_id index) { From 49d6821d9bf3ad827ad664e739c90e0cd8c24909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 28 Aug 2023 13:51:57 +0200 Subject: [PATCH 091/139] accomodate update to c++17 STL --- Kernel_23/include/CGAL/Kernel/function_objects.h | 16 ++++++++-------- .../Polygon_mesh_processing/autorefinement.h | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 8974b762dcb..8309a3c97ce 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -2211,8 +2211,8 @@ namespace CommonKernelFunctors { Plane plane3 = construct_plane(p3, q3, r3); const auto res = typename K::Intersect_3()(plane1, plane2, plane3); - CGAL_assertion(res!=boost::none); - const Point* e_pt = boost::get(&(*res)); + CGAL_assertion(res!=std::nullopt); + const Point* e_pt = std::get_if(&(*res)); CGAL_assertion(e_pt!=nullptr); return *e_pt; } @@ -2221,8 +2221,8 @@ namespace CommonKernelFunctors { operator()(const Plane& plane1, const Plane& plane2, const Plane& plane3) const { const auto res = typename K::Intersect_3()(plane1, plane2, plane3); - CGAL_assertion(res!=boost::none); - const Point* e_pt = boost::get(&(*res)); + CGAL_assertion(res!=std::nullopt); + const Point* e_pt = std::get_if(&(*res)); CGAL_assertion(e_pt!=nullptr); return *e_pt; } @@ -2245,8 +2245,8 @@ namespace CommonKernelFunctors { Segment s2 = construct_segment(p2, q2); const auto res = typename K::Intersect_3()(s1, s2); - CGAL_assertion(res!=boost::none); - const Point* e_pt = boost::get(&(*res)); + CGAL_assertion(res!=std::nullopt); + const Point* e_pt = std::get_if(&(*res)); CGAL_assertion(e_pt!=nullptr); return *e_pt; } @@ -2255,8 +2255,8 @@ namespace CommonKernelFunctors { operator()(const Segment& s1, const Segment& s2) const { const auto res = typename K::Intersect_3()(s1, s2); - CGAL_assertion(res!=boost::none); - const Point* e_pt = boost::get(&(*res)); + CGAL_assertion(res!=std::nullopt); + const Point* e_pt = std::get_if(&(*res)); CGAL_assertion(e_pt!=nullptr); return *e_pt; } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 0fb843c31c0..b3133304bb9 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -292,8 +292,8 @@ void old_intersection_coplanar_triangles_cutoff(const typename Kernel::Point_3& CGAL_kernel_assertion_code(int pt_added = 0;) - const typename Kernel::Point_3* prev = &(*boost::prior(inter_pts.end())); - Iterator stop = inter_pts.size() > 2 ? inter_pts.end() : boost::prior(inter_pts.end()); + const typename Kernel::Point_3* prev = &(*std::prev(inter_pts.end())); + Iterator stop = inter_pts.size() > 2 ? inter_pts.end() : std::prev(inter_pts.end()); for(Iterator it=inter_pts.begin(); it!=stop; ++it) { const typename Kernel::Point_3& curr = *it; From 4dc2ad3f36a9f2023e3e0ceaa5e44bf38b7332ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 4 Sep 2023 14:05:18 +0200 Subject: [PATCH 092/139] fix map type --- .../CGAL/Polygon_mesh_processing/autorefinement.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index b3133304bb9..32765252a6f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1480,12 +1480,13 @@ void autorefine_triangle_soup(PointRange& soup_points, // TODO: reuse the fact that maps per triangle are already sorted #ifdef CGAL_LINKED_WITH_TBB - std::conditional_t, - std::map> point_id_map; + typedef std::conditional_t, + std::map> Point_id_map; #else - std::map point_id_map; + typedef std::map Point_id_map; #endif + Point_id_map point_id_map; #if ! defined(CGAL_NDEBUG) || defined(CGAL_DEBUG_PMP_AUTOREFINE) std::vector exact_soup_points; @@ -1605,7 +1606,7 @@ void autorefine_triangle_soup(PointRange& soup_points, #else //option 2 (without mutex) /// Lambda concurrent_get_point_id() - tbb::concurrent_vector::iterator> iterators; + tbb::concurrent_vector iterators; auto concurrent_get_point_id = [&](const typename EK::Point_3 pt) { auto insert_res = point_id_map.insert(std::make_pair(pt, -1)); @@ -1616,7 +1617,7 @@ void autorefine_triangle_soup(PointRange& soup_points, //use map iterator triple for triangles to create them concurrently and safely soup_triangles_out.resize(offset + new_triangles.size()); - std::vector::iterator, 3>> triangle_buffer(new_triangles.size()); + std::vector> triangle_buffer(new_triangles.size()); tbb::parallel_for(tbb::blocked_range(0, new_triangles.size()), [&](const tbb::blocked_range& r) { for (size_t ti = r.begin(); ti != r.end(); ++ti) { From 9d68f5350e491bb1b23a42f14027285477a18780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 4 Sep 2023 14:58:47 +0200 Subject: [PATCH 093/139] doc + changes --- Installation/CHANGES.md | 6 ++++++ .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index 47998400268..b361d15dec7 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -35,6 +35,12 @@ Release date: October 2023 - Removed the class templates `Gray_image_mesh_domain_3`, `Implicit_mesh_domain_3`, and `Labeled_image_mesh_domain_3` which are deprecated since CGAL-4.13. +### [Polygon Mesh Processing](https://doc.cgal.org/6.0/Manual/packages.html#PkgPolygonMeshProcessing) + +- Added the function + `CGAL::Polygon_mesh_processing::autorefine_triangle_soup()` that refines a soup of triangles so that no pair of triangles intersects + (they can share an edge or a vertex). Also added, the function `autorefine()` operating directly on a triangle mesh and updating it + using the aforementioned function on triangle soup. [Release 5.6](https://github.com/CGAL/cgal/releases/tag/v5.6) ----------- diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 32765252a6f..884ce3477aa 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1128,8 +1128,9 @@ void generate_subtriangles(std::size_t ti, /** * \ingroup PMP_corefinement_grp * -* refines a soup of triangles so that no pair of triangles intersects in their interior. -* Note that points in `soup_points` can only be added (intersection points) a the end of the container, with the initial order preserved. +* refines a soup of triangles so that no pair of triangles intersects. +* Output triangles may share a common edge or a common vertex (but with the same indexed position in `points`). +* Note that points in `soup_points` can only be added (intersection points) at the end of the container, with the initial order preserved. * Note that if `soup_points` contains two or more identical points and only the first copy (following the order in the `soup_points`) * will be used in `soup_triangles`. * `soup_triangles` will be updated to contain both the input triangles and the new subdivides triangles. Degenerate triangles will be removed. From 87003941220f792096961bb9a3896afc5afdfb2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Sun, 24 Sep 2023 22:52:20 +0200 Subject: [PATCH 094/139] boost::mpl::if_ -> std::conditional --- .../CGAL/AABB_face_graph_triangle_primitive.h | 9 ++- .../AABB_halfedge_graph_segment_primitive.h | 9 ++- .../include/CGAL/number_utils.h | 16 ++--- .../include/CGAL/Arr_batched_point_location.h | 3 +- .../include/CGAL/Arr_overlay_2.h | 5 +- .../include/CGAL/Arr_tags.h | 59 +++++++++---------- .../CGAL/Arr_vertical_decomposition_2.h | 3 +- .../Arr_traits_adaptor_2_dispatching.h | 23 +++----- .../Arrangement_on_surface_2_global.h | 10 ++-- .../Arrangement_on_surface_2/test_tags.cpp | 1 - .../test_traits_dispatching.cpp | 1 - .../internal/OM_iterator_from_circulator.h | 29 ++++----- .../internal/initialized_index_maps_helpers.h | 4 +- .../CGAL/boost/graph/named_params_helper.h | 18 +++--- BGL/include/CGAL/boost/graph/properties.h | 10 ++-- .../CGAL/boost/graph/properties_OpenMesh.h | 15 +++-- BGL/include/CGAL/boost/graph/property_maps.h | 1 - .../CGAL/Combinatorial_map_iterators_base.h | 34 +++++------ .../CGAL/Compact_container_with_index.h | 11 ++-- Filtered_kernel/include/CGAL/Lazy_kernel.h | 1 - .../CGAL/Generalized_map_iterators_base.h | 1 - .../include/CGAL/sibson_gradient_fitting.h | 1 - Kernel_23/include/CGAL/Kernel_traits.h | 1 - Mesh_3/benchmark/Mesh_3/StdAfx.h | 2 - .../Implicit_to_labeling_function_wrapper.h | 7 +-- .../Image_to_labeled_function_wrapper.h | 1 - Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h | 7 +-- Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h | 7 +-- .../CGAL/Mesh_3/Triangulation_helpers.h | 1 - .../CGAL/NewKernel_d/Cartesian_filter_K.h | 1 - .../NewKernel_d/Cartesian_static_filters.h | 7 +-- .../CGAL/NewKernel_d/KernelD_converter.h | 9 ++- .../include/CGAL/NewKernel_d/functor_tags.h | 3 +- NewKernel_d/include/CGAL/NewKernel_d/utils.h | 8 +-- NewKernel_d/test/NewKernel_d/Epick_d.cpp | 4 +- Number_types/include/CGAL/Lazy_exact_nt.h | 10 ++-- Number_types/include/CGAL/Quotient.h | 8 +-- .../Algebraic_structure_traits.h | 8 +-- .../CGAL/Sqrt_extension/Coercion_traits.h | 4 +- ...t_to_labeled_subdomains_function_wrapper.h | 7 +-- .../CGAL/Periodic_3_function_wrapper.h | 7 +-- .../CGAL/Periodic_3_regular_triangulation_3.h | 1 - ...ABB_traversal_traits_with_transformation.h | 1 - .../internal/Corefinement/face_graph_utils.h | 7 +-- .../Polygon_mesh_processing/intersection.h | 1 - .../CGAL/Polygon_mesh_processing/locate.h | 1 - .../include/CGAL/Polygon_mesh_slicer.h | 9 ++- Polynomial/include/CGAL/Polynomial.h | 1 - .../include/CGAL/Polynomial/Polynomial_type.h | 6 +- Polynomial/include/CGAL/Polynomial_traits_d.h | 6 +- .../include/CGAL/Dynamic_property_map.h | 7 +-- .../CGAL/Mesh_complex_3_in_triangulation_3.h | 1 - .../include/CGAL/Compact_container.h | 10 ++-- .../CGAL/Concurrent_compact_container.h | 4 +- .../include/CGAL/Handle_with_policy.h | 6 +- .../include/CGAL/Named_function_parameters.h | 13 ++-- .../include/CGAL/transforming_iterator.h | 7 +-- .../include/CGAL/Skin_surface_base_3.h | 1 - .../include/CGAL/Fuzzy_iso_box.h | 2 - .../include/CGAL/Search_traits_adapter.h | 12 ++-- .../Straight_skeleton_aux.h | 11 ++-- .../CGAL/Constrained_triangulation_2.h | 5 +- .../include/CGAL/Regular_triangulation_2.h | 1 - .../include/CGAL/Triangulation_hierarchy_2.h | 1 - .../include/CGAL/Regular_triangulation_3.h | 1 - ...n_cell_base_with_weighted_circumcenter_3.h | 1 - .../include/CGAL/Triangulation_3.h | 1 - .../include/CGAL/Triangulation_hierarchy_3.h | 1 - .../include/CGAL/_test_cls_delaunay_3.h | 1 - .../CGAL/_test_cls_parallel_triangulation_3.h | 1 - .../test_regular_insert_range_with_info.cpp | 18 +++--- 71 files changed, 212 insertions(+), 292 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_face_graph_triangle_primitive.h b/AABB_tree/include/CGAL/AABB_face_graph_triangle_primitive.h index 5422c84b2ae..021cdc6270a 100644 --- a/AABB_tree/include/CGAL/AABB_face_graph_triangle_primitive.h +++ b/AABB_tree/include/CGAL/AABB_face_graph_triangle_primitive.h @@ -21,7 +21,6 @@ #include #include #include -#include namespace CGAL { @@ -57,9 +56,9 @@ template < class FaceGraph, class CacheDatum=Tag_false > class AABB_face_graph_triangle_primitive #ifndef DOXYGEN_RUNNING - : public AABB_primitive::face_descriptor, - std::pair::face_descriptor, const FaceGraph*> >::type, + : public AABB_primitive::face_descriptor, + std::pair::face_descriptor, const FaceGraph*> >, Triangle_from_face_descriptor_map< FaceGraph, typename Default::Get::const_type >::type VertexPointPMap_; typedef typename boost::graph_traits::face_descriptor FD; - typedef typename boost::mpl::if_ >::type Id_; + typedef std::conditional_t > Id_; typedef Triangle_from_face_descriptor_map Triangle_property_map; typedef One_point_from_face_descriptor_map Point_property_map; diff --git a/AABB_tree/include/CGAL/AABB_halfedge_graph_segment_primitive.h b/AABB_tree/include/CGAL/AABB_halfedge_graph_segment_primitive.h index 13568227319..3f5481d0cfe 100644 --- a/AABB_tree/include/CGAL/AABB_halfedge_graph_segment_primitive.h +++ b/AABB_tree/include/CGAL/AABB_halfedge_graph_segment_primitive.h @@ -24,7 +24,6 @@ #include #include #include -#include #include @@ -70,9 +69,9 @@ template < class HalfedgeGraph, class CacheDatum = Tag_false > class AABB_halfedge_graph_segment_primitive #ifndef DOXYGEN_RUNNING - : public AABB_primitive< typename boost::mpl::if_::edge_descriptor, - std::pair::edge_descriptor, const HalfedgeGraph*> >::type, + : public AABB_primitive< std::conditional_t::edge_descriptor, + std::pair::edge_descriptor, const HalfedgeGraph*> >, Segment_from_edge_descriptor_map< HalfedgeGraph, typename Default::Get::const_type >::type VertexPointPMap_; typedef typename boost::graph_traits::edge_descriptor ED; - typedef typename boost::mpl::if_ >::type Id_; + typedef std::conditional_t > Id_; typedef Segment_from_edge_descriptor_map Segment_property_map; typedef Source_point_from_edge_descriptor_map Point_property_map; diff --git a/Algebraic_foundations/include/CGAL/number_utils.h b/Algebraic_foundations/include/CGAL/number_utils.h index c17823d72b9..5a5bc2d242d 100644 --- a/Algebraic_foundations/include/CGAL/number_utils.h +++ b/Algebraic_foundations/include/CGAL/number_utils.h @@ -194,21 +194,21 @@ root_of( int k, Input_iterator begin, Input_iterator end ) { template< class Number_type > inline // select a Is_zero functor -typename boost::mpl::if_c< - ::std::is_same< typename Algebraic_structure_traits< Number_type >::Is_zero, - Null_functor >::value , +typename std::conditional_t< + std::is_same_v< typename Algebraic_structure_traits< Number_type >::Is_zero, + Null_functor >, typename Real_embeddable_traits< Number_type >::Is_zero, typename Algebraic_structure_traits< Number_type >::Is_zero ->::type::result_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< - ::std::is_same< + std::conditional_t< + std::is_same_v< typename Algebraic_structure_traits< Number_type >::Is_zero, - Null_functor >::value , + Null_functor > , typename Real_embeddable_traits< Number_type >::Is_zero, - typename Algebraic_structure_traits< Number_type >::Is_zero >::type + typename Algebraic_structure_traits< Number_type >::Is_zero > is_zero; return is_zero( x ); } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h index 42715621e4b..85ba6ccc235 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h @@ -26,7 +26,6 @@ #include #include -#include #include namespace CGAL { @@ -120,7 +119,7 @@ locate(const Arrangement_on_surface_2& arr, * Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has * only an implicit constructor, (which takes *b as a parameter). */ - typename boost::mpl::if_, const Bgt2&, Bgt2>::type + std::conditional_t, const Bgt2&, Bgt2> ex_traits(*geom_traits); // Define the sweep-line visitor and perform the sweep. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h index 2951b1983fe..dfa6fb89ffc 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h @@ -25,7 +25,6 @@ #include #include -#include #include #include @@ -247,8 +246,8 @@ overlay(const Arrangement_on_surface_2& arr1 * Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has * only an implicit constructor, (which takes *b as a parameter). */ - typename boost::mpl::if_, - const Ovl_gt2&, Ovl_gt2>::type + std::conditional_t, + const Ovl_gt2&, Ovl_gt2> ex_traits(*traits_adaptor); Ovl_visitor visitor(&arr1, &arr2, &arr, &ovl_tr); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h index 91313be6c5d..1aac0615585 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -246,14 +245,14 @@ struct Arr_all_sides_not_finite_tag : struct Arr_not_all_sides_not_finite_tag : public virtual Arr_not_all_sides_oblivious_tag {}; -typedef boost::mpl::bool_ Arr_true; -typedef boost::mpl::bool_ Arr_false; +typedef std::true_type Arr_true; +typedef std::false_type Arr_false; template struct Arr_is_side_oblivious { typedef ArrSideCategory Side_cat; typedef std::is_same Is_same; - typedef boost::mpl::if_ result; + typedef std::conditional result; typedef typename result::type type; }; @@ -261,7 +260,7 @@ template struct Arr_is_side_open { typedef ArrSideCategory Side_cat; typedef std::is_same Is_same; - typedef boost::mpl::if_ result; + typedef std::conditional result; typedef typename result::type type; }; @@ -269,7 +268,7 @@ template struct Arr_is_side_identified { typedef ArrSideCategory Side_cat; typedef std::is_same Is_same; - typedef boost::mpl::if_ result; + typedef std::conditional result; typedef typename result::type type; }; @@ -277,7 +276,7 @@ template struct Arr_is_side_contracted { typedef ArrSideCategory Side_cat; typedef std::is_same Is_same; - typedef boost::mpl::if_ result; + typedef std::conditional result; typedef typename result::type type; }; @@ -285,7 +284,7 @@ template struct Arr_is_side_closed { typedef ArrSideCategory Side_cat; typedef std::is_same Is_same; - typedef boost::mpl::if_ result; + typedef std::conditional result; typedef typename result::type type; }; @@ -307,10 +306,10 @@ struct Arr_all_sides_oblivious_category { /*! Boolean tag that is Arr_all_sides_oblivious_tag if all sides are * oblivious, otherwise Arr_not_all_sides_oblivious_tag */ - typedef typename boost::mpl::if_, - Arr_all_sides_oblivious_tag, - Arr_not_all_sides_oblivious_tag>::type + typedef std::conditional_t result; }; @@ -340,10 +339,10 @@ public: /*! Boolean tag that is Arr_all_sides_not_open_tag if all sides are not-open, * otherwise Arr_not_all_sides_not_open_tag */ - typedef typename boost::mpl::if_, - Arr_all_sides_not_open_tag, - Arr_not_all_sides_not_open_tag>::type + typedef std::conditional_t result; }; @@ -379,18 +378,18 @@ private: typedef boost::mpl::or_ Bot_obl_or_ope; typedef boost::mpl::or_ Top_obl_or_ope; - typedef typename boost::mpl::if_, - Arr_all_sides_not_finite_tag, - Arr_not_all_sides_not_finite_tag>::type + typedef std::conditional_t tmp; public: - typedef typename boost::mpl::if_, - Arr_all_sides_oblivious_tag, tmp>::type + typedef std::conditional_t result; }; @@ -532,11 +531,11 @@ struct Arr_two_sides_category { Is_open; public: - typedef typename boost::mpl::if_::type>::type>::type>::type + typedef std::conditional_t>>> result; }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h index 75c8f25e0c9..099f44192ee 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h @@ -24,7 +24,6 @@ #include #include -#include #include namespace CGAL { @@ -124,7 +123,7 @@ decompose(const Arrangement_on_surface_2& arr, * Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has * only an implicit constructor, (which takes *b as a parameter). */ - typename boost::mpl::if_, const Vgt2&, Vgt2>::type + std::conditional_t, const Vgt2&, Vgt2> ex_traits(*geom_traits); // Define the sweep-line visitor and perform the sweep. diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h index e4533596dd2..283b2dc66b5 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h @@ -17,7 +17,6 @@ #include -#include #include #include #include @@ -59,25 +58,21 @@ public: private: - typedef boost::mpl::bool_< true > true_; - typedef boost::mpl::bool_< false > false_; + typedef std::conditional< + std::is_same_v< Arr_smaller_implementation_tag, Arr_use_traits_tag >, + std::true_type, std::false_type > Smaller_traits; - typedef boost::mpl::if_< - std::is_same< Arr_smaller_implementation_tag, Arr_use_traits_tag >, - true_, false_ > Smaller_traits; - - typedef boost::mpl::if_< - std::is_same< Arr_larger_implementation_tag, Arr_use_traits_tag >, - true_, false_ > Larger_traits; + typedef std::conditional_t_< + std::is_same_v< Arr_larger_implementation_tag, Arr_use_traits_tag >, + std::true_type, std::false_type > Larger_traits; public: //! the result type (if one side asks for traits, then ask traits! //! Or vice versa: If both ask for dummy, then dummy!) - typedef typename boost::mpl::if_< - boost::mpl::or_< Smaller_traits, Larger_traits >, - Arr_use_traits_tag, - Arr_use_dummy_tag >::type type; + typedef std::conditional_t< + Smaller_traits, Larger_traits >::value || Arr_use_traits_tag::value, + Arr_use_dummy_tag > type; }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h index 0f2957d4714..ee072c95778 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h @@ -23,8 +23,6 @@ #include #include -#include -#include #include #include @@ -271,7 +269,7 @@ insert_empty(Arrangement_on_surface_2& arr, * Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has * only an implicit constructor, (which takes *b as a parameter). */ - typename boost::mpl::if_, const Cgt2&, Cgt2>::type + std::conditional_t, const Cgt2&, Cgt2> traits(*geom_traits); // Define a surface-sweep instance and perform the sweep: @@ -326,7 +324,7 @@ void insert_empty(Arrangement_on_surface_2& * Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has * only an implicit constructor, (which takes *b as a parameter). */ - typename boost::mpl::if_, const Cgt2&, Cgt2>::type + std::conditional_t, const Cgt2&, Cgt2> traits(*geom_traits); // Define a surface-sweep instance and perform the sweep. @@ -379,7 +377,7 @@ void insert_non_empty(Arrangement_on_surface_2, const Igt2&, Igt2>::type + std::conditional_t, const Igt2&, Igt2> traits(*geom_traits); // Create a set of existing as well as new curves and points. @@ -979,7 +977,7 @@ non_intersecting_insert_non_empty(Arrangement_on_surface_2, const Igt2&, Igt2>::type + std::conditional_t, const Igt2&, Igt2> traits(*geom_traits); // Create a set of existing as well as new curves and points. diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp index 81eae420496..a86325de2af 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp @@ -6,7 +6,6 @@ #include #include -#include struct Traits1 { typedef CGAL::Arr_open_side_tag Left_side_category; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_dispatching.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_dispatching.cpp index 5c8e19fa12e..ce17f3b9105 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_dispatching.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_dispatching.cpp @@ -4,7 +4,6 @@ #include #include -#include int dispatch(CGAL::Arr_use_dummy_tag) { return 0; diff --git a/BGL/include/CGAL/boost/graph/internal/OM_iterator_from_circulator.h b/BGL/include/CGAL/boost/graph/internal/OM_iterator_from_circulator.h index e726e161a6b..01104c54680 100644 --- a/BGL/include/CGAL/boost/graph/internal/OM_iterator_from_circulator.h +++ b/BGL/include/CGAL/boost/graph/internal/OM_iterator_from_circulator.h @@ -20,8 +20,6 @@ #include #include -#include - namespace CGAL { // adapted from circulator.h, does not support @@ -45,23 +43,20 @@ public: typedef typename I__traits::iterator_category iterator_category; - typedef typename - boost::mpl::if_c< Prevent_deref - , C - , typename C::value_type - >::type value_type; + typedef std::conditional_t< Prevent_deref + , C + , typename C::value_type> + value_type; typedef typename C::difference_type difference_type; - typedef typename - boost::mpl::if_c< Prevent_deref - , C& - , typename C::reference - >::type reference; - typedef typename - boost::mpl::if_c< Prevent_deref - , C* - , typename C::reference - >::type pointer; + typedef std::conditional_t< Prevent_deref + , C& + , typename C::reference + > reference; + typedef std::conditional_t< Prevent_deref + , C* + , typename C::reference + > pointer; OM_iterator_from_circulator(){} diff --git a/BGL/include/CGAL/boost/graph/internal/initialized_index_maps_helpers.h b/BGL/include/CGAL/boost/graph/internal/initialized_index_maps_helpers.h index 2d85e38d35c..eddefcec7fb 100644 --- a/BGL/include/CGAL/boost/graph/internal/initialized_index_maps_helpers.h +++ b/BGL/include/CGAL/boost/graph/internal/initialized_index_maps_helpers.h @@ -276,8 +276,8 @@ class GetInitializedIndexMap { public: // Check if there is an internal property map; if not, we must a dynamic property map - typedef typename boost::mpl::if_c< - CGAL::graph_has_property::value, Tag, DynamicTag>::type Final_tag; + typedef std::conditional_t< + CGAL::graph_has_property::value, Tag, DynamicTag> Final_tag; typedef typename internal_np::Lookup_named_param_def< PropertyTag, diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index 1e0efd6faa6..4dce0049b1a 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -43,11 +42,10 @@ class property_map_selector { public: typedef typename graph_has_property::type Has_internal_pmap; - typedef typename boost::mpl::if_c::type, - typename boost::cgal_no_property::type - >::type type; - typedef typename boost::mpl::if_c::type, + typename boost::cgal_no_property::type> type; + typedef std::conditional_t::const_type, typename boost::cgal_no_property::const_type >::type const_type; @@ -209,10 +207,10 @@ struct GetGeomTraits_impl::value, - typename GetK::Kernel, - Fake_GT>::type type; + typedef std::conditional_t::value, + typename GetK::Kernel, + Fake_GT> type; }; template typedef ValueType value_type; typedef Handle key_type; - typedef typename boost::mpl::if_< std::is_reference, - ValueType&, - ValueType >::type Reference; + typedef std::conditional_t< std::is_reference, + ValueType&, + ValueType > Reference; Point_accessor() {} Point_accessor(Point_accessor) {} @@ -172,9 +172,9 @@ struct Is_writable_property_map // property map must define. template struct Is_writable_property_map - : boost::mpl::if_c::reference>::type>::value, - CGAL::Tag_false, CGAL::Tag_true>::type + CGAL::Tag_false, CGAL::Tag_true> { }; } // namespace internal diff --git a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h index 861f5aea98b..f6f56cea7ef 100644 --- a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h +++ b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h @@ -13,7 +13,6 @@ #include #include #include -#include #ifndef OPEN_MESH_CLASS #error OPEN_MESH_CLASS is not defined @@ -29,13 +28,13 @@ namespace CGAL { template class OM_pmap { public: - typedef typename boost::mpl::if_::vertex_descriptor>, - OpenMesh::VPropHandleT, - typename boost::mpl::if_::face_descriptor>, - OpenMesh::FPropHandleT, - typename boost::mpl::if_::halfedge_descriptor>, - OpenMesh::HPropHandleT, - OpenMesh::EPropHandleT >::type>::type>::type H; + typedef std::conditional_t::vertex_descriptor>, + OpenMesh::VPropHandleT, + std::conditional_t::face_descriptor>, + OpenMesh::FPropHandleT, + std::conditional_t::halfedge_descriptor>, + OpenMesh::HPropHandleT, + OpenMesh::EPropHandleT >>> H; typedef boost::lvalue_property_map_tag category; diff --git a/BGL/include/CGAL/boost/graph/property_maps.h b/BGL/include/CGAL/boost/graph/property_maps.h index aab29d9b881..b6973feb65c 100644 --- a/BGL/include/CGAL/boost/graph/property_maps.h +++ b/BGL/include/CGAL/boost/graph/property_maps.h @@ -15,7 +15,6 @@ #include #include -#include namespace CGAL{ diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h b/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h index a50266f7659..555dc554c58 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h @@ -18,7 +18,6 @@ #include #include -#include #include @@ -68,24 +67,24 @@ namespace CGAL { class CMap_dart_iterator; template < typename Map_,bool Const> - class CMap_dart_iterator: public boost::mpl::if_c< Const, + class CMap_dart_iterator: public std::conditional_t< Const, typename Map_::Dart_container::const_iterator, - typename Map_::Dart_container::iterator>::type + typename Map_::Dart_container::iterator> //public internal::CC_iterator { public: typedef CMap_dart_iterator Self; - typedef typename boost::mpl::if_c< Const, + typedef std::conditional_t< Const, typename Map_::Dart_container::const_iterator, - typename Map_::Dart_container::iterator>::type Base; + typename Map_::Dart_container::iterator> Base; // typedef internal::CC_iterator Base; - typedef typename boost::mpl::if_c< Const, - typename Map_::Dart_const_descriptor, - typename Map_::Dart_descriptor>::type + typedef std::conditional_t< Const, + typename Map_::Dart_const_descriptor, + typename Map_::Dart_descriptor> Dart_descriptor; - typedef typename boost::mpl::if_c< Const, const Map_, Map_>::type Map; + typedef std::conditional_t< Const, const Map_, Map_> Map; typedef std::input_iterator_tag iterator_category; typedef typename Base::value_type value_type; @@ -180,25 +179,24 @@ namespace CGAL { template < typename Map_,bool Const > class CMap_dart_iterator: - /*public boost::mpl::if_c< Const, + /*public std::conditional_t< Const, typename Map_::Dart_container::const_iterator, - typename Map_::Dart_container::iterator>::type*/ + typename Map_::Dart_container::iterator>*/ public internal::CC_iterator_with_index { public: typedef CMap_dart_iterator Self; - /*typedef typename boost::mpl::if_c< Const, + /*typedef std::conditional_t< Const, typename Map_::Dart_container::const_iterator, - typename Map_::Dart_container::iterator>::type Base;*/ + typename Map_::Dart_container::iterator> Base;*/ typedef internal::CC_iterator_with_index Base; - typedef typename boost::mpl::if_c< Const, - typename Map_::Dart_const_descriptor, - typename Map_::Dart_descriptor>::type + typedef std::conditional_t< Const, + typename Map_::Dart_const_descriptor, + typename Map_::Dart_descriptor> Dart_descriptor; - typedef typename boost::mpl::if_c< Const, const Map_, - Map_>::type Map; + typedef std::conditional_t< Const, const Map_, Map_> Map; typedef std::input_iterator_tag iterator_category; typedef typename Base::value_type value_type; diff --git a/Combinatorial_map/include/CGAL/Compact_container_with_index.h b/Combinatorial_map/include/CGAL/Compact_container_with_index.h index d3d67c57a88..dbb9aa8bae6 100644 --- a/Combinatorial_map/include/CGAL/Compact_container_with_index.h +++ b/Combinatorial_map/include/CGAL/Compact_container_with_index.h @@ -861,14 +861,13 @@ namespace internal { 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::conditional_t< Const, const value_type*, + value_type*> pointer; + typedef std::conditional_t< Const, const value_type&, + value_type&> reference; typedef std::bidirectional_iterator_tag iterator_category; - typedef typename boost::mpl::if_c< Const, const DSC*, DSC*>::type - cc_pointer; + typedef std::conditional_t< Const, const DSC*, DSC*> cc_pointer; CC_iterator_with_index(): m_ptr_to_cc(nullptr), m_index(0) diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index 911a86debc3..c6b6cb2444a 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -27,7 +27,6 @@ #include #include #include -#include #include #include diff --git a/Generalized_map/include/CGAL/Generalized_map_iterators_base.h b/Generalized_map/include/CGAL/Generalized_map_iterators_base.h index 034b1600f93..1747f89f354 100644 --- a/Generalized_map/include/CGAL/Generalized_map_iterators_base.h +++ b/Generalized_map/include/CGAL/Generalized_map_iterators_base.h @@ -19,7 +19,6 @@ #include #include #include -#include namespace CGAL { diff --git a/Interpolation/include/CGAL/sibson_gradient_fitting.h b/Interpolation/include/CGAL/sibson_gradient_fitting.h index f08600a4603..f6d6d0559dd 100644 --- a/Interpolation/include/CGAL/sibson_gradient_fitting.h +++ b/Interpolation/include/CGAL/sibson_gradient_fitting.h @@ -23,7 +23,6 @@ #include #include -#include #include #include diff --git a/Kernel_23/include/CGAL/Kernel_traits.h b/Kernel_23/include/CGAL/Kernel_traits.h index 4839184ff30..e12d38503bc 100644 --- a/Kernel_23/include/CGAL/Kernel_traits.h +++ b/Kernel_23/include/CGAL/Kernel_traits.h @@ -19,7 +19,6 @@ #include #include -#include namespace CGAL { diff --git a/Mesh_3/benchmark/Mesh_3/StdAfx.h b/Mesh_3/benchmark/Mesh_3/StdAfx.h index 57890430a5b..9648697498a 100644 --- a/Mesh_3/benchmark/Mesh_3/StdAfx.h +++ b/Mesh_3/benchmark/Mesh_3/StdAfx.h @@ -42,11 +42,9 @@ #include #include #include -#include #include #include #include -#include #include #include #include diff --git a/Mesh_3/include/CGAL/Implicit_to_labeling_function_wrapper.h b/Mesh_3/include/CGAL/Implicit_to_labeling_function_wrapper.h index 7e3af3de705..3ab3f0d3ba5 100644 --- a/Mesh_3/include/CGAL/Implicit_to_labeling_function_wrapper.h +++ b/Mesh_3/include/CGAL/Implicit_to_labeling_function_wrapper.h @@ -33,7 +33,6 @@ #include #include -#include #include #include @@ -67,9 +66,9 @@ public: } private: - typedef typename boost::mpl::if_, - Function_*, - Function_>::type Stored_function; + typedef std::conditional_t, + Function_*, + Function_> Stored_function; /// Function to wrap Stored_function f_; diff --git a/Mesh_3/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h b/Mesh_3/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h index 45246e4463d..3d1c030ff08 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h +++ b/Mesh_3/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h @@ -26,7 +26,6 @@ #include #include #include -#include namespace CGAL { diff --git a/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h b/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h index 44e4f82b82d..ad023df618e 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h @@ -37,7 +37,6 @@ #include #include -#include #include #include @@ -172,9 +171,9 @@ template::value, + std::is_convertible_v, // Parallel # ifdef CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE @@ -209,7 +208,7 @@ template # endif - >::type // boost::if (parallel/sequential) + > // std::conditional (parallel/sequential) #else // !CGAL_LINKED_WITH_TBB diff --git a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h index b4e2af50375..50e0a6cef08 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -640,9 +639,9 @@ template class Base_ = Refine_facets_3_base, #ifdef CGAL_LINKED_WITH_TBB - class Container_ = typename boost::mpl::if_c // (parallel/sequential?) + class Container_ = std::conditional_t // (parallel/sequential?) < - std::is_convertible::value, + std::is_convertible_v, // Parallel # ifdef CGAL_MESH_3_USE_LAZY_UNSORTED_REFINEMENT_QUEUE Meshes::Filtered_deque_container @@ -679,7 +678,7 @@ template # endif - >::type // boost::if (parallel/sequential) + > // std::conditional (parallel/sequential) #else // !CGAL_LINKED_WITH_TBB diff --git a/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h b/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h index db2dde5b6d3..e8517c94945 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h @@ -23,7 +23,6 @@ #include #include -#include #include #include diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h index c02efa6dcc6..25ec0c4f25c 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h @@ -15,7 +15,6 @@ #include #include #include -#include #include namespace CGAL { diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h index 5c3a64287d2..122cfe90885 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h @@ -16,7 +16,6 @@ #include // bug, should be included by the next one #include #include -#include namespace CGAL { namespace SFA { // static filter adapter @@ -98,9 +97,9 @@ struct Cartesian_static_filters, R_, Derived_> : public R_ { template struct Functor : Inherit_functor {}; template struct Functor { typedef - //typename boost::mpl::if_ < - //std::is_same, - //typename Get_functor::type, + //std::conditional_t < + //std::is_same_v, + //typename Get_functor, SFA::Orientation_of_points_2 // >::type type; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h b/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h index d62b8215cc5..edfb15ae9e9 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h @@ -23,7 +23,6 @@ #include #include #include -#include #include #include @@ -80,12 +79,12 @@ class KernelD_converter_ // Explicit calls to boost::mpl functions to avoid parenthesis // warning on some versions of GCC - typedef typename boost::mpl::if_ < + typedef std::conditional_t < // If Point==Vector, keep only one conversion - boost::mpl::or_, + duplicate::value || // For iterator objects, the default is make_transforming_iterator - boost::mpl::bool_<(iterator_tag_traits::is_iterator && no_converter::value)> >, - Do_not_use,K1_Obj>::type argument_type; + (iterator_tag_traits::is_iterator && no_converter::value), + Do_not_use,K1_Obj> argument_type; //typedef typename KOC::argument_type K1_Obj; //typedef typename KOC::result_type K2_Obj; public: diff --git a/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h b/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h index a3255d25eb0..4eb0e890063 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -233,7 +232,7 @@ namespace CGAL { #undef CGAL_DECL_ITER_OBJ templatestruct Get_functor_category,B,C> : - boost::mpl::if_c::is_iterator, + std::conditional::is_iterator, Construct_iterator_tag, Construct_tag> {}; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/utils.h b/NewKernel_d/include/CGAL/NewKernel_d/utils.h index a1ac6faeddd..f2e6a2f3ada 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/utils.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/utils.h @@ -145,11 +145,11 @@ struct Has_type_different_from #define CGAL_KD_DEFAULT_FUNCTOR(Tg,Name,ReqTyp,ReqFun) \ template \ struct Get_functor::value \ || !Provides_types >::value \ || !Provides_functors >::value \ - , int, void>::type> \ + , int, void>> \ { \ typedef CGAL_STRIP_PAREN_ Name type; \ typedef K Bound_kernel; \ @@ -159,11 +159,11 @@ struct Has_type_different_from #define CGAL_KD_DEFAULT_TYPE(Tg,Name,ReqTyp,ReqFun) \ template \ struct Get_type::value \ || !Provides_types >::value \ || !Provides_functors >::value \ - , int, void>::type> \ + , int, void>> \ { \ typedef CGAL_STRIP_PAREN_ Name type; \ typedef K Bound_kernel; \ diff --git a/NewKernel_d/test/NewKernel_d/Epick_d.cpp b/NewKernel_d/test/NewKernel_d/Epick_d.cpp index 18ac1657ee6..5693977869a 100644 --- a/NewKernel_d/test/NewKernel_d/Epick_d.cpp +++ b/NewKernel_d/test/NewKernel_d/Epick_d.cpp @@ -509,8 +509,8 @@ void test3(){ ; CP_ cp_ Kinit(construct_point_d_object); CV_ cv_ Kinit(construct_vector_d_object); - typename boost::mpl::if_,Construct_point3_helper,CP_>::type cp(cp_); - typename boost::mpl::if_,Construct_point3_helper,CV_>::type cv(cv_); + std::conditional_t,Construct_point3_helper,CP_> cp(cp_); + std::conditional_t,Construct_point3_helper,CV_> cv(cv_); CCI ci Kinit(construct_cartesian_const_iterator_d_object); CC cc Kinit(compute_coordinate_d_object); CL cl Kinit(compare_lexicographically_d_object); diff --git a/Number_types/include/CGAL/Lazy_exact_nt.h b/Number_types/include/CGAL/Lazy_exact_nt.h index 3f06ef3fb32..3f8a2812968 100644 --- a/Number_types/include/CGAL/Lazy_exact_nt.h +++ b/Number_types/include/CGAL/Lazy_exact_nt.h @@ -19,7 +19,6 @@ #include // for Root_of functor #include -#include #include #include @@ -1179,12 +1178,11 @@ struct Coercion_traits< Lazy_exact_nt, Lazy_exact_nt > Are_implicit_interoperable; \ private: \ static const bool interoperable \ - =std::is_same< Are_implicit_interoperable, Tag_false>::value; \ + =std::is_same< Are_implicit_interoperable, Tag_false>::value; \ public: \ - typedef typename boost::mpl::if_c \ - ::type Type; \ - typedef typename boost::mpl::if_c >::type Cast; \ + typedef std::conditional_t Type; \ + typedef std::conditional_t > Cast; \ }; \ \ template \ diff --git a/Number_types/include/CGAL/Quotient.h b/Number_types/include/CGAL/Quotient.h index e91e22208a5..8c117c2fb6d 100644 --- a/Number_types/include/CGAL/Quotient.h +++ b/Number_types/include/CGAL/Quotient.h @@ -627,13 +627,13 @@ public: }; - typedef typename boost::mpl::if_c< - !std::is_same< typename Algebraic_structure_traits::Sqrt, - Null_functor >::value, + typedef std::conditional_t< + !std::is_same_v< typename Algebraic_structure_traits::Sqrt, + Null_functor >, typename INTERN_QUOTIENT::Sqrt_selector< Type, Is_exact >::Sqrt, Null_functor - >::type Sqrt; + > Sqrt; class Simplify : public CGAL::cpp98::unary_function< Type&, void > { diff --git a/Number_types/include/CGAL/Sqrt_extension/Algebraic_structure_traits.h b/Number_types/include/CGAL/Sqrt_extension/Algebraic_structure_traits.h index b0913afb1b6..b1500148b59 100644 --- a/Number_types/include/CGAL/Sqrt_extension/Algebraic_structure_traits.h +++ b/Number_types/include/CGAL/Sqrt_extension/Algebraic_structure_traits.h @@ -204,10 +204,10 @@ public: typedef Sqrt_extension< COEFF_, ROOT_, ACDE_TAG,FP_TAG > Type; // Tag_true if COEFF and ROOT are exact - typedef typename ::boost::mpl::if_c< - bool( ::std::is_same::Is_exact,::CGAL::Tag_true>::value )&& - bool( ::std::is_same::Is_exact,::CGAL::Tag_true>::value ) - ,::CGAL::Tag_true,::CGAL::Tag_false>::type Is_exact; + typedef std::conditional_t< + std::is_same_v::Is_exact,::CGAL::Tag_true> && + std::is_same::Is_exact,::CGAL::Tag_true> + ,::CGAL::Tag_true,::CGAL::Tag_false> Is_exact; typedef typename Algebraic_structure_traits::Is_numerical_sensitive Is_numerical_sensitive; diff --git a/Number_types/include/CGAL/Sqrt_extension/Coercion_traits.h b/Number_types/include/CGAL/Sqrt_extension/Coercion_traits.h index 6b4344348d4..5b5ddfa45c6 100644 --- a/Number_types/include/CGAL/Sqrt_extension/Coercion_traits.h +++ b/Number_types/include/CGAL/Sqrt_extension/Coercion_traits.h @@ -178,7 +178,7 @@ template struct CT_ext_not_to_fwsqrt; // template struct Coercion_traits_for_level, B , CTL_SQRT_EXT> -:public ::boost::mpl::if_c< +:public std::conditional_t< // if B is fwsqrt ::boost::is_base_and_derived< Field_with_sqrt_tag, @@ -192,7 +192,7 @@ typename Algebraic_structure_traits::Algebraic_category >::value , //else take Intern::Coercion_traits not for fwsqrt INTERN_CT::CT_ext_not_to_fwsqrt< Sqrt_extension ,B> - >::type + > {}; // diff --git a/Periodic_3_mesh_3/include/CGAL/Implicit_to_labeled_subdomains_function_wrapper.h b/Periodic_3_mesh_3/include/CGAL/Implicit_to_labeled_subdomains_function_wrapper.h index a96c2eafa36..d821ab2fe3f 100644 --- a/Periodic_3_mesh_3/include/CGAL/Implicit_to_labeled_subdomains_function_wrapper.h +++ b/Periodic_3_mesh_3/include/CGAL/Implicit_to_labeled_subdomains_function_wrapper.h @@ -15,7 +15,6 @@ #include #include -#include #if defined(BOOST_MSVC) # pragma warning(push) @@ -47,9 +46,9 @@ public: } private: - typedef typename boost::mpl::if_, - Function_*, - Function_>::type Stored_function; + typedef std::conditional_t, + Function_*, + Function_> Stored_function; /// Function to wrap Stored_function f_; diff --git a/Periodic_3_mesh_3/include/CGAL/Periodic_3_function_wrapper.h b/Periodic_3_mesh_3/include/CGAL/Periodic_3_function_wrapper.h index 2780d618393..b1ee5e65065 100644 --- a/Periodic_3_mesh_3/include/CGAL/Periodic_3_function_wrapper.h +++ b/Periodic_3_mesh_3/include/CGAL/Periodic_3_function_wrapper.h @@ -18,7 +18,6 @@ #include #include -#include namespace CGAL { @@ -46,9 +45,9 @@ public: } private: - typedef typename boost::mpl::if_, - Function_*, - Function_>::type Stored_function; + typedef std::conditional_t, + Function_*, + Function_>: Stored_function; /// Function to wrap Stored_function f_; diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h index 7eed15886cd..63fb9404469 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h @@ -31,7 +31,6 @@ #include #include -#include #include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/AABB_traversal_traits_with_transformation.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/AABB_traversal_traits_with_transformation.h index 83884277136..7dad2004ecd 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/AABB_traversal_traits_with_transformation.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/AABB_traversal_traits_with_transformation.h @@ -27,7 +27,6 @@ #include #include -#include namespace CGAL { diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h index 4a15d9e59c7..68f0c9e5e6c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -388,12 +387,12 @@ struct TweakedGetVertexPointMap typedef typename std::is_same::value_type>::type Use_default_tag; - typedef typename boost::mpl::if_< - Use_default_tag, + typedef std::conditional_t< + Use_default_tag::value, Default_map, Dummy_default_vertex_point_map::vertex_descriptor > - >::type type; + > type; }; template diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h index 26e205ea43d..f32f9d907a9 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h @@ -29,7 +29,6 @@ #include #include -#include #include #include 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 ef361b17529..b99ed460a6f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h @@ -30,7 +30,6 @@ #include #include -#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_slicer.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_slicer.h index f1b88540a60..a608179f49a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_slicer.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_slicer.h @@ -30,7 +30,6 @@ #include #include -#include #include #include @@ -79,12 +78,12 @@ template::type >::type, + typename boost::property_map< TriangleMesh, vertex_point_t>::type >, Default, - VertexPointMap>::type> > >, + VertexPointMap>>>>, bool UseParallelPlaneOptimization=true> class Polygon_mesh_slicer { diff --git a/Polynomial/include/CGAL/Polynomial.h b/Polynomial/include/CGAL/Polynomial.h index b3681eb43b5..ad61432cd40 100644 --- a/Polynomial/include/CGAL/Polynomial.h +++ b/Polynomial/include/CGAL/Polynomial.h @@ -34,7 +34,6 @@ #include #include #include -#include #include #include diff --git a/Polynomial/include/CGAL/Polynomial/Polynomial_type.h b/Polynomial/include/CGAL/Polynomial/Polynomial_type.h index e2529d2e349..de6bcdc447b 100644 --- a/Polynomial/include/CGAL/Polynomial/Polynomial_type.h +++ b/Polynomial/include/CGAL/Polynomial/Polynomial_type.h @@ -486,9 +486,9 @@ public: // and NT would be changed by NTX typedef typename Fraction_traits::Is_fraction Is_fraction; typedef typename Coercion_traits::Type Type; - typedef typename ::boost::mpl::if_c< - ::std::is_same::value, Is_fraction, CGAL::Tag_false - >::type If_decomposable_AND_Type_equals_NT; + typedef std::conditional_t< + std::is_same_v, Is_fraction, CGAL::Tag_false + > If_decomposable_AND_Type_equals_NT; return sign_at_(x,If_decomposable_AND_Type_equals_NT()); } diff --git a/Polynomial/include/CGAL/Polynomial_traits_d.h b/Polynomial/include/CGAL/Polynomial_traits_d.h index 6eb4f0d6e3f..dfbf7cf3135 100644 --- a/Polynomial/include/CGAL/Polynomial_traits_d.h +++ b/Polynomial/include/CGAL/Polynomial_traits_d.h @@ -999,7 +999,7 @@ public: // Sign_at, Sign_at_homogeneous, Compare // define XXX_ even though ICoeff may not be Real_embeddable - // select propoer XXX among XXX_ or Null_functor using ::boost::mpl::if_ + // select propoer XXX among XXX_ or Null_functor using ::std::conditional_t private: struct Sign_at_ { private: @@ -1036,8 +1036,8 @@ private: typedef Real_embeddable_traits RET_IC; typedef typename RET_IC::Is_real_embeddable IC_is_real_embeddable; public: - typedef typename ::boost::mpl::if_::type Sign_at; - typedef typename ::boost::mpl::if_::type Sign_at_homogeneous; + typedef std::conditional_t Sign_at; + typedef std::conditional_t Sign_at_homogeneous; typedef typename Real_embeddable_traits::Compare Compare; diff --git a/Property_map/include/CGAL/Dynamic_property_map.h b/Property_map/include/CGAL/Dynamic_property_map.h index a7dc48b5354..bca414e19b0 100644 --- a/Property_map/include/CGAL/Dynamic_property_map.h +++ b/Property_map/include/CGAL/Dynamic_property_map.h @@ -19,7 +19,6 @@ #include #include -#include #include @@ -127,9 +126,9 @@ struct Dynamic_with_index { typedef Key key_type; typedef Value value_type; - typedef typename boost::mpl::if_< std::is_same, - value_type, - value_type&>::type reference; + typedef std::conditional_t< std::is_same_v, + value_type, + value_type&> reference; typedef boost::read_write_property_map_tag category; Dynamic_with_index() diff --git a/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h b/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h index f77f1d9c07f..ef7c6164f2d 100644 --- a/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h +++ b/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include diff --git a/STL_Extension/include/CGAL/Compact_container.h b/STL_Extension/include/CGAL/Compact_container.h index 24f7ef91c72..81ff5cf1bce 100644 --- a/STL_Extension/include/CGAL/Compact_container.h +++ b/STL_Extension/include/CGAL/Compact_container.h @@ -35,8 +35,6 @@ #include #include -#include - // 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 @@ -866,10 +864,10 @@ namespace internal { 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::conditional_t< Const, const value_type*, + value_type*> pointer; + typedef std::conditional_t< Const, const value_type&, + value_type&> reference; typedef std::bidirectional_iterator_tag iterator_category; // the initialization with nullptr is required by our Handle concept. diff --git a/STL_Extension/include/CGAL/Concurrent_compact_container.h b/STL_Extension/include/CGAL/Concurrent_compact_container.h index 7f18ab80f57..e6a2a5dbecf 100644 --- a/STL_Extension/include/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/include/CGAL/Concurrent_compact_container.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 INRIA Sophia-Antipolis (France). +3// Copyright (c) 2012 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org) @@ -36,8 +36,6 @@ #include #include -#include - namespace CGAL { #define CGAL_GENERATE_MEMBER_DETECTOR(X) \ diff --git a/STL_Extension/include/CGAL/Handle_with_policy.h b/STL_Extension/include/CGAL/Handle_with_policy.h index 5f952a66e15..528bf8061d1 100644 --- a/STL_Extension/include/CGAL/Handle_with_policy.h +++ b/STL_Extension/include/CGAL/Handle_with_policy.h @@ -21,8 +21,6 @@ #include #include -#include - #include #ifdef CGAL_USE_LEDA @@ -728,10 +726,10 @@ public: static Bind bind; // Define type that is used for function matching - typedef typename ::boost::mpl::if_c< + typedef std::conditional_t< is_class_hierarchy, ::CGAL::Tag_true, - ::CGAL::Tag_false >::type + ::CGAL::Tag_false > Class_hierarchy; //! the internal representation, i.e., \c T plus a reference count diff --git a/STL_Extension/include/CGAL/Named_function_parameters.h b/STL_Extension/include/CGAL/Named_function_parameters.h index d0f1648f816..7558aae88f2 100644 --- a/STL_Extension/include/CGAL/Named_function_parameters.h +++ b/STL_Extension/include/CGAL/Named_function_parameters.h @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -143,14 +142,14 @@ struct Lookup_named_param_def typedef typename internal_np::Get_param::type NP_type; typedef typename internal_np::Get_param::reference NP_reference; - typedef typename boost::mpl::if_< - std::is_same, - D, NP_type>::type + typedef std::conditional_t< + std::is_same_v, + D, NP_type> type; - typedef typename boost::mpl::if_< - std::is_same, - D&, NP_reference>::type + typedef std::conditional_t< + std::is_same_v, + D&, NP_reference> reference; }; diff --git a/STL_Extension/include/CGAL/transforming_iterator.h b/STL_Extension/include/CGAL/transforming_iterator.h index bd94ad33c4f..21d88e8f69c 100644 --- a/STL_Extension/include/CGAL/transforming_iterator.h +++ b/STL_Extension/include/CGAL/transforming_iterator.h @@ -12,7 +12,6 @@ #ifndef CGAL_TRANSFORMING_ITERATOR_H #define CGAL_TRANSFORMING_ITERATOR_H #include -#include #include #include #include @@ -55,10 +54,8 @@ class transforming_iterator_helper typedef typename Default::Get>>::type value_type; // Crappy heuristic. If we have *it that returns a Weighted_point and F that returns a reference to the Point contained in the Weighted_point it takes as argument, we do NOT want the transformed iterator to return a reference to the temporary *it. On the other hand, if *it returns an int n, and F returns a reference to array[n] it is not so good to lose the reference. This probably should be done elsewhere and should at least be made optional... - typedef typename boost::mpl::if_< - boost::mpl::or_, - std::is_integral >, - reference_, value_type>::type reference; + typedef std::conditional_t || std::is_integral_v, + reference_, value_type> reference; public: typedef boost::iterator_adaptor< diff --git a/Skin_surface_3/include/CGAL/Skin_surface_base_3.h b/Skin_surface_3/include/CGAL/Skin_surface_base_3.h index 6962b1ec8f2..528ea1e0e83 100644 --- a/Skin_surface_3/include/CGAL/Skin_surface_base_3.h +++ b/Skin_surface_3/include/CGAL/Skin_surface_base_3.h @@ -42,7 +42,6 @@ #include -#include #include namespace CGAL { diff --git a/Spatial_searching/include/CGAL/Fuzzy_iso_box.h b/Spatial_searching/include/CGAL/Fuzzy_iso_box.h index 0b34898eff9..08cc1da0063 100644 --- a/Spatial_searching/include/CGAL/Fuzzy_iso_box.h +++ b/Spatial_searching/include/CGAL/Fuzzy_iso_box.h @@ -22,8 +22,6 @@ #include #include -#include - #include diff --git a/Spatial_searching/include/CGAL/Search_traits_adapter.h b/Spatial_searching/include/CGAL/Search_traits_adapter.h index ff640dc639a..7a518cf68ee 100644 --- a/Spatial_searching/include/CGAL/Search_traits_adapter.h +++ b/Spatial_searching/include/CGAL/Search_traits_adapter.h @@ -224,16 +224,16 @@ public: // Select type of iterator + construct class depending on whether // point map is lvalue or not - typedef typename boost::mpl::if_< - std::is_reference::reference>, + typedef std::conditional_t< + std::is_reference_v::reference>, typename Base::Cartesian_const_iterator_d, - No_lvalue_iterator>::type + No_lvalue_iterator> Cartesian_const_iterator_d; - typedef typename boost::mpl::if_< - std::is_reference::reference>, + typedef std::conditional_t< + std::is_reference_v::reference>, Construct_cartesian_const_iterator_d_lvalue, - Construct_cartesian_const_iterator_d_no_lvalue>::type + Construct_cartesian_const_iterator_d_no_lvalue> Construct_cartesian_const_iterator_d; struct Construct_iso_box_d: public Base::Construct_iso_box_d{ diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h index a799eccda60..30b1e25de59 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -36,12 +35,10 @@ struct Has_inexact_constructions { typedef typename K::FT FT ; - typedef typename boost::mpl::if_< boost::mpl::or_< std::is_same - , std::is_same - > - , Tag_true - , Tag_false - >::type type ; + typedef std::conditional_t< std::is_same_v || std::is_same_v + , Tag_true + , Tag_false + > type ; } ; template diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h index 4ce20796d1a..02b050f790a 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h @@ -34,7 +34,6 @@ #include #include -#include #include #include @@ -96,9 +95,9 @@ namespace internal { template struct Itag { - typedef typename boost::mpl::if_::Is_exact, + typedef std::conditional_t<(typename Algebraic_structure_traits::Is_exact)::value, Exact_intersections_tag, - Exact_predicates_tag>::type type; + Exact_predicates_tag> type; }; } // namespace internal diff --git a/Triangulation_2/include/CGAL/Regular_triangulation_2.h b/Triangulation_2/include/CGAL/Regular_triangulation_2.h index f7e4a653060..c3ab2223a0a 100644 --- a/Triangulation_2/include/CGAL/Regular_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Regular_triangulation_2.h @@ -23,7 +23,6 @@ #include #include -#include #include #include diff --git a/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h b/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h index 93e00b1680f..29513248384 100644 --- a/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h @@ -26,7 +26,6 @@ #include #include -#include #include #include #include diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index aa58c124ed1..7795840a2e6 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -54,7 +54,6 @@ #include #endif -#include #include #include #include diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_with_weighted_circumcenter_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_with_weighted_circumcenter_3.h index 3a73305b380..f2c945342e8 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_with_weighted_circumcenter_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_with_weighted_circumcenter_3.h @@ -22,7 +22,6 @@ #include #include -#include #include namespace CGAL { diff --git a/Triangulation_3/include/CGAL/Triangulation_3.h b/Triangulation_3/include/CGAL/Triangulation_3.h index 7b8ef9ab6c8..fd4b530c7a8 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_3.h @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include diff --git a/Triangulation_3/include/CGAL/Triangulation_hierarchy_3.h b/Triangulation_3/include/CGAL/Triangulation_hierarchy_3.h index 021e40e2ffe..c852a4bed75 100644 --- a/Triangulation_3/include/CGAL/Triangulation_hierarchy_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_hierarchy_3.h @@ -48,7 +48,6 @@ #include #include #include -#include #include #include diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h index 78b8822f598..01f08ac186c 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_delaunay_3.h @@ -25,7 +25,6 @@ #include #include -#include #include #include diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h index e93418c19cf..20c4351bc49 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_parallel_triangulation_3.h @@ -16,7 +16,6 @@ #include #include -#include template diff --git a/Triangulation_3/test/Triangulation_3/test_regular_insert_range_with_info.cpp b/Triangulation_3/test/Triangulation_3/test_regular_insert_range_with_info.cpp index e4f80d9149f..c1b00d9aca9 100644 --- a/Triangulation_3/test/Triangulation_3/test_regular_insert_range_with_info.cpp +++ b/Triangulation_3/test/Triangulation_3/test_regular_insert_range_with_info.cpp @@ -37,9 +37,9 @@ struct Tester void test_iterator_on_pair() const { typedef std::vector > Container; - typedef typename boost::mpl::if_, - std::add_const_t, - Container>::type Cast_type; + typedef std::conditional_t, + Container> Cast_type; Container points; points.push_back(std::make_pair(Weighted_point(Bare_point(0.160385, 0.599679, 0.374932), -0.118572), 0)); @@ -90,9 +90,9 @@ struct Tester void test_zip_iterator() const { typedef std::vector Container; - typedef typename boost::mpl::if_, - std::add_const_t, - Container >::type Cast_type; + typedef std::conditional_t, + Container > Cast_type; Container points; points.push_back(Weighted_point(Bare_point(0,0,0),1)); @@ -156,9 +156,9 @@ struct Tester void test_transform_iterator() const { typedef std::vector< Weighted_point > Container; - typedef typename boost::mpl::if_, - std::add_const_t, - Container >::type Cast_type; + typedef std::conditional_t, + Container > Cast_type; Container points; points.push_back(Weighted_point(Bare_point(0,0,0),1)); From 8e36b7b37e6dd2e14d55e3997d70d1ec3b0af26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 5 Oct 2023 09:32:22 +0200 Subject: [PATCH 095/139] the map is either const or take by copy --- Property_map/include/CGAL/property_map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 12fd06503fe..f1115cbf05a 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -661,7 +661,7 @@ struct Boolean_property_map return pm.set_ptr->count(k) != 0; } - friend void put(Boolean_property_map& pm, const key_type& k, bool v) + friend void put(Boolean_property_map pm, const key_type& k, bool v) { CGAL_assertion(pm.set_ptr!=nullptr); if (v) From a193a1d8fb9a7efe5e5b92b2e588fcf1be93df65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 9 Oct 2023 09:08:31 +0200 Subject: [PATCH 096/139] implement comments from review --- Installation/CHANGES.md | 4 ++-- .../CGAL/Polygon_mesh_processing/autorefinement.h | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index b361d15dec7..8748eda2db0 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -39,8 +39,8 @@ Release date: October 2023 - Added the function `CGAL::Polygon_mesh_processing::autorefine_triangle_soup()` that refines a soup of triangles so that no pair of triangles intersects - (they can share an edge or a vertex). Also added, the function `autorefine()` operating directly on a triangle mesh and updating it - using the aforementioned function on triangle soup. + in their interiors. Also added, the function `autorefine()` operating directly on a triangle mesh and updating it + using the aforementioned function on a triangle soup. [Release 5.6](https://github.com/CGAL/cgal/releases/tag/v5.6) ----------- diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 884ce3477aa..5b9cad98277 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1131,15 +1131,15 @@ void generate_subtriangles(std::size_t ti, * refines a soup of triangles so that no pair of triangles intersects. * Output triangles may share a common edge or a common vertex (but with the same indexed position in `points`). * Note that points in `soup_points` can only be added (intersection points) at the end of the container, with the initial order preserved. -* Note that if `soup_points` contains two or more identical points and only the first copy (following the order in the `soup_points`) +* Note that if `soup_points` contains two or more identical points then only the first copy (following the order in the `soup_points`) * will be used in `soup_triangles`. -* `soup_triangles` will be updated to contain both the input triangles and the new subdivides triangles. Degenerate triangles will be removed. +* `soup_triangles` will be updated to contain both the input triangles and the new subdivided triangles. Degenerate triangles will be removed. * Also triangles in `soup_triangles` will be triangles without intersection first, followed by triangles coming from a subdivision induced * by an intersection. The named parameter `visitor()` can be used to track * * @tparam PointRange a model of the concept `RandomAccessContainer` * whose value type is the point type -* @tparam TriIdsRange a model of the concepts `RandomAccessContainer`, `BackInsertionSequence` and `Swappable`, whose +* @tparam TriangleRange a model of the concepts `RandomAccessContainer`, `BackInsertionSequence` and `Swappable`, whose * value type is a model of the concept `RandomAccessContainer` whose value type is convertible to `std::size_t` and that * is constructible from an `std::initializer_list` of size 3. * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" @@ -1174,9 +1174,9 @@ void generate_subtriangles(std::size_t ti, * \cgalNamedParamsEnd * */ -template +template void autorefine_triangle_soup(PointRange& soup_points, - TriIdsRange& soup_triangles, + TriangleRange& soup_triangles, const NamedParameters& np = parameters::default_values()) { using parameters::choose_parameter; @@ -1507,7 +1507,7 @@ void autorefine_triangle_soup(PointRange& soup_points, #endif } - TriIdsRange soup_triangles_out; + TriangleRange soup_triangles_out; soup_triangles_out.reserve(soup_triangles.size()); // TODO: remove #deg tri? visitor.number_of_output_triangles(soup_triangles.size()+new_triangles.size()); From 08b25d8778a06ffc5c82118a3dd4c1a41bf8da6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 2 Nov 2023 16:08:37 +0100 Subject: [PATCH 097/139] prevent a warning with older versions of TBB --- .../CGAL/Polygon_mesh_processing/autorefinement.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 5b9cad98277..d25ea95fe90 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -46,6 +46,10 @@ #ifdef CGAL_LINKED_WITH_TBB #include +#if TBB_INTERFACE_VERSION < 12010 && !defined(TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS) +#define CGAL_HAS_DEFINED_TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS +#define TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS +#endif #include #include #ifdef SET_POINT_IDS_USING_MUTEX @@ -1770,4 +1774,10 @@ autorefine( TriangleMesh& tm, } } // end of CGAL::Polygon_mesh_processing +#ifdef CGAL_LINKED_WITH_TBB +#ifdef CGAL_HAS_DEFINED_TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS +#undef TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS +#endif +#endif + #endif // CGAL_POLYGON_MESH_PROCESSING_AUTOREFINEMENT_H From 3176178224785f0dd241ce9d4f78d06449d58cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Sun, 5 Nov 2023 22:52:44 -0800 Subject: [PATCH 098/139] fix compilation issues --- .../include/CGAL/Arr_tags.h | 44 ++++++++++--------- .../Arr_traits_adaptor_2_dispatching.h | 7 +-- .../Arrangement_on_surface_2_global.h | 12 ++--- .../Surface_sweep_2/Arr_overlay_ss_visitor.h | 18 ++++---- .../test/Arrangement_on_surface_2/utils.h | 4 +- .../CGAL/boost/graph/named_params_helper.h | 6 +-- BGL/include/CGAL/boost/graph/properties.h | 2 +- .../Algebraic_structure_traits.h | 2 +- .../CGAL/Concurrent_compact_container.h | 2 +- STL_Extension/include/CGAL/Container_helper.h | 4 +- .../CGAL/Constrained_triangulation_2.h | 7 +-- 11 files changed, 57 insertions(+), 51 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h index 1aac0615585..8ba336b1e19 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h @@ -252,7 +252,7 @@ template struct Arr_is_side_oblivious { typedef ArrSideCategory Side_cat; typedef std::is_same Is_same; - typedef std::conditional result; + typedef std::bool_constant result; typedef typename result::type type; }; @@ -260,7 +260,7 @@ template struct Arr_is_side_open { typedef ArrSideCategory Side_cat; typedef std::is_same Is_same; - typedef std::conditional result; + typedef std::bool_constant result; typedef typename result::type type; }; @@ -268,7 +268,7 @@ template struct Arr_is_side_identified { typedef ArrSideCategory Side_cat; typedef std::is_same Is_same; - typedef std::conditional result; + typedef std::bool_constant result; typedef typename result::type type; }; @@ -276,7 +276,7 @@ template struct Arr_is_side_contracted { typedef ArrSideCategory Side_cat; typedef std::is_same Is_same; - typedef std::conditional result; + typedef std::bool_constant result; typedef typename result::type type; }; @@ -284,7 +284,7 @@ template struct Arr_is_side_closed { typedef ArrSideCategory Side_cat; typedef std::is_same Is_same; - typedef std::conditional result; + typedef std::bool_constant result; typedef typename result::type type; }; @@ -423,11 +423,12 @@ struct Arr_sane_identified_tagging { typedef boost::mpl::or_ LR_ok; typedef boost::mpl::or_ BT_ok; - /*! Boolean tag that is bool_ if opposite sides are either + /*! Boolean tag that is bool_constant if opposite sides are either * both identified or both not-identified, - * otherwise bool_ + * otherwise bool_constant */ - typedef boost::mpl::and_ result; + typedef std::bool_constant result; static constexpr bool value = result::value; }; @@ -447,10 +448,10 @@ struct Arr_has_identified_sides { typedef typename Arr_is_side_identified::result Side_one_ide; typedef typename Arr_is_side_identified::result Side_two_ide; - /*! Boolean tag that is bool_ if one side is identified, - * otherwise bool_ + /*! Boolean tag that is bool_constant if one side is identified, + * otherwise bool_constant */ - typedef boost::mpl::or_ result; + typedef std::bool_constant result; }; /*! Checks whether one of two boundary sides are contracted @@ -463,10 +464,11 @@ struct Arr_has_contracted_sides_two { typedef typename Arr_is_side_contracted::result Side_one_con; typedef typename Arr_is_side_contracted::result Side_two_con; - /*!\ Boolean tag that is bool_ if one side is identified, - * otherwise bool_ + /*!\ Boolean tag that is bool_constant if one side is identified, + * otherwise bool_constant */ - typedef boost::mpl::or_ result; + typedef std::bool_constant result; }; /*! Checks whether one of two boundary sides are closed @@ -479,10 +481,11 @@ struct Arr_has_closed_sides_two { typedef typename Arr_is_side_closed::result Side_one_clo; typedef typename Arr_is_side_closed::result Side_two_clo; - /*! Boolean tag that is bool_ if one side is identified, - * otherwise bool_ + /*! Boolean tag that is bool_constant if one side is identified, + * otherwise bool_constant */ - typedef boost::mpl::or_ result; + typedef std::bool_constant result; }; /*! Checks whether one of two boundary sides are open @@ -495,10 +498,11 @@ struct Arr_has_open_sides_two { typedef typename Arr_is_side_open::result Side_one_ope; typedef typename Arr_is_side_open::result Side_two_ope; - /*! Boolean tag that is bool_ if one side is identified, - * otherwise bool_ + /*! Boolean tag that is bool_constant if one side is identified, + * otherwise bool_constant */ - typedef boost::mpl::or_ result; + typedef std::bool_constant result; }; /*! Categorizes two boundary sides: diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h index 283b2dc66b5..9bcabf985d6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h @@ -58,11 +58,11 @@ public: private: - typedef std::conditional< + typedef std::conditional_t< std::is_same_v< Arr_smaller_implementation_tag, Arr_use_traits_tag >, std::true_type, std::false_type > Smaller_traits; - typedef std::conditional_t_< + typedef std::conditional_t< std::is_same_v< Arr_larger_implementation_tag, Arr_use_traits_tag >, std::true_type, std::false_type > Larger_traits; @@ -71,7 +71,8 @@ public: //! the result type (if one side asks for traits, then ask traits! //! Or vice versa: If both ask for dummy, then dummy!) typedef std::conditional_t< - Smaller_traits, Larger_traits >::value || Arr_use_traits_tag::value, + Smaller_traits::value || Larger_traits::value, + Arr_use_traits_tag, Arr_use_dummy_tag > type; }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h index ee072c95778..5bc8054c525 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h @@ -64,7 +64,7 @@ namespace Ss2 = Surface_sweep_2; // // error: no matching function for call to `do_intersect(Arrangement_2<>&, // const Arr_segment_2&, const Arr_walk_along_line_point_location<>&, -// mpl_::bool_< true>)' +// std::bool_constant< true>)' // template @@ -135,7 +135,7 @@ void insert(Arrangement_on_surface_2& arr, // // error: no matching function for call to `do_intersect(Arrangement_2<>&, // const Arr_segment_2&, const Arr_walk_along_line_point_location<>&, -// mpl_::bool_< true>)' +// std::bool_constant< true>)' // // template &, // const Arr_segment_2&, const Arr_walk_along_line_point_location<>&, -// mpl_::bool_< true>)' +// std::bool_constant< true>)' // template @@ -463,7 +463,7 @@ void insert(Arrangement_on_surface_2& arr, // // error: no matching function for call to `do_intersect(Arrangement_2<>&, // const Arr_segment_2&, const Arr_walk_along_line_point_location<>&, -// mpl_::bool_< true>)' +// std::bool_constant< true>)' // template @@ -1524,7 +1524,7 @@ zone(Arrangement_on_surface_2& arr, // workaround since it didn't compile in FC3_g++-3.4.4 with the error of: // // error: no matching function for call to `do_intersect(Arrangement_on_surface_2<>&, -// const Arr_segment_2&, const Arr_walk_along_line_point_location<>&, mpl_::bool_< true>)' +// const Arr_segment_2&, const Arr_walk_along_line_point_location<>&, std::bool_constant< true>)' // template @@ -1562,7 +1562,7 @@ do_intersect(Arrangement_on_surface_2& arr, // // error: no matching function for call to // `do_intersect(Arrangement_on_surface_2<>&, -// const Arr_segment_2&, const Arr_walk_along_line_point_location<>&, mpl_::bool_< true>)' +// const Arr_segment_2&, const Arr_walk_along_line_point_location<>&, std::bool_constant< true>)' // template diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h index 30c8b38b4a0..06052a8f19d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h @@ -295,7 +295,7 @@ protected: * \param tag The tag used for dispatching. */ void _map_boundary_vertices(Event* event, Vertex_handle v, - boost::mpl::bool_ /* tag */); + std::bool_constant /* tag */); /*! * Update the boundary vertices map. @@ -306,7 +306,7 @@ protected: * \param tag The tag used for dispatching. */ void _map_boundary_vertices(Event* event, Vertex_handle v, - boost::mpl::bool_ /* tag */); + std::bool_constant /* tag */); /*! * Update a newly created vertex using the overlay traits. @@ -319,7 +319,7 @@ protected: * \param tag The tag used for dispatching. */ void _create_vertex(Event* event, Vertex_handle res_v, Subcurve* sc, - boost::mpl::bool_ /* tag */); + std::bool_constant /* tag */); /*! * Update a newly created vertex using the overlay traits. @@ -331,7 +331,7 @@ protected: * \param tag The tag used for dispatching. */ void _create_vertex(Event* event, Vertex_handle res_v, Subcurve* sc, - boost::mpl::bool_ /* tag */); + std::bool_constant /* tag */); /*! * Update a newly created edge using the overlay traits. @@ -922,7 +922,7 @@ _map_halfedge_and_twin(Halfedge_handle he, // template void Arr_overlay_ss_visitor:: -_map_boundary_vertices(Event* event, Vertex_handle v, boost::mpl::bool_) +_map_boundary_vertices(Event* event, Vertex_handle v, std::bool_constant) { // Update the red and blue object if the last event on sc is on the boundary. if ((event->parameter_space_in_x() != ARR_INTERIOR) || @@ -960,7 +960,7 @@ _map_boundary_vertices(Event* event, Vertex_handle v, boost::mpl::bool_) template void Arr_overlay_ss_visitor:: _map_boundary_vertices(Event* /* event */, Vertex_handle /* v */, - boost::mpl::bool_) + std::bool_constant) {} /* Notify the overlay traits about a newly created vertex. @@ -974,7 +974,7 @@ void Arr_overlay_ss_visitor:: _create_vertex(Event* event, Vertex_handle new_v, Subcurve* sc, - boost::mpl::bool_) + std::bool_constant) { const Point_2& pt = event->point(); const Cell_handle_red* red_handle = pt.red_cell_handle(); @@ -1011,7 +1011,7 @@ _create_vertex(Event* event, return; } - _create_vertex(event, new_v, sc, boost::mpl::bool_()); + _create_vertex(event, new_v, sc, std::bool_constant()); } /* Notify the overlay traits about a newly created vertex. */ @@ -1020,7 +1020,7 @@ void Arr_overlay_ss_visitor:: _create_vertex(Event* event, Vertex_handle new_v, Subcurve* sc, - boost::mpl::bool_) + std::bool_constant) { const Point_2& pt = event->point(); const Cell_handle_red* red_handle = pt.red_cell_handle(); diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/utils.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/utils.h index f49b92f4c01..f4975fb1428 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/utils.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/utils.h @@ -55,13 +55,13 @@ private: // This function is invoked for traits classes where at least one // boundary is not oblivious and all boundaries are not identified. bool operator()(const Point_2& p1, const Point_2& p2, - boost::mpl::bool_) const + std::bool_constant) const { return (m_traits.compare_xy_2_object()(p1, p2) == CGAL::SMALLER); } // This function should be invoked for traits classes where at least one // boundary is identified. bool operator()(const Point_2& p1, const Point_2& p2, - boost::mpl::bool_) const + std::bool_constant) const { // Compare in y boundaries: CGAL::Arr_parameter_space ps_y1 = diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index 4dce0049b1a..7dd7edd0887 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -46,9 +46,9 @@ public: typename boost::property_map::type, typename boost::cgal_no_property::type> type; typedef std::conditional_t::const_type, - typename boost::cgal_no_property::const_type - >::type const_type; + typename boost::property_map::const_type, + typename boost::cgal_no_property::const_type + > const_type; type get_pmap(const PropertyTag& p, PolygonMesh& pmesh) { diff --git a/BGL/include/CGAL/boost/graph/properties.h b/BGL/include/CGAL/boost/graph/properties.h index 1fd71599ad1..e8ab8b8bc43 100644 --- a/BGL/include/CGAL/boost/graph/properties.h +++ b/BGL/include/CGAL/boost/graph/properties.h @@ -140,7 +140,7 @@ struct Point_accessor typedef ValueType value_type; typedef Handle key_type; - typedef std::conditional_t< std::is_reference, + typedef std::conditional_t< std::is_reference_v, ValueType&, ValueType > Reference; diff --git a/Number_types/include/CGAL/Sqrt_extension/Algebraic_structure_traits.h b/Number_types/include/CGAL/Sqrt_extension/Algebraic_structure_traits.h index b1500148b59..c2175bc9439 100644 --- a/Number_types/include/CGAL/Sqrt_extension/Algebraic_structure_traits.h +++ b/Number_types/include/CGAL/Sqrt_extension/Algebraic_structure_traits.h @@ -206,7 +206,7 @@ public: // Tag_true if COEFF and ROOT are exact typedef std::conditional_t< std::is_same_v::Is_exact,::CGAL::Tag_true> && - std::is_same::Is_exact,::CGAL::Tag_true> + std::is_same_v::Is_exact,::CGAL::Tag_true> ,::CGAL::Tag_true,::CGAL::Tag_false> Is_exact; typedef typename Algebraic_structure_traits::Is_numerical_sensitive diff --git a/STL_Extension/include/CGAL/Concurrent_compact_container.h b/STL_Extension/include/CGAL/Concurrent_compact_container.h index e6a2a5dbecf..7f5533f92b7 100644 --- a/STL_Extension/include/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/include/CGAL/Concurrent_compact_container.h @@ -1,4 +1,4 @@ -3// Copyright (c) 2012 INRIA Sophia-Antipolis (France). +// Copyright (c) 2012 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org) diff --git a/STL_Extension/include/CGAL/Container_helper.h b/STL_Extension/include/CGAL/Container_helper.h index aeb66ea052b..9f5ac5a84cb 100644 --- a/STL_Extension/include/CGAL/Container_helper.h +++ b/STL_Extension/include/CGAL/Container_helper.h @@ -50,8 +50,8 @@ void resize(Container& CGAL_assertion_code(array), std::size_t CGAL_assertion_co template void resize(Container&, std::size_t, std::enable_if_t< - !boost::mpl::or_, - has_size >::value >* = nullptr) + !(has_resize::value || + has_size::value)>* = nullptr) { } diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h index 02b050f790a..3cc57168971 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h @@ -95,9 +95,10 @@ namespace internal { template struct Itag { - typedef std::conditional_t<(typename Algebraic_structure_traits::Is_exact)::value, - Exact_intersections_tag, - Exact_predicates_tag> type; + using Is_exact = typename Algebraic_structure_traits::Is_exact; + typedef std::conditional_t type; }; } // namespace internal From 25233e8f67f84d4d21df2ba7ce4e85612b14b611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 7 Nov 2023 09:15:18 +0100 Subject: [PATCH 099/139] undo bad change --- Periodic_3_mesh_3/include/CGAL/Periodic_3_function_wrapper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Periodic_3_mesh_3/include/CGAL/Periodic_3_function_wrapper.h b/Periodic_3_mesh_3/include/CGAL/Periodic_3_function_wrapper.h index b1ee5e65065..bfb4b4e8716 100644 --- a/Periodic_3_mesh_3/include/CGAL/Periodic_3_function_wrapper.h +++ b/Periodic_3_mesh_3/include/CGAL/Periodic_3_function_wrapper.h @@ -47,7 +47,7 @@ public: private: typedef std::conditional_t, Function_*, - Function_>: Stored_function; + Function_> Stored_function; /// Function to wrap Stored_function f_; From 2277013d8479336f114a3d5fdc859d427d6e4324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 10 Nov 2023 16:06:03 +0100 Subject: [PATCH 100/139] replace boost::mpl::and_ --- .../internal/Is_ray_intersection_geomtraits.h | 10 +++--- .../include/CGAL/Arr_tags.h | 34 +++++++++---------- .../include/CGAL/Homogeneous/PointH2.h | 4 +-- .../include/CGAL/Homogeneous/PointH3.h | 6 ++-- .../include/CGAL/Homogeneous/VectorH2.h | 4 +-- .../include/CGAL/Homogeneous/VectorH3.h | 6 ++-- .../CGAL/NewKernel_d/Cartesian_filter_K.h | 8 ++--- .../include/CGAL/NewKernel_d/Lazy_cartesian.h | 6 ++-- .../include/CGAL/NewKernel_d/functor_tags.h | 12 +++---- Number_types/include/CGAL/Lazy_exact_nt.h | 6 ++-- .../CGAL/Sqrt_extension/Sqrt_extension_type.h | 8 ++--- .../Periodic_2_Delaunay_triangulation_2.h | 7 ++-- STL_Extension/include/CGAL/Container_helper.h | 6 ++-- .../include/CGAL/type_traits/is_iterator.h | 15 ++++---- Stream_support/include/CGAL/IO/helpers.h | 10 +++--- .../Constrained_Delaunay_triangulation_2.h | 6 ++-- .../include/CGAL/Delaunay_triangulation_2.h | 6 ++-- .../include/CGAL/Regular_triangulation_2.h | 6 ++-- .../include/CGAL/Triangulation_2.h | 6 ++-- .../include/CGAL/Delaunay_triangulation_3.h | 6 ++-- .../include/CGAL/Regular_triangulation_3.h | 7 ++-- .../include/CGAL/Triangulation_3.h | 6 ++-- .../include/CGAL/Triangulation_hierarchy_3.h | 6 ++-- 23 files changed, 85 insertions(+), 106 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_tree/internal/Is_ray_intersection_geomtraits.h b/AABB_tree/include/CGAL/AABB_tree/internal/Is_ray_intersection_geomtraits.h index e662b13be90..3d02204b9d0 100644 --- a/AABB_tree/include/CGAL/AABB_tree/internal/Is_ray_intersection_geomtraits.h +++ b/AABB_tree/include/CGAL/AABB_tree/internal/Is_ray_intersection_geomtraits.h @@ -32,11 +32,11 @@ BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_cartesian_const_iterator_3,Cartesian_const template struct Is_ray_intersection_geomtraits -: boost::mpl::and_< Has_ray_3, - Has_construct_source_3, - Has_vector_3, - Has_construct_cartesian_const_iterator_3, - Has_cartesian_const_iterator_3 >::type +: std::bool_constant< Has_ray_3::value && + Has_construct_source_3::value && + Has_vector_3::value && + Has_construct_cartesian_const_iterator_3::value && + Has_cartesian_const_iterator_3::value > {}; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h index 8ba336b1e19..94ea503e244 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h @@ -272,6 +272,10 @@ struct Arr_is_side_identified { typedef typename result::type type; }; +template +inline constexpr bool Arr_is_side_identified_v = + Arr_is_side_identified::type::value; + template struct Arr_is_side_contracted { typedef ArrSideCategory Side_cat; @@ -403,33 +407,27 @@ struct Arr_sane_identified_tagging { typedef ArrBottomSideCategory Bot_side_cat; typedef ArrTopSideCategory Top_side_cat; - typedef typename Arr_is_side_identified::result Lef_ide; - typedef typename Arr_is_side_identified::result Rig_ide; - typedef typename Arr_is_side_identified::result Bot_ide; - typedef typename Arr_is_side_identified::result Top_ide; + static inline constexpr bool lef_ide = Arr_is_side_identified_v; + static inline constexpr bool rig_ide = Arr_is_side_identified_v; + static inline constexpr bool bot_ide = Arr_is_side_identified_v; + static inline constexpr bool top_ide = Arr_is_side_identified_v; - typedef boost::mpl::and_ LR_ide; - typedef boost::mpl::and_ BT_ide; + static inline constexpr bool lr_ide = lef_ide && rig_ide; + static inline constexpr bool bt_ide = bot_ide && top_ide; - typedef boost::mpl::not_ Lef_not_ide; - typedef boost::mpl::not_ Rig_not_ide; - typedef boost::mpl::not_ Bot_not_ide; - typedef boost::mpl::not_ Top_not_ide; + static inline constexpr bool lr_not_ide = !lef_ide && !rig_ide; - typedef boost::mpl::and_ LR_not_ide; + static inline constexpr bool bt_not_ide = !bot_ide && !top_ide; - typedef boost::mpl::and_ BT_not_ide; - - typedef boost::mpl::or_ LR_ok; - typedef boost::mpl::or_ BT_ok; + static inline constexpr bool lr_ok = lr_ide || lr_not_ide; + static inline constexpr bool bt_ok = bt_ide || bt_not_ide; /*! Boolean tag that is bool_constant if opposite sides are either * both identified or both not-identified, * otherwise bool_constant */ - typedef std::bool_constant result; - static constexpr bool value = result::value; + typedef std::bool_constant result; + static inline constexpr bool value = result::value; }; /*! Checks whether one of two boundary sides are identified diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h index afb6bff830e..06ff55945fe 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH2.h @@ -53,8 +53,8 @@ public: template < typename Tx, typename Ty > PointH2(const Tx & x, const Ty & y, - std::enable_if_t< boost::mpl::and_, - std::is_convertible >::value >* = 0) + std::enable_if_t< std::is_convertible_v && + std::is_convertible_v >* = 0) : base(x, y) {} PointH2(const FT& x, const FT& y) diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h index 87da02cabff..f64d5b64c9a 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/PointH3.h @@ -52,9 +52,9 @@ public: template < typename Tx, typename Ty, typename Tz > PointH3(const Tx & x, const Ty & y, const Tz & z, - std::enable_if_t< boost::mpl::and_< boost::mpl::and_< std::is_convertible, - std::is_convertible >, - std::is_convertible >::value >* = 0) + std::enable_if_t && + std::is_convertible_v && + std::is_convertible_v>* = 0) : base(x, y, z) {} PointH3(const FT& x, const FT& y, const FT& z) diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH2.h index 81cd3107595..92afeec7941 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH2.h @@ -57,8 +57,8 @@ public: template < typename Tx, typename Ty > VectorH2(const Tx & x, const Ty & y, - std::enable_if_t< boost::mpl::and_, - std::is_convertible >::value >* = 0) + std::enable_if_t && + std::is_convertible_v>* = 0) : base(CGAL::make_array(x, y, RT(1))) {} VectorH2(const FT& x, const FT& y) diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH3.h index 5228d5251ad..aecd718d41a 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/VectorH3.h @@ -67,9 +67,9 @@ public: template < typename Tx, typename Ty, typename Tz > VectorH3(const Tx & x, const Ty & y, const Tz & z, - std::enable_if_t< boost::mpl::and_< boost::mpl::and_< std::is_convertible, - std::is_convertible >, - std::is_convertible >::value >* = 0) + std::enable_if_t< std::is_convertible_v && + std::is_convertible_v && + std::is_convertible_v>* = 0) : base(CGAL::make_array(x, y, z, RT(1))) {} VectorH3(const FT& x, const FT& y, const FT& z) diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h index 25ec0c4f25c..ef44403f9f5 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h @@ -64,10 +64,10 @@ struct Cartesian_filter_K : public Base_ EK_rt exact_kernel()const{return sek.kernel();} // MSVC is too dumb to perform the empty base optimization. - typedef boost::mpl::and_< - internal::Do_not_store_kernel, - internal::Do_not_store_kernel, - internal::Do_not_store_kernel > Do_not_store_kernel; + typedef std::bool_constant< + internal::Do_not_store_kernel::value && + internal::Do_not_store_kernel::value && + internal::Do_not_store_kernel::value > Do_not_store_kernel; //TODO: C2A/C2E could be able to convert *this into this->kernel() or this->kernel2(). typedef KernelD_converter C2A; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h b/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h index 6e6b496840e..67ea76e11fb 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h @@ -260,9 +260,9 @@ struct Lazy_cartesian : void set_dimension(int dim){ak.set_dimension(dim);ek.set_dimension(dim);} // For compilers that do not handle [[no_unique_address]] - typedef boost::mpl::and_< - internal::Do_not_store_kernel, - internal::Do_not_store_kernel > Do_not_store_kernel; + typedef std::bool_constant< + internal::Do_not_store_kernel::value && + internal::Do_not_store_kernel::value > Do_not_store_kernel; typedef typename EK_::Dimension Dimension; // ? typedef Lazy_cartesian Self; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h b/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h index 4eb0e890063..b3230858573 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h @@ -64,16 +64,16 @@ namespace CGAL { : Has_type_different_from, Null_functor> {}; template::type::value> - struct Provides_functors : boost::mpl::and_ < - Provides_functor::type>, - Provides_functors::type> > {}; + struct Provides_functors : std::bool_constant< + Provides_functor::type>::value && + Provides_functors::type>::value > {}; template struct Provides_functors : std::true_type {}; template::type::value> - struct Provides_types : boost::mpl::and_ < - Provides_type::type>, - Provides_types::type> > {}; + struct Provides_types : std::bool_constant< + Provides_type::type>::value && + Provides_types::type>::value > {}; template struct Provides_types : std::true_type {}; diff --git a/Number_types/include/CGAL/Lazy_exact_nt.h b/Number_types/include/CGAL/Lazy_exact_nt.h index 3f8a2812968..d15c11a73bd 100644 --- a/Number_types/include/CGAL/Lazy_exact_nt.h +++ b/Number_types/include/CGAL/Lazy_exact_nt.h @@ -382,9 +382,9 @@ public : // Also check that ET and AT are constructible from T? template - Lazy_exact_nt (T i, std::enable_if_t, std::is_enum >, - boost::mpl::not_ > >::value,void*> = 0) + Lazy_exact_nt (T i, std::enable_if_t< + (std::is_arithmetic_v || std::is_enum_v) && + !std::is_same_v,void*> = 0) : Base(new Lazy_exact_Cst(i)) {} Lazy_exact_nt (const ET & e) diff --git a/Number_types/include/CGAL/Sqrt_extension/Sqrt_extension_type.h b/Number_types/include/CGAL/Sqrt_extension/Sqrt_extension_type.h index 4a562530c75..6b87205b501 100644 --- a/Number_types/include/CGAL/Sqrt_extension/Sqrt_extension_type.h +++ b/Number_types/include/CGAL/Sqrt_extension/Sqrt_extension_type.h @@ -178,10 +178,10 @@ public: */ template explicit Sqrt_extension(const NTX& a, const NTX& b, const NTX& c, const bool is_smaller, - std::enable_if_t< boost::mpl::and_< - std::is_same< typename Fraction_traits::Numerator_type,NTX >, - std::is_same< typename Fraction_traits::Numerator_type,NTX > - >::value >* = 0 ) + std::enable_if_t< + std::is_same_v< typename Fraction_traits::Numerator_type,NTX > && + std::is_same_v< typename Fraction_traits::Numerator_type,NTX > + >* = 0 ) { typename Fraction_traits::Compose compose_nt; typename Fraction_traits::Compose compose_root; diff --git a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_Delaunay_triangulation_2.h b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_Delaunay_triangulation_2.h index 1232e426aed..c83be87df90 100644 --- a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_Delaunay_triangulation_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_Delaunay_triangulation_2.h @@ -435,10 +435,9 @@ public: boost::zip_iterator< boost::tuple > last, bool is_large_point_set = true, std::enable_if_t < - boost::mpl::and_ < - std::is_convertible< typename std::iterator_traits::value_type, Point >, - std::is_convertible< typename std::iterator_traits::value_type, typename internal::Info_check::type > - >::value >* = nullptr) + std::is_convertible_v< typename std::iterator_traits::value_type, Point > && + std::is_convertible_v< typename std::iterator_traits::value_type, typename internal::Info_check::type > + >* = nullptr) { return insert_with_info< boost::tuple::type> >(first, last, is_large_point_set); } diff --git a/STL_Extension/include/CGAL/Container_helper.h b/STL_Extension/include/CGAL/Container_helper.h index 9f5ac5a84cb..18a98dfa456 100644 --- a/STL_Extension/include/CGAL/Container_helper.h +++ b/STL_Extension/include/CGAL/Container_helper.h @@ -38,10 +38,8 @@ void resize(Container& c, std::size_t size, // Container without a resize() function, but with a size() function (e.g. an array) template void resize(Container& CGAL_assertion_code(array), std::size_t CGAL_assertion_code(size), - std::enable_if_t< - boost::mpl::and_< - boost::mpl::not_ >, - has_size >::value >* = nullptr) + std::enable_if_t::value && + has_size::value >* = nullptr) { CGAL_assertion(array.size() == size); } diff --git a/STL_Extension/include/CGAL/type_traits/is_iterator.h b/STL_Extension/include/CGAL/type_traits/is_iterator.h index 6630dd8ceb1..8d476da2036 100644 --- a/STL_Extension/include/CGAL/type_traits/is_iterator.h +++ b/STL_Extension/include/CGAL/type_traits/is_iterator.h @@ -35,14 +35,13 @@ BOOST_MPL_HAS_XXX_TRAIT_DEF(reference) //provide all 5 nested types provided by iterator_traits template struct is_iterator_ - : public boost::mpl::or_< - boost::mpl::and_< - has_iterator_category, - has_value_type, - has_difference_type, - has_pointer, - has_reference >, - std::is_pointer > + : public std::bool_constant< + ( has_iterator_category::value && + has_value_type::value && + has_difference_type::value && + has_pointer::value && + has_reference::value) || + std::is_pointer_v > { }; template ::value> diff --git a/Stream_support/include/CGAL/IO/helpers.h b/Stream_support/include/CGAL/IO/helpers.h index bba12aa85a7..015c5f047c7 100644 --- a/Stream_support/include/CGAL/IO/helpers.h +++ b/Stream_support/include/CGAL/IO/helpers.h @@ -77,10 +77,10 @@ struct is_Point_set_3 : has_Point_set { }; // Point_set_3 and strings also functions as ranges, but we want to match polygon soups here template struct is_Range - : public boost::mpl::and_< - boost::has_range_const_iterator, // should be a range - boost::mpl::not_ >, // but not a Point_set_3 - boost::mpl::not_ > > // or a std::string / char [x] + : public std::bool_constant< + boost::has_range_const_iterator::value && // should be a range + !is_Point_set_3::value && // but not a Point_set_3 + !std::is_convertible_v > // or a std::string / char [x] { }; template @@ -89,7 +89,7 @@ inline constexpr bool is_Range_v = is_Range::value; // For polygon meshes template struct is_Point_set_or_Range_or_Iterator - : public boost::mpl::or_, is_Range, is_iterator > + : public bool_constant::value || is_Range::value || is_iterator::value > { }; template diff --git a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h index a96be0e6d76..52c14ea54b7 100644 --- a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h @@ -413,10 +413,8 @@ public: insert( boost::zip_iterator< boost::tuple > first, boost::zip_iterator< boost::tuple > last, std::enable_if_t< - boost::mpl::and_< - std::is_convertible< typename std::iterator_traits::value_type, Point >, - std::is_convertible< typename std::iterator_traits::value_type, typename internal::Info_check::type > - >::value + std::is_convertible_v< typename std::iterator_traits::value_type, Point > && + std::is_convertible_v< typename std::iterator_traits::value_type, typename internal::Info_check::type > >* =nullptr ) { diff --git a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h index 34a282b9162..617e8c23a8a 100644 --- a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h @@ -385,10 +385,8 @@ public: insert(boost::zip_iterator< boost::tuple > first, boost::zip_iterator< boost::tuple > last, std::enable_if_t< - boost::mpl::and_< - std::is_convertible< typename std::iterator_traits::value_type, Point >, - std::is_convertible< typename std::iterator_traits::value_type, typename internal::Info_check::type > - >::value + std::is_convertible_v< typename std::iterator_traits::value_type, Point > && + std::is_convertible_v< typename std::iterator_traits::value_type, typename internal::Info_check::type > >* = nullptr) { return insert_with_info< boost::tuple::type> >(first,last); diff --git a/Triangulation_2/include/CGAL/Regular_triangulation_2.h b/Triangulation_2/include/CGAL/Regular_triangulation_2.h index c3ab2223a0a..d5d1a6c5917 100644 --- a/Triangulation_2/include/CGAL/Regular_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Regular_triangulation_2.h @@ -528,10 +528,8 @@ public: insert(boost::zip_iterator< boost::tuple > first, boost::zip_iterator< boost::tuple > last, std::enable_if_t< - boost::mpl::and_< - typename std::is_convertible< typename std::iterator_traits::value_type, Weighted_point >, - typename std::is_convertible< typename std::iterator_traits::value_type, typename internal::Info_check::type > - >::value + typename std::is_convertible_v< typename std::iterator_traits::value_type, Weighted_point > && + typename std::is_convertible_v< typename std::iterator_traits::value_type, typename internal::Info_check::type > >* =nullptr ) {return insert_with_info< boost::tuple::type> >(first,last);} diff --git a/Triangulation_2/include/CGAL/Triangulation_2.h b/Triangulation_2/include/CGAL/Triangulation_2.h index c79aa0128d2..14e8604640f 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2.h @@ -710,10 +710,8 @@ public: insert(boost::zip_iterator< boost::tuple > first, boost::zip_iterator< boost::tuple > last, std::enable_if_t< - boost::mpl::and_< - std::is_convertible< typename std::iterator_traits::value_type, Point >, - std::is_convertible< typename std::iterator_traits::value_type, typename internal::Info_check::type > - >::value + std::is_convertible_v< typename std::iterator_traits::value_type, Point > && + std::is_convertible_v< typename std::iterator_traits::value_type, typename internal::Info_check::type > >* = NULL) { return insert_with_info< boost::tuple::type> >(first,last); diff --git a/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h b/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h index 8b22fddd349..63ade11b5e8 100644 --- a/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h @@ -494,10 +494,8 @@ public: insert(boost::zip_iterator< boost::tuple > first, boost::zip_iterator< boost::tuple > last, std::enable_if_t< - boost::mpl::and_< - std::is_convertible< typename std::iterator_traits::value_type, Point >, - std::is_convertible< typename std::iterator_traits::value_type, typename internal::Info_check::type > - >::value + std::is_convertible_v< typename std::iterator_traits::value_type, Point > && + std::is_convertible_v< typename std::iterator_traits::value_type, typename internal::Info_check::type > >* =nullptr) { return insert_with_info< boost::tuple > first, boost::zip_iterator< boost::tuple > last, std::enable_if_t< - boost::mpl::and_< - typename std::is_convertible< typename std::iterator_traits::value_type, Weighted_point >, - typename std::is_convertible< typename std::iterator_traits::value_type, typename internal::Info_check::type > - >::value >* =nullptr) + typename std::is_convertible_v< typename std::iterator_traits::value_type, Weighted_point > && + typename std::is_convertible_v< typename std::iterator_traits::value_type, typename internal::Info_check::type > + >* =nullptr) { return insert_with_info< boost::tuple > first, boost::zip_iterator< boost::tuple > last, std::enable_if_t< - boost::mpl::and_< - std::is_convertible< typename std::iterator_traits::value_type, Point >, - std::is_convertible< typename std::iterator_traits::value_type, typename internal::Info_check::type > - >::value + std::is_convertible_v< typename std::iterator_traits::value_type, Point > && + std::is_convertible_v< typename std::iterator_traits::value_type, typename internal::Info_check::type > >* =NULL) { return insert_with_info< boost::tuple > first, boost::zip_iterator< boost::tuple > last, std::enable_if_t< - boost::mpl::and_< - std::is_convertible< typename std::iterator_traits::value_type, Point >, - std::is_convertible< typename std::iterator_traits::value_type, typename internal::Info_check::type > - >::value + std::is_convertible_v< typename std::iterator_traits::value_type, Point > && + std::is_convertible_v< typename std::iterator_traits::value_type, typename internal::Info_check::type > >* =nullptr ) { From 4344c3cc27a869018c400adc149cd36539f19a8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 10 Nov 2023 16:34:19 +0100 Subject: [PATCH 101/139] replace boost::mpl::or_ --- Arrangement_on_surface_2/include/CGAL/Arr_tags.h | 16 ++++++++-------- CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h | 11 +++++------ CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v7.h | 11 +++++------ Filtered_kernel/include/CGAL/Lazy_kernel.h | 6 +++--- .../CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h | 4 ++-- .../CGAL/Polygon_mesh_processing/intersection.h | 14 ++++++-------- STL_Extension/include/CGAL/type_traits.h | 8 ++++---- Stream_support/include/CGAL/IO/helpers.h | 2 +- 8 files changed, 34 insertions(+), 38 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h index 94ea503e244..384666f80fa 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h @@ -377,15 +377,15 @@ private: typedef typename Arr_is_side_open::result Bot_ope; typedef typename Arr_is_side_open::result Top_ope; - typedef boost::mpl::or_ Lef_obl_or_ope; - typedef boost::mpl::or_ Rig_obl_or_ope; - typedef boost::mpl::or_ Bot_obl_or_ope; - typedef boost::mpl::or_ Top_obl_or_ope; + static inline constexpr bool lef_obl_or_ope = Lef_obl::value || Lef_ope::value; + static inline constexpr bool rig_obl_or_ope = Rig_obl::value || Rig_ope::value; + static inline constexpr bool bot_obl_or_ope = Bot_obl::value || Bot_ope::value; + static inline constexpr bool top_obl_or_ope = Top_obl::value || Top_ope::value; - typedef std::conditional_t tmp; diff --git a/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h b/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h index 48572f24118..9876131f47b 100644 --- a/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h +++ b/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h @@ -636,12 +636,11 @@ public: template void draw_in_ipe(const iterator begin,const iterator end,const Iso_rectangle_2& bbox,bool make_grp=true,bool deselect_all=false, - std::enable_if_t< boost::mpl::or_< std::is_same::value_type,Point_2> , - boost::mpl::or_< std::is_same::value_type,Segment_2> , - boost::mpl::or_< std::is_same::value_type,Circle_2> , - boost::mpl::or_< std::is_same::value_type,Circular_arc_2> , - std::is_same::value_type,Polygon_2> - > > > >::value + std::enable_if_t< std::is_same_v::value_type,Point_2> || + std::is_same_v::value_type,Segment_2> || + std::is_same_v::value_type,Circle_2> || + std::is_same_v::value_type,Circular_arc_2> || + std::is_same_v::value_type,Polygon_2> >* = nullptr) const { for (iterator it=begin;it!=end;++it) diff --git a/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v7.h b/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v7.h index 5373b0a3445..3dc51367d33 100644 --- a/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v7.h +++ b/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v7.h @@ -645,12 +645,11 @@ public: template void draw_in_ipe(const iterator begin,const iterator end,const Iso_rectangle_2& bbox,bool make_grp=true,bool deselect_all=false, - std::enable_if_t< boost::mpl::or_< std::is_same::value_type,Point_2> , - boost::mpl::or_< std::is_same::value_type,Segment_2> , - boost::mpl::or_< std::is_same::value_type,Circle_2> , - boost::mpl::or_< std::is_same::value_type,Circular_arc_2> , - std::is_same::value_type,Polygon_2> - > > > >::value + std::enable_if_t< std::is_same_v::value_type,Point_2> || + std::is_same_v::value_type,Segment_2> || + std::is_same_v::value_type,Circle_2> || + std::is_same_v::value_type,Circular_arc_2> || + std::is_same_v::value_type,Polygon_2> >* = nullptr) const { for (iterator it=begin;it!=end;++it) diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index c6b6cb2444a..8f43a8a1af1 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -198,9 +198,9 @@ private: boost::mpl::eval_if< std::is_same< typename internal::Lazy_result_type::type, CGAL::Object >, boost::mpl::int_, - boost::mpl::eval_if< boost::mpl::or_< - std::is_same< typename internal::Lazy_result_type::type, CGAL::Bbox_2 >, - std::is_same< typename internal::Lazy_result_type::type, CGAL::Bbox_3 > >, + boost::mpl::eval_if< std::bool_constant< + std::is_same_v< typename internal::Lazy_result_type::type, CGAL::Bbox_2 > || + std::is_same_v< typename internal::Lazy_result_type::type, CGAL::Bbox_3 > >, boost::mpl::int_, boost::mpl::int_ > > >, boost::mpl::int_ >::type {}; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h index 9ddd7953e24..50d9a8c8b00 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Cartesian_wrap.h @@ -83,8 +83,8 @@ template struct result_{typedef transforming_iterator struct result; template struct result : result_ {}; -template std::enable_if_t,Is_wrapper_iterator >::value,T> const& operator()(T const& t) const {return t;} -template std::enable_if_t,Is_wrapper_iterator >::value,T>& operator()(T& t) const {return t;} +template std::enable_if_t::value || Is_wrapper_iterator::value,T> const& operator()(T const& t) const {return t;} +template std::enable_if_t::value || Is_wrapper_iterator::value,T>& operator()(T& t) const {return t;} template typename T::Rep const& operator()(T const& t, std::enable_if_t::value >* = 0) const {return t.rep();} diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h index f32f9d907a9..a72d9ffaafc 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h @@ -1426,18 +1426,16 @@ bool do_intersect(const TriangleMesh& tm, const Polyline& polyline, const CGAL_NP_CLASS& np = parameters::default_values() #ifndef DOXYGEN_RUNNING - , const std::enable_if_t< - ! boost::mpl::or_< - typename std::is_same::type, // Added to please MSVC 2015 - typename boost::mpl::not_::type>::type, // not a range - typename boost::has_range_iterator< + , const std::enable_if_t || // Added to please MSVC 2015 + !boost::has_range_iterator::type>::value || // not a range + boost::has_range_iterator< typename boost::mpl::eval_if< boost::has_range_iterator, boost::range_value, std::false_type - >::type - >::type // not a range of a range - >::value + >::value + ) >* = 0 #endif ) diff --git a/STL_Extension/include/CGAL/type_traits.h b/STL_Extension/include/CGAL/type_traits.h index 59aae8a0307..c68386c7f76 100644 --- a/STL_Extension/include/CGAL/type_traits.h +++ b/STL_Extension/include/CGAL/type_traits.h @@ -21,10 +21,10 @@ namespace CGAL { template< class Base, class Derived > struct is_same_or_derived : - public ::boost::mpl::or_< - ::std::is_same< Base, Derived >, - ::boost::is_base_and_derived< Base, Derived > - >::type + public std::bool_constant< + ::std::is_same_v< Base, Derived > || + ::boost::is_base_and_derived< Base, Derived >::value + > {}; namespace cpp20 { diff --git a/Stream_support/include/CGAL/IO/helpers.h b/Stream_support/include/CGAL/IO/helpers.h index 015c5f047c7..7382ebabd66 100644 --- a/Stream_support/include/CGAL/IO/helpers.h +++ b/Stream_support/include/CGAL/IO/helpers.h @@ -89,7 +89,7 @@ inline constexpr bool is_Range_v = is_Range::value; // For polygon meshes template struct is_Point_set_or_Range_or_Iterator - : public bool_constant::value || is_Range::value || is_iterator::value > + : public std::bool_constant::value || is_Range::value || is_iterator::value > { }; template From 2f104a6f76ac233f58fb23b885747385cf3d1eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 10 Nov 2023 16:38:24 +0100 Subject: [PATCH 102/139] replace boost::mpl::not_ --- Arrangement_on_surface_2/include/CGAL/Arr_tags.h | 12 ++++++------ NewKernel_d/include/CGAL/NewKernel_d/utils.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h index 384666f80fa..8f3c78095f4 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h @@ -334,17 +334,17 @@ private: typedef typename Arr_is_side_open::result Bot_ope; typedef typename Arr_is_side_open::result Top_ope; - typedef boost::mpl::not_ Lef_not_ope; - typedef boost::mpl::not_ Rig_not_ope; - typedef boost::mpl::not_ Bot_not_ope; - typedef boost::mpl::not_ Top_not_ope; + static inline constexpr bool lef_not_ope = !Lef_ope::value; + static inline constexpr bool rig_not_ope = !Rig_ope::value; + static inline constexpr bool bot_not_ope = !Bot_ope::value; + static inline constexpr bool top_not_ope = !Top_ope::value; public: /*! Boolean tag that is Arr_all_sides_not_open_tag if all sides are not-open, * otherwise Arr_not_all_sides_not_open_tag */ - typedef std::conditional_t result; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/utils.h b/NewKernel_d/include/CGAL/NewKernel_d/utils.h index f2e6a2f3ada..4296f179462 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/utils.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/utils.h @@ -38,7 +38,7 @@ template ::value /*false*/> struct Has_type_different_from : std::false_type {}; template struct Has_type_different_from -: boost::mpl::not_ > {}; +: std::bool_constant> {}; template struct Wrap_type { typedef T type; }; From e4e13e2f571adf44fe2107d064ed801b18067ba5 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 14 Nov 2023 12:28:18 +0100 Subject: [PATCH 103/139] do not check the graph of features after protection when minimal_size is set when minimal_size is set, the graph of features is likely to be invalid or at least inconsistent with the input graph so checking its topology does not make any sense and could lead to - assertions failing in debug mode, - hanging in release mode --- Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index 72198460181..4cd4d1c3af4 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -1456,7 +1456,7 @@ refine_balls() dump_c3t3_edges(c3t3_, "dump-before-check_and_repopulate_edges"); #endif // Check edges - if(!forced_stop()) { + if(!forced_stop() && minimal_size_ == FT()) { check_and_repopulate_edges(); } } From d9bdf5cfc5eacb36c0c012d2c77651bf7b5dbbcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 23 Nov 2023 09:38:28 +0100 Subject: [PATCH 104/139] remove extra typename --- Triangulation_2/include/CGAL/Regular_triangulation_2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Triangulation_2/include/CGAL/Regular_triangulation_2.h b/Triangulation_2/include/CGAL/Regular_triangulation_2.h index d5d1a6c5917..3353b7d7603 100644 --- a/Triangulation_2/include/CGAL/Regular_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Regular_triangulation_2.h @@ -528,8 +528,8 @@ public: insert(boost::zip_iterator< boost::tuple > first, boost::zip_iterator< boost::tuple > last, std::enable_if_t< - typename std::is_convertible_v< typename std::iterator_traits::value_type, Weighted_point > && - typename std::is_convertible_v< typename std::iterator_traits::value_type, typename internal::Info_check::type > + std::is_convertible_v< typename std::iterator_traits::value_type, Weighted_point > && + std::is_convertible_v< typename std::iterator_traits::value_type, typename internal::Info_check::type > >* =nullptr ) {return insert_with_info< boost::tuple::type> >(first,last);} From 6cd28f751ed670181c76660623e1e5d6185ce2e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 23 Nov 2023 09:39:17 +0100 Subject: [PATCH 105/139] use std integral_constant --- STL_Extension/include/CGAL/tags.h | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/STL_Extension/include/CGAL/tags.h b/STL_Extension/include/CGAL/tags.h index 6aa1988e1cc..eba9ffdc721 100644 --- a/STL_Extension/include/CGAL/tags.h +++ b/STL_Extension/include/CGAL/tags.h @@ -19,26 +19,13 @@ #define CGAL_TAGS_H #include -#include namespace CGAL { struct Void {}; -// Boolean_tag is a model of the Boost Integral Constant concept. -// https://www.boost.org/libs/mpl/doc/refmanual/integral-constant.html template -struct Boolean_tag { - typedef boost::mpl::integral_c_tag tag; - typedef bool value_type; - static const bool value = b; - typedef Boolean_tag type; - operator bool() const { return this->value; } -}; -/* In C++11, try: -template -using Boolean_tag = std::integral_constant; -*/ +using Boolean_tag = std::bool_constant; typedef Boolean_tag Tag_true; typedef Boolean_tag Tag_false; From 16de47d1e6543e08259f68e83f6625790ceaf2d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 23 Nov 2023 14:55:30 +0100 Subject: [PATCH 106/139] more fixes --- .../include/CGAL/Polygon_mesh_processing/intersection.h | 4 ++-- QP_solver/test/QP_solver/test_solver.cpp | 1 + Triangulation_3/include/CGAL/Regular_triangulation_3.h | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h index a72d9ffaafc..a996edae648 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h @@ -1428,12 +1428,12 @@ bool do_intersect(const TriangleMesh& tm, #ifndef DOXYGEN_RUNNING , const std::enable_if_t || // Added to please MSVC 2015 - !boost::has_range_iterator::type>::value || // not a range + !boost::has_range_iterator::value || // not a range boost::has_range_iterator< typename boost::mpl::eval_if< boost::has_range_iterator, boost::range_value, - std::false_type + std::false_type>::type >::value ) >* = 0 diff --git a/QP_solver/test/QP_solver/test_solver.cpp b/QP_solver/test/QP_solver/test_solver.cpp index ad298449b55..4fc641cc286 100644 --- a/QP_solver/test/QP_solver/test_solver.cpp +++ b/QP_solver/test/QP_solver/test_solver.cpp @@ -282,6 +282,7 @@ bool process(const std::string& filename, { using std::cout; using std::endl; + using CGAL::check_tag; // extract verbosity: const int verbosity = options.find("Verbosity")->second; diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index b4ff7de189c..18026962520 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -612,8 +612,8 @@ public: insert(boost::zip_iterator< boost::tuple > first, boost::zip_iterator< boost::tuple > last, std::enable_if_t< - typename std::is_convertible_v< typename std::iterator_traits::value_type, Weighted_point > && - typename std::is_convertible_v< typename std::iterator_traits::value_type, typename internal::Info_check::type > + std::is_convertible_v< typename std::iterator_traits::value_type, Weighted_point > && + std::is_convertible_v< typename std::iterator_traits::value_type, typename internal::Info_check::type > >* =nullptr) { return insert_with_info< From 0714c960bb8ebdcc0f1b9a11772cf87d4cd16f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 7 Dec 2023 16:08:33 +0100 Subject: [PATCH 107/139] reset left event of curves after the deletion of the event --- .../include/CGAL/Surface_sweep_2/Default_subcurve.h | 11 +++++++++++ .../CGAL/Surface_sweep_2/Surface_sweep_2_impl.h | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Default_subcurve.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Default_subcurve.h index dd8215e67a1..1fe4a21a06f 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Default_subcurve.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Default_subcurve.h @@ -104,6 +104,17 @@ protected: public: + + void reset_left_event() + { + this->set_left_event(static_cast(nullptr)); + if (m_orig_subcurve1) + { + m_orig_subcurve1->reset_left_event(); + m_orig_subcurve2->reset_left_event(); + } + } + /*! Get the subcurves that originate an overlap. */ Subcurve* originating_subcurve1() { return m_orig_subcurve1; } diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h index 41d96180310..d720f763c57 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h @@ -307,6 +307,14 @@ void Surface_sweep_2::_handle_overlaps_in_right_curves() template void Surface_sweep_2::_handle_right_curves() { + + for(Event_subcurve_iterator sc_it = this->m_currentEvent->right_curves_begin(), + sc_it_end = this->m_currentEvent->right_curves_end(); + sc_it!=sc_it_end; ++sc_it) + { + (*sc_it)->reset_left_event(); + } + CGAL_SS_PRINT_START("handling right curves at ("); CGAL_SS_DEBUG(this->PrintEvent(this->m_currentEvent)); CGAL_SS_PRINT_TEXT(")"); From a54f18998063f83ecc8f33b8735cac799383b2ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 7 Dec 2023 16:09:31 +0100 Subject: [PATCH 108/139] Revert "more than one curve can be on the left of an event with overlapping curves on the right" This reverts commit 2260c4fab3756034d8fd80b1bbd7f079cae0b698. --- .../Surface_sweep_2/Surface_sweep_2_impl.h | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h index d720f763c57..cd36570d27b 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h @@ -110,28 +110,19 @@ void Surface_sweep_2::_handle_left_curves() this->m_currentEvent->push_back_curve_to_right(sc); } else { + this->m_currentEvent->push_back_curve_to_left(sc); this->m_currentEvent->set_weak_intersection(); - auto status_line_it = this->m_status_line_insert_hint; - do{ - this->m_currentEvent->push_back_curve_to_left(sc); - this->m_visitor->update_event(this->m_currentEvent, sc); - _add_curve_to_right(this->m_currentEvent, sc); - ++status_line_it; - if (status_line_it==this->m_statusLine.end()) break; - if (this->m_statusLineCurveLess(this->m_currentEvent->point(), *status_line_it)!=EQUAL) - break; - sc = *status_line_it; - } - while(true); // the loop is only needed in case there are overlapping curve in right curves + this->m_visitor->update_event(this->m_currentEvent, sc); + _add_curve_to_right(this->m_currentEvent, sc); } - // some subcurves have been addded on the left + // sc is now on the left CGAL_SS_PRINT_TEXT("Event after update:"); CGAL_SS_PRINT_EOL(); CGAL_SS_PRINT_EVENT_INFO(this->m_currentEvent); CGAL_SS_PRINT_EOL(); CGAL_assertion(std::distance(this->m_currentEvent->left_curves_begin(), - this->m_currentEvent->left_curves_end())!=0); + this->m_currentEvent->left_curves_end())==1); } else { // The event is not located on any subcurve. From bcdc0f9f92093d0356afa3d3017150badd6ee74f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 8 Dec 2023 11:45:25 +0100 Subject: [PATCH 109/139] remove non needed include --- .../examples/Polygon_mesh_processing/soup_autorefinement.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp index a44d47c8b6d..5baea1a3964 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp @@ -1,6 +1,4 @@ #include -#include - #include #include #include From d620bcd61a7d7f05946f6bd6173a3b1fea917473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 8 Dec 2023 13:20:23 +0100 Subject: [PATCH 110/139] user manual --- .../Polygon_mesh_processing.txt | 13 +++++++++++++ .../doc/Polygon_mesh_processing/examples.txt | 1 + 2 files changed, 14 insertions(+) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt index 00ccfd382f6..6a658a5829f 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt @@ -864,6 +864,19 @@ vertices at identical positions, can be used to repair this configuration. \section PMPGeometricRepair Geometric Repair **************************************** +\subsection PMPAutoref Self-intersection Resolution (Autorefinement) in Triangle Soups +Given a soup of triangles, a self-intersection is defined as the intersection of two triangles from the soup +such that the intersection is not defined by the convex hull of one, two or three shared vertices. +In other words, it is an intersection that happens in the interior of one of the two triangles, or in the interior +of one their edges, except if identical points are associated to different vertices of the triangle soup which +would then also includes overlaps of duplicated points. + +The function `CGAL::Polygon_mesh_processing::autorefine_triangle_soup()` provides a way to refine a triangle soup +using the intersections of the triangles from the soup. In particular, if some points are duplicated they will be +merged. Note that if a kernel with exact predicates but inexact constructions is used, some new self-intersections +might be introduced due to rounding issues of points coordinates. +To guarantee that the triangle soup is free from self-intersections, a kernel with exact constructions must be used. + \subsection PMPRemoveCapsNeedles Removal of Almost Degenerate Triangle Faces Triangle faces of a mesh made up of almost collinear points are badly shaped elements that might not be desirable to have in a mesh. The function diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/examples.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/examples.txt index 146e1261ff4..c582dc76739 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/examples.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/examples.txt @@ -43,4 +43,5 @@ \example Polygon_mesh_processing/cc_compatible_orientations.cpp \example Polygon_mesh_processing/remesh_planar_patches.cpp \example Polygon_mesh_processing/remesh_almost_planar_patches.cpp +\example Polygon_mesh_processing/soup_autorefinement.cpp */ From 9ac0ef686f157c9311bc5ea969abc1320992e7d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 8 Dec 2023 13:24:55 +0100 Subject: [PATCH 111/139] aspell check --- .../doc/Polygon_mesh_processing/Polygon_mesh_processing.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt index 6a658a5829f..d52fd823cd4 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt @@ -214,7 +214,7 @@ it can try to equalize the angles between incident edges, or (and) move vertices Border vertices are considered constrained and do not move at any step of the procedure. No vertices are inserted at any time. Angle and area smoothing algorithms are based on Surazhsky and Gotsman \cgalCite{cgal:sg-hqct-04}. Since area smoothing considers only areas as a smoothing criterion, it may result in long and skinny -triangles. To paliate this phenomenon, area smoothing is followed by an (optional) step of Delaunay-based edge flips. +triangles. To palliate this phenomenon, area smoothing is followed by an (optional) step of Delaunay-based edge flips. In any case, area smoothing is guaranteed to improve the spatial distribution of the vertices over the area that is being smoothed. A simple example can be found in \ref Polygon_mesh_processing/mesh_smoothing_example.cpp. @@ -434,7 +434,7 @@ depicted in red); (iii) `clip_volume=true`: clipping of the volume bounded by th \cgalFigureEnd \cgalFigureBegin{coref_clip_compact, clip_compact.png} -Clipping a cube with a halfspace: compacity of the clipper (`clip_volume=false` in both cases). +Clipping a cube with a halfspace: compactivity of the clipper (`clip_volume=false` in both cases). From left to right: (i) initial cube and the plane defining the clipping halfspace, note that a whole face of the cube (2 triangles) is exactly contained in the plane; (ii) `use_compact_clipper=true`: clipping of the surface mesh with a compact halfspace: coplanar faces are part of the output; From e352f2b17c0d871f56f9829bdd7a0c0ca60473fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 8 Dec 2023 13:27:04 +0100 Subject: [PATCH 112/139] fix doc --- .../Concepts/PMPAutorefinementVisitor.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPAutorefinementVisitor.h b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPAutorefinementVisitor.h index e3ef90e9be0..ef2f124329b 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPAutorefinementVisitor.h +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPAutorefinementVisitor.h @@ -6,7 +6,9 @@ /// the creation of new triangles. /// /// \cgalRefines{CopyConstructible} -/// \cgalHasModel `CGAL::Polygon_mesh_processing::Autorefinement::Default_visitor`. +/// \cgalHasModelsBegin +/// \cgalHasModels{CGAL::Polygon_mesh_processing::Autorefinement::Default_visitor} +/// \cgalHasModelsEnd class PMPAutorefinementVisitor{ public: From 8d0a047685cfea8e1d2f272efe8aa8468b93b5c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 8 Dec 2023 14:22:41 +0100 Subject: [PATCH 113/139] remote debug code and abandonned alternatives --- .../Polygon_mesh_processing/autorefinement.h | 512 +++--------------- 1 file changed, 63 insertions(+), 449 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index d25ea95fe90..bb81855edd5 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -26,7 +26,7 @@ #include #include -#ifdef USE_PROGRESS_DISPLAY +#ifdef CGAL_AUTOREF_USE_PROGRESS_DISPLAY #include #endif @@ -52,29 +52,22 @@ #endif #include #include -#ifdef SET_POINT_IDS_USING_MUTEX +#ifdef CGAL_AUTOREF_SET_POINT_IDS_USING_MUTEX #include #endif #endif #include -#define TEST_RESOLVE_INTERSECTION -#define DEDUPLICATE_SEGMENTS -//#define USE_DEBUG_PARALLEL_TIMERS -//#define DEBUG_COUNTERS -//#define USE_FIXED_PROJECTION_TRAITS -//#define DEBUG_DEPTH +//#define CGAL_AUTOREF_USE_DEBUG_PARALLEL_TIMERS +//#define CGAL_AUTOREFINE_DEBUG_COUNTERS +//#define CGAL_AUTOREF_DEBUG_DEPTH -#ifdef USE_DEBUG_PARALLEL_TIMERS +#ifdef CGAL_AUTOREF_USE_DEBUG_PARALLEL_TIMERS #include #endif -#ifdef USE_FIXED_PROJECTION_TRAITS -#include -#endif - -#if defined(DEBUG_COUNTERS) || defined(USE_DEBUG_PARALLEL_TIMERS) +#if defined(CGAL_AUTOREFINE_DEBUG_COUNTERS) || defined(CGAL_AUTOREF_USE_DEBUG_PARALLEL_TIMERS) #include #endif @@ -123,20 +116,11 @@ Segment_inter_type do_coplanar_segments_intersect(std::size_t pi, std::size_t qi, std::size_t ri, std::size_t si, const std::vector& points, - const typename K::Vector_3& plane_normal, + const typename K::Vector_3& /* plane_normal */, const K& k = K()) { typename K::Collinear_are_ordered_along_line_3 cln_order = k.collinear_are_ordered_along_line_3_object(); -#ifdef USE_PROJECTED_ORIENTATION_2_FOR_COPLANAR_ORIENTATION_TESTS - auto cpl_orient = - [&plane_normal](const typename K::Point_3& p, const typename K::Point_3& q, const typename K::Point_3& r) - { - return ::CGAL::orientation(q-p, r-p, plane_normal); - }; -#else typename K::Coplanar_orientation_3 cpl_orient=k.coplanar_orientation_3_object(); - CGAL_USE(plane_normal); -#endif const typename K::Point_3& p=points[pi]; const typename K::Point_3& q=points[qi]; @@ -267,75 +251,6 @@ do_coplanar_segments_intersect(std::size_t pi, std::size_t qi, return NO_INTERSECTION; } -////////////////////////////////// -////////////////////////////////// -////////////////////////////////// -////////////////////////////////// -////////////////////////////////// - -#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION -template -void old_intersection_coplanar_triangles_cutoff(const typename Kernel::Point_3& p, - const typename Kernel::Point_3& q, - const typename Kernel::Point_3& r, - const Kernel& k, - std::list& inter_pts) -{ - typedef typename std::list::iterator Iterator; - - if(inter_pts.empty()) - return; - - typename Kernel::Coplanar_orientation_3 orient = k.coplanar_orientation_3_object(); - typename Kernel::Construct_line_3 line = k.construct_line_3_object(); - - //orient(p,q,r,r) is POSITIVE - std::map orientations; - for (Iterator it=inter_pts.begin();it!=inter_pts.end();++it) - orientations[ &(*it) ]=orient(p,q,r,*it); - - CGAL_kernel_assertion_code(int pt_added = 0;) - - const typename Kernel::Point_3* prev = &(*std::prev(inter_pts.end())); - Iterator stop = inter_pts.size() > 2 ? inter_pts.end() : std::prev(inter_pts.end()); - for(Iterator it=inter_pts.begin(); it!=stop; ++it) - { - const typename Kernel::Point_3& curr = *it; - Orientation or_prev = orientations[prev], - or_curr = orientations[&curr]; - - if((or_prev == POSITIVE && or_curr == NEGATIVE) || - (or_prev == NEGATIVE && or_curr == POSITIVE)) - { - typename Intersection_traits::result_type - obj = ::CGAL::Intersections::internal::intersection(line(p,q), line(*prev,curr), k); - - // assert "not empty" - CGAL_kernel_assertion(bool(obj)); - - const typename Kernel::Point_3* inter = ::CGAL::Intersections::internal::intersect_get(obj); - CGAL_kernel_assertion(inter != nullptr); - - prev = &(*inter_pts.insert(it,*inter)); - orientations[prev] = COLLINEAR; - CGAL_kernel_assertion_code(++pt_added;) - } - - prev = &(*it); - } - - CGAL_kernel_assertion(pt_added<3); - Iterator it = inter_pts.begin(); - while(it!=inter_pts.end()) - { - if(orientations[&(*it)] == NEGATIVE) - inter_pts.erase(it++); - else - ++it; - } -} -#endif - // imported from Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h template void coplanar_intersections(const std::array& t1, @@ -350,146 +265,14 @@ void coplanar_intersections(const std::array& t1, l_inter_pts.push_back(Intersections::internal::Point_on_triangle(-1,1)); l_inter_pts.push_back(Intersections::internal::Point_on_triangle(-1,2)); -#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION - std::list old_l_inter_pts; - old_l_inter_pts.push_back(p2); - old_l_inter_pts.push_back(q2); - old_l_inter_pts.push_back(r2); - - - auto enum_to_string = [](CGAL::Orientation o) - { - if (o==COLLINEAR) return std::string("COLLINEAR"); - if (o==POSITIVE) return std::string("POSITIVE"); - return std::string("NEGATIVE"); - }; - - auto to_string = [](const auto& t) - { - std::stringstream sstr; - sstr << "4 " - << to_double(t[0].x()) << " " << to_double(t[0].y()) << " " << to_double(t[0].z()) << " " - << to_double(t[1].x()) << " " << to_double(t[1].y()) << " " << to_double(t[1].z()) << " " - << to_double(t[2].x()) << " " << to_double(t[2].y()) << " " << to_double(t[2].z()) << " " - << to_double(t[0].x()) << " " << to_double(t[0].y()) << " " << to_double(t[0].z()) << "\n"; - return sstr.str(); - }; - - std::cout << "intersection_coplanar_triangles\n"; - std::ofstream("/tmp/t1.polylines.txt") << to_string(t1) << "\n"; - std::ofstream("/tmp/t2.polylines.txt") << to_string(t2) << "\n"; - - std::cout << "Position of vertices of t1: "; - std::cout << enum_to_string( coplanar_orientation(p2,q2,r2,p1)) << " - "; - std::cout << enum_to_string( coplanar_orientation(p2,q2,r2,q1)) << " - "; - std::cout << enum_to_string( coplanar_orientation(p2,q2,r2,r1)) << "\n"; - std::cout << " "; - std::cout << enum_to_string( coplanar_orientation(q2,r2,p2,p1)) << " - "; - std::cout << enum_to_string( coplanar_orientation(q2,r2,p2,q1)) << " - "; - std::cout << enum_to_string( coplanar_orientation(q2,r2,p2,r1)) << "\n"; - std::cout << " "; - std::cout << enum_to_string( coplanar_orientation(r2,p2,q2,p1)) << " - "; - std::cout << enum_to_string( coplanar_orientation(r2,p2,q2,q1)) << " - "; - std::cout << enum_to_string( coplanar_orientation(r2,p2,q2,r1)) << "\n"; - std::cout << "Position of vertices of t2: "; - std::cout << enum_to_string( coplanar_orientation(p1,q1,r1,p2)) << " - "; - std::cout << enum_to_string( coplanar_orientation(p1,q1,r1,q2)) << " - "; - std::cout << enum_to_string( coplanar_orientation(p1,q1,r1,r2)) << "\n"; - std::cout << " "; - std::cout << enum_to_string( coplanar_orientation(q1,r1,p1,p2)) << " - "; - std::cout << enum_to_string( coplanar_orientation(q1,r1,p1,q2)) << " - "; - std::cout << enum_to_string( coplanar_orientation(q1,r1,p1,r2)) << "\n"; - std::cout << " "; - std::cout << enum_to_string( coplanar_orientation(r1,p1,q1,p2)) << " - "; - std::cout << enum_to_string( coplanar_orientation(r1,p1,q1,q2)) << " - "; - std::cout << enum_to_string( coplanar_orientation(r1,p1,q1,r2)) << "\n"; - - auto print_points = [&]() - { - for(auto p : l_inter_pts) std::cout << " (" << p.id1() << "," << p.id2() << ",[" << p.alpha << "]) "; std::cout <<"\n"; - }; - std::cout << " ipts size: " << l_inter_pts.size() << "\n"; - print_points(); -#endif - //intersect t2 with the three half planes which intersection defines t1 K k; Intersections::internal::intersection_coplanar_triangles_cutoff(p1,q1,r1,0,p2,q2,r2,k,l_inter_pts); //line p1q1 -#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION - std::cout << " ipts size: " << l_inter_pts.size() << "\n"; - print_points(); - old_intersection_coplanar_triangles_cutoff(p1,q1,r1,k,old_l_inter_pts); - CGAL_assertion(l_inter_pts.size()==old_l_inter_pts.size()); - for (std::size_t i=0; ipoint(p1,q1,r1,p2,q2,r2,k)) - { - std::cout <<"ERROR with point #" << i << "\n"; - throw std::runtime_error("invalid output 0"); - } - } -#endif Intersections::internal::intersection_coplanar_triangles_cutoff(q1,r1,p1,1,p2,q2,r2,k,l_inter_pts); //line q1r1 -#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION - std::cout << " ipts size: " << l_inter_pts.size() << "\n"; - print_points(); - old_intersection_coplanar_triangles_cutoff(q1,r1,p1,k,old_l_inter_pts); - CGAL_assertion(l_inter_pts.size()==old_l_inter_pts.size()); - for (std::size_t i=0; ipoint(p1,q1,r1,p2,q2,r2,k)) - { - std::cout <<"ERROR with point #" << i << "\n"; - throw std::runtime_error("invalid output 1"); - } - } -#endif Intersections::internal::intersection_coplanar_triangles_cutoff(r1,p1,q1,2,p2,q2,r2,k,l_inter_pts); //line r1p1 -#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION - std::cout << " ipts size: " << l_inter_pts.size() << "\n"; - print_points(); - old_intersection_coplanar_triangles_cutoff(r1,p1,q1,k,old_l_inter_pts); - CGAL_assertion(l_inter_pts.size()==old_l_inter_pts.size()); - for (std::size_t i=0; ipoint(p1,q1,r1,p2,q2,r2,k)) - { - std::cout <<"ERROR with point #" << i << "\n"; - throw std::runtime_error("invalid output 2"); - } - } -#endif - -#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION - std::size_t start=inter_pts.size(); -#endif for (const Intersections::internal::Point_on_triangle& pot : l_inter_pts) inter_pts.push_back( pot.point(p1,q1,r1,p2,q2,r2,k) ); - -#ifdef CGAL_DEBUG_COPLANAR_T3_T3_INTERSECTION - for (std::size_t i=0; i> i; -#endif - } // imported from Polygon_mesh_processing/internal/Corefinement/intersect_triangle_segment_3.h @@ -509,23 +292,6 @@ find_intersection(const typename K::Point_3& p, const typename K::Point_3& q, / int nb_coplanar=(ab==COPLANAR?1:0) + (bc==COPLANAR?1:0) + (ca==COPLANAR?1:0); -/* - if ( nb_coplanar==0 ) - return result_type(ON_FACE,hd,is_src_coplanar,is_tgt_coplanar); - - if (nb_coplanar==1){ - if (ab==COPLANAR) - // intersection is ab - return result_type(ON_EDGE,next(hd,tm),is_src_coplanar,is_tgt_coplanar); - if (bc==COPLANAR) - // intersection is bc - return result_type(ON_EDGE,prev(hd,tm),is_src_coplanar,is_tgt_coplanar); - CGAL_assertion(ca==COPLANAR); - // intersection is ca - return result_type(ON_EDGE,hd,is_src_coplanar,is_tgt_coplanar); - } -*/ - if (is_p_coplanar) { inter_pts.push_back(p); @@ -646,7 +412,7 @@ bool collect_intersections(const std::array& t1, if (ori[0]== COPLANAR && ori[1]==COPLANAR && ori[2]==COPLANAR) { coplanar_intersections(t1, t2, inter_pts); -#ifdef DEBUG_DEPTH +#ifdef CGAL_AUTOREF_DEBUG_DEPTH for (auto p : inter_pts) if (depth(p)>2) throw std::runtime_error("Depth is not 4: "+std::to_string(depth(p))); #endif @@ -674,7 +440,7 @@ bool collect_intersections(const std::array& t1, auto last = std::unique(inter_pts.begin(), inter_pts.end()); inter_pts.erase(last, inter_pts.end()); -#ifdef DEBUG_DEPTH +#ifdef CGAL_AUTOREF_DEBUG_DEPTH for (auto p : inter_pts) if (depth(p)>2) throw std::runtime_error("Depth is not 2: "+std::to_string(depth(p))); #endif @@ -682,16 +448,7 @@ bool collect_intersections(const std::array& t1, return false; } -////////////////////////////////// -////////////////////////////////// -////////////////////////////////// -////////////////////////////////// -////////////////////////////////// - template void generate_subtriangles(std::size_t ti, @@ -704,20 +461,8 @@ void generate_subtriangles(std::size_t ti, PointVector& new_triangles ) { - // std::cout << "generate_subtriangles()\n"; - // std::cout << std::setprecision(17); - -#ifdef USE_FIXED_PROJECTION_TRAITS - typedef ::CGAL::internal::Projection_traits_3 P_traits; -#else typedef CGAL::Projection_traits_3 P_traits; -#endif - -#ifndef TEST_RESOLVE_INTERSECTION - typedef CGAL::Exact_intersections_tag Itag; -#else typedef CGAL::No_constraint_intersection_tag Itag; -#endif typedef CGAL::Constrained_Delaunay_triangulation_2 CDT_2; //typedef CGAL::Constrained_triangulation_plus_2 CDT; @@ -729,15 +474,6 @@ void generate_subtriangles(std::size_t ti, typename EK::Vector_3 n = normal(t[0], t[1], t[2]); typename EK::Point_3 o(CGAL::ORIGIN); -#ifdef USE_FIXED_PROJECTION_TRAITS - P_traits cdt_traits; - bool orientation_flipped = false; - CDT cdt(cdt_traits); - // TODO: still need to figure out why I can't make the orientation_flipped correctly - cdt.insert(t[0]); - cdt.insert(t[1]); - cdt.insert(t[2]); -#else bool orientation_flipped = false; if ( typename EK::Less_xyz_3()(o+n,o) ) { @@ -751,9 +487,8 @@ void generate_subtriangles(std::size_t ti, cdt.insert_outside_affine_hull(t[1]); typename CDT::Vertex_handle v = cdt.tds().insert_dim_up(cdt.infinite_vertex(), orientation_flipped); v->set_point(t[2]); -#endif -#ifdef DEBUG_COUNTERS +#ifdef CGAL_AUTOREFINE_DEBUG_COUNTERS struct Counter { int c1=0; @@ -781,37 +516,11 @@ void generate_subtriangles(std::size_t ti, }; static Counter counter; -#define COUNTER_INSTRUCTION(X) X +#define CGAL_AUTOREF_COUNTER_INSTRUCTION(X) X #else -#define COUNTER_INSTRUCTION(X) +#define CGAL_AUTOREF_COUNTER_INSTRUCTION(X) #endif - -#ifdef TEST_RESOLVE_INTERSECTION - //~ static std::ofstream debug("inter_segments.polylines.txt"); - //~ debug.precision(17); - - //~ std::cout << "points.size() " << points.size() << "\n"; - //~ std::set all_triangles_indices(in_triangle_ids.begin(), in_triangle_ids.end()); - //~ all_triangles_indices.insert(ti); - - //~ std::ofstream debug("triangles.polylines.txt"); - //~ debug << std::setprecision(17); - //~ for (std::size_t i : all_triangles_indices) - //~ debug << "4 " - //~ << triangles[i][0] << " " - //~ << triangles[i][1] << " " - //~ << triangles[i][2] << " " - //~ << triangles[i][0] << "\n"; - //~ debug.close(); - //~ debug.open("triangle.off"); - //~ debug << std::setprecision(17); - //~ debug << "OFF\n3 1 0\n"; - //~ debug << triangles[ti][0] << "\n" - //~ << triangles[ti][1] << "\n" - //~ << triangles[ti][2] << "\n 3 0 1 2\n"; - //~ debug.close(); - // pre-compute segment intersections if (!segments.empty()) { @@ -819,7 +528,7 @@ void generate_subtriangles(std::size_t ti, std::vector< std::vector > points_on_segments(nbs); - COUNTER_INSTRUCTION(counter.timer1.start();) + CGAL_AUTOREF_COUNTER_INSTRUCTION(counter.timer1.start();) std::map point_id_map; @@ -831,7 +540,6 @@ void generate_subtriangles(std::size_t ti, CGAL_assertion(insertion_ok); } - auto get_point_id = [&](const typename EK::Point_3& pt) { auto insert_res = point_id_map.insert(std::make_pair(pt, points.size())); @@ -855,17 +563,17 @@ void generate_subtriangles(std::size_t ti, { if ( !do_overlap(segment_boxes[i], segment_boxes[j]) ) { - COUNTER_INSTRUCTION(++counter.c5;) - COUNTER_INSTRUCTION(++counter.total;) + CGAL_AUTOREF_COUNTER_INSTRUCTION(++counter.c5;) + CGAL_AUTOREF_COUNTER_INSTRUCTION(++counter.total;) continue; } - COUNTER_INSTRUCTION(counter.timer5.start();) + CGAL_AUTOREF_COUNTER_INSTRUCTION(counter.timer5.start();) Segment_inter_type seg_inter_type = do_coplanar_segments_intersect(segments[i].first, segments[i].second, segments[j].first, segments[j].second, points, n); - COUNTER_INSTRUCTION(counter.timer5.stop();) + CGAL_AUTOREF_COUNTER_INSTRUCTION(counter.timer5.stop();) switch(seg_inter_type) { @@ -892,25 +600,25 @@ void generate_subtriangles(std::size_t ti, case POINT_INTERSECTION: { if ( coplanar_triangles.count(CGAL::make_sorted_pair(in_triangle_ids[i], in_triangle_ids[j])) == 0 - && coplanar_triangles.count(CGAL::make_sorted_pair(ti, in_triangle_ids[j])) == 0 - && coplanar_triangles.count(CGAL::make_sorted_pair(in_triangle_ids[i], ti)) == 0) + && coplanar_triangles.count(CGAL::make_sorted_pair(ti, in_triangle_ids[j])) == 0 + && coplanar_triangles.count(CGAL::make_sorted_pair(in_triangle_ids[i], ti)) == 0) { - COUNTER_INSTRUCTION(counter.timer6.start();) + CGAL_AUTOREF_COUNTER_INSTRUCTION(counter.timer6.start();) typename EK::Point_3 pt = typename EK::Construct_planes_intersection_point_3()( triangles[in_triangle_ids[i]][0], triangles[in_triangle_ids[i]][1],triangles[in_triangle_ids[i]][2], triangles[in_triangle_ids[j]][0], triangles[in_triangle_ids[j]][1],triangles[in_triangle_ids[j]][2], triangles[ti][0], triangles[ti][1],triangles[ti][2]); - COUNTER_INSTRUCTION(counter.timer6.stop();) + CGAL_AUTOREF_COUNTER_INSTRUCTION(counter.timer6.stop();) - COUNTER_INSTRUCTION(++counter.c1;) + CGAL_AUTOREF_COUNTER_INSTRUCTION(++counter.c1;) std::size_t pid = get_point_id(pt); points_on_segments[i].push_back(pid); points_on_segments[j].push_back(pid); } else { - COUNTER_INSTRUCTION(++counter.c2;) - COUNTER_INSTRUCTION(counter.timer4.start();) + CGAL_AUTOREF_COUNTER_INSTRUCTION(++counter.c2;) + CGAL_AUTOREF_COUNTER_INSTRUCTION(counter.timer4.start();) typename EK::Point_3 pt = typename EK::Construct_coplanar_segments_intersection_point_3()( points[segments[i].first], points[segments[i].second], points[segments[j].first], points[segments[j].second]); @@ -918,69 +626,63 @@ void generate_subtriangles(std::size_t ti, std::size_t pid = get_point_id(pt); points_on_segments[i].push_back(pid); points_on_segments[j].push_back(pid); - COUNTER_INSTRUCTION(counter.timer4.stop();) - //~ std::ofstream debug ("/tmp/triangles.polylines.txt"); - //~ debug << "4 " << triangles[ti][0] << " " << triangles[ti][1] << " " << triangles[ti][2] << " " << triangles[ti][0] << "\n"; - //~ debug << "4 " << triangles[in_triangle_ids[i]][0] << " " << triangles[in_triangle_ids[i]][1] << " " << triangles[in_triangle_ids[i]][2] << " " << triangles[in_triangle_ids[i]][0] << "\n"; - //~ debug << "4 " << triangles[in_triangle_ids[j]][0] << " " << triangles[in_triangle_ids[j]][1] << " " << triangles[in_triangle_ids[j]][2] << " " << triangles[in_triangle_ids[j]][0] << "\n"; - //~ debug.close(); - //~ throw std::runtime_error("Unexpected case 1"); + CGAL_AUTOREF_COUNTER_INSTRUCTION(counter.timer4.stop();) } break; } case COPLANAR_SEGMENT_PQ: { - COUNTER_INSTRUCTION(++counter.c3;) + CGAL_AUTOREF_COUNTER_INSTRUCTION(++counter.c3;) points_on_segments[j].push_back(segments[i].first); points_on_segments[j].push_back(segments[i].second); break; } case COPLANAR_SEGMENT_RS: { - COUNTER_INSTRUCTION(++counter.c3;) + CGAL_AUTOREF_COUNTER_INSTRUCTION(++counter.c3;) points_on_segments[i].push_back(segments[j].first); points_on_segments[i].push_back(segments[j].second); break; } case COPLANAR_SEGMENT_PR: { - COUNTER_INSTRUCTION(++counter.c3;) + CGAL_AUTOREF_COUNTER_INSTRUCTION(++counter.c3;) points_on_segments[i].push_back(segments[j].first); points_on_segments[j].push_back(segments[i].first); break; } case COPLANAR_SEGMENT_QS: { - COUNTER_INSTRUCTION(++counter.c3;) + CGAL_AUTOREF_COUNTER_INSTRUCTION(++counter.c3;) points_on_segments[i].push_back(segments[j].second); points_on_segments[j].push_back(segments[i].second); break; } case COPLANAR_SEGMENT_PS: { - COUNTER_INSTRUCTION(++counter.c3;) + CGAL_AUTOREF_COUNTER_INSTRUCTION(++counter.c3;) points_on_segments[i].push_back(segments[j].second); points_on_segments[j].push_back(segments[i].first); break; } case COPLANAR_SEGMENT_QR: { - COUNTER_INSTRUCTION(++counter.c3;) + CGAL_AUTOREF_COUNTER_INSTRUCTION(++counter.c3;) points_on_segments[i].push_back(segments[j].first); points_on_segments[j].push_back(segments[i].second); break; } case NO_INTERSECTION: { - COUNTER_INSTRUCTION(++counter.c4;) + CGAL_AUTOREF_COUNTER_INSTRUCTION(++counter.c4;) } } } - COUNTER_INSTRUCTION(++counter.total;) + CGAL_AUTOREF_COUNTER_INSTRUCTION(++counter.total;) } } - COUNTER_INSTRUCTION(counter.timer1.stop();) - COUNTER_INSTRUCTION(counter.timer2.start();) + CGAL_AUTOREF_COUNTER_INSTRUCTION(counter.timer1.stop();) + CGAL_AUTOREF_COUNTER_INSTRUCTION(counter.timer2.start();) std::size_t nb_new_segments=0; for (std::size_t i = 0; i 10){ - //~ for (const auto p : cst_points) - //~ std::cout << " -- " << p << "(" << depth(p) << ")\n"; - //~ std::cout << "segments:\n"; - //~ for (auto s : segments) - //~ std::cout << " " << depth(s[0]) << " " << depth(s[1]) << "\n"; - //~ exit(1); - //~ } + CGAL_AUTOREF_COUNTER_INSTRUCTION(counter.timer2.stop();) // now fill segments with new segments segments.reserve(segments.size()+nb_new_segments); @@ -1074,56 +743,25 @@ void generate_subtriangles(std::size_t ti, std::sort(segments.begin(), segments.end()); auto last = std::unique(segments.begin(), segments.end()); segments.erase(last, segments.end()); -#endif - //~ std::ofstream("/tmp/tri.xyz") << std::setprecision(17) << triangles[ti][0] << "\n" - //~ << triangles[ti][1] << "\n" - //~ << triangles[ti][2] << "\n"; - //~ std::ofstream debug("/tmp/cst.polylines.txt"); - //~ debug << std::setprecision(17); - //~ for(auto s : segments) - //~ debug << "2 " << points[s.first] << " " << points[s.second] << "\n"; - //~ debug.close(); - - COUNTER_INSTRUCTION(counter.timer3.start();) + CGAL_AUTOREF_COUNTER_INSTRUCTION(counter.timer3.start();) if (segments.empty()) cdt.insert(points.begin(), points.end()); else cdt.insert_constraints(points.begin(), points.end(), segments.begin(), segments.end()); - COUNTER_INSTRUCTION(counter.timer3.stop();) + CGAL_AUTOREF_COUNTER_INSTRUCTION(counter.timer3.stop();) -#ifdef CGAL_DEBUG_PMP_AUTOREFINE_DUMP_TRIANGULATIONS - static int k = 0; - std::stringstream buffer; - buffer.precision(17); - int nbt=0; -#endif - for (typename CDT::Face_handle fh : cdt.finite_face_handles()) - { - if (orientation_flipped) - new_triangles.push_back( { CGAL::make_array(fh->vertex(0)->point(), - fh->vertex(cdt.cw(0))->point(), - fh->vertex(cdt.ccw(0))->point()), ti } ); - else - new_triangles.push_back( { CGAL::make_array(fh->vertex(0)->point(), - fh->vertex(cdt.ccw(0))->point(), - fh->vertex(cdt.cw(0))->point()), ti } ); -#ifdef CGAL_DEBUG_PMP_AUTOREFINE_DUMP_TRIANGULATIONS - ++nbt; - buffer << fh->vertex(0)->point() << "\n"; - buffer << fh->vertex(cdt.ccw(0))->point() << "\n"; - buffer << fh->vertex(cdt.cw(0))->point() << "\n"; -#endif - } - -#ifdef CGAL_DEBUG_PMP_AUTOREFINE_DUMP_TRIANGULATIONS - std::ofstream dump("triangulation_"+std::to_string(k)+".off"); - dump << "OFF\n" << 3*nbt << " " << nbt << " 0\n"; - dump << buffer.str(); - for (int i=0; ivertex(0)->point(), + fh->vertex(cdt.cw(0))->point(), + fh->vertex(cdt.ccw(0))->point()), ti } ); + else + new_triangles.push_back( { CGAL::make_array(fh->vertex(0)->point(), + fh->vertex(cdt.ccw(0))->point(), + fh->vertex(cdt.cw(0))->point()), ti } ); + } } } // end of autorefine_impl @@ -1267,7 +905,7 @@ void autorefine_triangle_soup(PointRange& soup_points, std::vector< std::vector > all_in_triangle_ids(triangles.size()); CGAL_PMP_AUTOREFINE_VERBOSE("compute intersections"); -#ifdef USE_DEBUG_PARALLEL_TIMERS +#ifdef CGAL_AUTOREF_USE_DEBUG_PARALLEL_TIMERS Real_timer t; t.start(); #endif @@ -1320,14 +958,13 @@ void autorefine_triangle_soup(PointRange& soup_points, coplanar_triangles.insert(CGAL::make_sorted_pair(i1, i2)); } } -#ifdef USE_DEBUG_PARALLEL_TIMERS +#ifdef CGAL_AUTOREF_USE_DEBUG_PARALLEL_TIMERS t.stop(); std::cout << t.time() << " sec. for #2" << std::endl; t.reset(); #endif -#ifdef DEDUPLICATE_SEGMENTS -#ifdef USE_DEBUG_PARALLEL_TIMERS +#ifdef CGAL_AUTOREF_USE_DEBUG_PARALLEL_TIMERS t.start(); #endif @@ -1396,11 +1033,10 @@ void autorefine_triangle_soup(PointRange& soup_points, deduplicate_inserted_segments(ti); } -#ifdef USE_DEBUG_PARALLEL_TIMERS +#ifdef CGAL_AUTOREF_USE_DEBUG_PARALLEL_TIMERS t.stop(); std::cout << t.time() << " sec. for #3" << std::endl; t.reset(); -#endif #endif CGAL_PMP_AUTOREFINE_VERBOSE("triangulate faces"); @@ -1413,7 +1049,7 @@ void autorefine_triangle_soup(PointRange& soup_points, std::vector, std::size_t>> new_triangles; #endif -#ifdef USE_PROGRESS_DISPLAY +#ifdef CGAL_AUTOREF_USE_PROGRESS_DISPLAY boost::timer::progress_display pd(triangles.size()); #endif @@ -1423,37 +1059,15 @@ void autorefine_triangle_soup(PointRange& soup_points, new_triangles.push_back({triangles[ti], ti}); else { -#ifdef USE_FIXED_PROJECTION_TRAITS - const std::array& t = triangles[ti]; - auto is_constant_in_dim = [](const std::array& t, int dim) - { - return t[0][dim] == t[1][dim] && t[0][dim] != t[2][dim]; - }; - - typename EK::Vector_3 orth = CGAL::normal(t[0], t[1], t[2]); // TODO::avoid construction? - 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) { - autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); - } - else if (c == 1) { - autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); - } - else if (c == 2) { - autorefine_impl::generate_subtriangles(ti, all_segments[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, triangles, new_triangles); - } -#else autorefine_impl::generate_subtriangles(ti, all_segments_ids[ti], all_points[ti], all_in_triangle_ids[ti], intersecting_triangles, coplanar_triangles, triangles, new_triangles); -#endif } -#ifdef USE_PROGRESS_DISPLAY +#ifdef CGAL_AUTOREF_USE_PROGRESS_DISPLAY ++pd; #endif }; -#ifdef USE_DEBUG_PARALLEL_TIMERS +#ifdef CGAL_AUTOREF_USE_DEBUG_PARALLEL_TIMERS t.start(); #endif #ifdef CGAL_LINKED_WITH_TBB @@ -1472,7 +1086,7 @@ void autorefine_triangle_soup(PointRange& soup_points, refine_triangles(ti); } -#ifdef USE_DEBUG_PARALLEL_TIMERS +#ifdef CGAL_AUTOREF_USE_DEBUG_PARALLEL_TIMERS t.stop(); std::cout << t.time() << " sec. for #1" << std::endl; t.reset(); @@ -1552,12 +1166,12 @@ void autorefine_triangle_soup(PointRange& soup_points, return insert_res.first->second; }; -#ifdef USE_DEBUG_PARALLEL_TIMERS +#ifdef CGAL_AUTOREF_USE_DEBUG_PARALLEL_TIMERS t.start(); #endif std::size_t offset = soup_triangles_out.size(); -#ifdef USE_DEBUG_PARALLEL_TIMERS +#ifdef CGAL_AUTOREF_USE_DEBUG_PARALLEL_TIMERS std::string mode = "parallel"; #endif @@ -1565,7 +1179,7 @@ void autorefine_triangle_soup(PointRange& soup_points, #ifdef CGAL_LINKED_WITH_TBB if(parallel_execution && new_triangles.size() > 100) { -#ifdef SET_POINT_IDS_USING_MUTEX +#ifdef CGAL_AUTOREF_SET_POINT_IDS_USING_MUTEX //option 1 (using a mutex) CGAL_MUTEX point_container_mutex; /// Lambda concurrent_get_point_id() @@ -1672,7 +1286,7 @@ void autorefine_triangle_soup(PointRange& soup_points, else #endif { -#ifdef USE_DEBUG_PARALLEL_TIMERS +#ifdef CGAL_AUTOREF_USE_DEBUG_PARALLEL_TIMERS mode = "sequential"; #endif soup_triangles_out.reserve(offset + new_triangles.size()); @@ -1687,7 +1301,7 @@ void autorefine_triangle_soup(PointRange& soup_points, -#ifdef USE_DEBUG_PARALLEL_TIMERS +#ifdef CGAL_AUTOREF_USE_DEBUG_PARALLEL_TIMERS t.stop(); std::cout << t.time() << " sec. for #4 (" << mode << ")" << std::endl; t.reset(); From 93a1549c6515be7b077d9267ca6ba1be377fed28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 11 Dec 2023 11:34:42 +0100 Subject: [PATCH 114/139] used typedef --- .../examples/Polygon_mesh_processing/soup_autorefinement.cpp | 2 -- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp index 5baea1a3964..a76e1254f6e 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/soup_autorefinement.cpp @@ -13,8 +13,6 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef Kernel::Point_3 Point; -typedef CGAL::Surface_mesh Mesh; - namespace PMP = CGAL::Polygon_mesh_processing; int main(int argc, char** argv) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index bb81855edd5..46f9ed9cbe7 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1126,7 +1126,7 @@ void autorefine_triangle_soup(PointRange& soup_points, } TriangleRange soup_triangles_out; - soup_triangles_out.reserve(soup_triangles.size()); // TODO: remove #deg tri? + soup_triangles_out.reserve(soup_triangles.size()); visitor.number_of_output_triangles(soup_triangles.size()+new_triangles.size()); From d0c224fafbc08c2156d184f6c9841c8a8545aae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 11 Dec 2023 14:07:08 +0100 Subject: [PATCH 115/139] handle some todos --- .../Polygon_mesh_processing/autorefinement.h | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 46f9ed9cbe7..05d05637b16 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1,5 +1,3 @@ -//TODO: add for soup face the id of the input face. not sure it is easy to report intersection edge as a pair of vertex id -//TODO: only return intersection segments (pay attention to degenerate triangles that are currently ignored) // Copyright (c) 2023 GeometryFactory (France). // All rights reserved. // @@ -735,8 +733,6 @@ void generate_subtriangles(std::size_t ti, CGAL_assertion(points.size()==point_id_map.size()); } - // TODO: sorted pair to be constructed when pushing_back - // TODO: only needed in case of coplanar segments? for (std::pair& s : segments) if (s.second < s.first) std::swap(s.first,s.second); @@ -853,7 +849,9 @@ void autorefine_triangle_soup(PointRange& soup_points, typedef std::size_t Input_TID; typedef std::pair Pair_of_triangle_ids; - std::vector si_pairs; // TODO: check std::vector is fine with Parallel_tag + // no need for a concurrent vector as the called function itself + // takes care of sequentially writing into the output iterator + std::vector si_pairs; // collect intersecting pairs of triangles CGAL_PMP_AUTOREFINE_VERBOSE("collect intersecting pairs"); @@ -909,8 +907,8 @@ void autorefine_triangle_soup(PointRange& soup_points, Real_timer t; t.start(); #endif - std::set > intersecting_triangles; // TODO replace with vector>> - std::set > coplanar_triangles; // TODO replace with vector>> + std::set > intersecting_triangles; + std::set > coplanar_triangles; //TODO: PARALLEL_FOR #2 for (const Pair_of_triangle_ids& p : si_pairs) { @@ -1096,7 +1094,6 @@ void autorefine_triangle_soup(PointRange& soup_points, CGAL_PMP_AUTOREFINE_VERBOSE("create output soup"); Cartesian_converter to_input; - // TODO: reuse the fact that maps per triangle are already sorted #ifdef CGAL_LINKED_WITH_TBB typedef std::conditional_t 100) + if(parallel_execution && new_triangles.size() > 50) { #ifdef CGAL_AUTOREF_SET_POINT_IDS_USING_MUTEX //option 1 (using a mutex) @@ -1336,6 +1335,8 @@ void autorefine_triangle_soup(PointRange& soup_points, * @param tm input triangulated surface mesh * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below * + * @warning `clear(tm)` will be called before filling `tm` with the refined mesh. + * * \cgalNamedParamsBegin * \cgalParamNBegin{concurrency_tag} * \cgalParamDescription{a tag indicating if the task should be done using one or several threads.} @@ -1378,7 +1379,7 @@ autorefine( TriangleMesh& tm, autorefine_triangle_soup(soup_points, soup_triangles, np); - clear(tm); //TODO: keep properties + clear(tm); repair_polygon_soup(soup_points, soup_triangles); duplicate_non_manifold_edges_in_polygon_soup(soup_points, soup_triangles); From 07acb78d302fcad1e4f1264f0a7d7233695f3b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 12 Dec 2023 09:41:44 +0100 Subject: [PATCH 116/139] add tests for autoref --- .../Polygon_mesh_processing/autorefinement.h | 34 ++++-- .../Polygon_mesh_processing/CMakeLists.txt | 1 + .../test_autorefinement.cmd | 56 +++++----- .../test_autorefinement.cpp | 103 +++++++++++++++--- 4 files changed, 144 insertions(+), 50 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index 05d05637b16..b2d8427875c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -46,7 +46,7 @@ #include #if TBB_INTERFACE_VERSION < 12010 && !defined(TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS) #define CGAL_HAS_DEFINED_TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS -#define TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS +#define TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS 1 #endif #include #include @@ -857,7 +857,16 @@ void autorefine_triangle_soup(PointRange& soup_points, CGAL_PMP_AUTOREFINE_VERBOSE("collect intersecting pairs"); triangle_soup_self_intersections(soup_points, soup_triangles, std::back_inserter(si_pairs), np); - if (si_pairs.empty()) return; + if (si_pairs.empty()) + { + if constexpr (!std::is_same_v) + { + visitor.number_of_output_triangles(soup_triangles.size()); + for(std::size_t i=0; i is_degen(soup_triangles.size(), false); @@ -1125,7 +1134,16 @@ void autorefine_triangle_soup(PointRange& soup_points, TriangleRange soup_triangles_out; soup_triangles_out.reserve(soup_triangles.size()); - visitor.number_of_output_triangles(soup_triangles.size()+new_triangles.size()); + if constexpr (!std::is_same_v) + { + std::size_t nbt=0; + for (Input_TID f=0; f tri_inter_ids_inverse(triangles.size()); @@ -1136,7 +1154,7 @@ void autorefine_triangle_soup(PointRange& soup_points, int tiid = tri_inter_ids[f]; if (tiid == -1) { - visitor.verbatim_triangle_copy(soup_triangles.size(), f); + visitor.verbatim_triangle_copy(soup_triangles_out.size(), f); soup_triangles_out.push_back( {soup_triangles[f][0], soup_triangles[f][1], soup_triangles[f][2]} ); @@ -1200,7 +1218,7 @@ void autorefine_triangle_soup(PointRange& soup_points, soup_triangles_out.resize(offset + new_triangles.size()); //use map iterator triple for triangles to create them concurrently and safely - std::vector::iterator, 3>> triangle_buffer(new_triangles.size()); + std::vector> triangle_buffer(new_triangles.size()); tbb::parallel_for(tbb::blocked_range(0, new_triangles.size()), [&](const tbb::blocked_range& r) { for (size_t ti = r.begin(); ti != r.end(); ++ti) { @@ -1238,10 +1256,8 @@ void autorefine_triangle_soup(PointRange& soup_points, std::vector> triangle_buffer(new_triangles.size()); tbb::parallel_for(tbb::blocked_range(0, new_triangles.size()), [&](const tbb::blocked_range& r) { - for (size_t ti = r.begin(); ti != r.end(); ++ti) { - if (offset + ti > soup_triangles_out.size()) { - std::cout << "ti = " << ti << std::endl; - } + for (size_t ti = r.begin(); ti != r.end(); ++ti) + { const std::array& t = new_triangles[ti].first; visitor.new_subtriangle(offset+ti, tri_inter_ids_inverse[new_triangles[ti].second]); triangle_buffer[ti] = CGAL::make_array(concurrent_get_point_id(t[0]), concurrent_get_point_id(t[1]), concurrent_get_point_id(t[2])); diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt index d9ea1a1cf37..248831b5051 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt @@ -105,6 +105,7 @@ if(TARGET CGAL::TBB_support) target_link_libraries(test_pmp_distance PUBLIC CGAL::TBB_support) target_link_libraries(orient_polygon_soup_test PUBLIC CGAL::TBB_support) target_link_libraries(self_intersection_surface_mesh_test PUBLIC CGAL::TBB_support) + target_link_libraries(test_autorefinement PUBLIC CGAL::TBB_support) else() message(STATUS "NOTICE: Intel TBB was not found. Tests will use sequential code.") endif() diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_autorefinement.cmd b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_autorefinement.cmd index a2ffe2c2539..8c848a2f106 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_autorefinement.cmd +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_autorefinement.cmd @@ -1,28 +1,28 @@ -data-autoref/test_01.off 0 0 4 1 4 0 -data-autoref/test_02.off 1 5 13 1 5 0 -data-autoref/test_03.off 4 8 18 0 18 0 -data-autoref/test_04.off 1 5 17 0 17 0 -data-autoref/test_05.off 1 5 17 0 17 0 -data-autoref/test_06.off 3 55 141 1 76 0 -data-autoref/test_07.off 1 4 10 1 4 0 -data-autoref/test_08.off 1 31 87 1 52 0 -data-autoref/test_09.off 1 4 5 1 4 0 -data-autoref/test_10.off 1 3 13 0 13 0 -data-autoref/test_11.off 1 3 12 0 12 0 -data-autoref/test_12.off 2 2 11 1 11 0 -data-autoref/test_13.off 1 5 16 1 8 0 -data-autoref/test_14.off 1 5 16 1 12 0 -data-autoref/test_15.off 3 8 16 1 12 0 -data-autoref/test_16.off 1 2 6 1 4 0 -data-autoref/test_17.off 1 2 6 1 4 0 -data-autoref/triple_inter_exception/triple.off 0 0 0 0 0 1 -data-autoref/triple_inter_exception/cubes_cpln_1.off 0 0 0 0 0 1 -data-autoref/triple_inter_exception/cubes_cpln_2.off 0 0 0 0 0 1 -data-autoref/triple_inter_exception/cubes_cpln_3.off 0 0 0 0 0 1 -data-autoref/open_01.off 1 65 1377 1 1313 0 -data-autoref/open_02.off 1 33 595 1 562 0 -data-autoref/cpln_01.off 18 42 48 1 30 0 -data-autoref/cpln_02.off 28 56 40 1 24 0 -data-autoref/cpln_03.off 15 35 42 1 27 0 -data-autoref/four_cubes.off 12 94 184 1 78 0 -data-autoref/spiral.off 7 14 26 0 26 0 +data-autoref/test_01.off 0 0 4 1 4 0 4 2 +data-autoref/test_02.off 1 5 13 1 5 0 10 17 +data-autoref/test_03.off 4 8 18 0 18 0 14 20 +data-autoref/test_04.off 1 5 17 0 17 0 13 20 +data-autoref/test_05.off 1 5 17 0 17 0 13 20 +data-autoref/test_06.off 3 55 141 1 76 0 92 248 +data-autoref/test_07.off 1 4 10 1 4 0 8 12 +data-autoref/test_08.off 1 31 87 1 52 0 57 148 +data-autoref/test_09.off 1 4 5 1 4 0 4 4 +data-autoref/test_10.off 1 3 13 0 13 0 10 13 +data-autoref/test_11.off 1 3 12 0 12 0 9 12 +data-autoref/test_12.off 2 2 11 1 11 0 9 6 +data-autoref/test_13.off 1 5 16 1 8 0 16 22 +data-autoref/test_14.off 1 5 16 1 12 0 16 22 +data-autoref/test_15.off 3 8 16 1 12 0 16 24 +data-autoref/test_16.off 1 2 6 1 4 0 6 2 +data-autoref/test_17.off 1 2 6 1 4 0 6 2 +data-autoref/triple_inter_exception/triple.off 0 0 0 0 0 1 15 18 +data-autoref/triple_inter_exception/cubes_cpln_1.off 0 0 0 0 0 1 66 224 +data-autoref/triple_inter_exception/cubes_cpln_2.off 0 0 0 0 0 1 54 196 +data-autoref/triple_inter_exception/cubes_cpln_3.off 0 0 0 0 0 1 61 204 +data-autoref/open_01.off 1 65 1377 1 1313 0 1317 2622 +data-autoref/open_02.off 1 33 595 1 562 0 565 1056 +data-autoref/cpln_01.off 18 42 48 1 30 0 30 88 +data-autoref/cpln_02.off 28 56 40 1 24 0 24 72 +data-autoref/cpln_03.off 15 35 42 1 27 0 27 76 +data-autoref/four_cubes.off 12 94 184 1 78 0 106 352 +data-autoref/spiral.off 7 14 26 0 26 0 19 31 diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_autorefinement.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_autorefinement.cpp index 9c908d7ec24..3af3402a5f2 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_autorefinement.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_autorefinement.cpp @@ -3,6 +3,10 @@ #include #include +#include +#include + +#include #include #include @@ -13,23 +17,64 @@ typedef CGAL::Surface_mesh Mesh; namespace PMP = CGAL::Polygon_mesh_processing; template -struct My_visitor : +struct My_exp_visitor : public CGAL::Polygon_mesh_processing::Corefinement::Default_visitor { void after_subface_creations(TriangleMesh&){++(*i);} - My_visitor() + My_exp_visitor() : i (new int(0) ) {} std::shared_ptr i; }; -void test(const char* fname, std::size_t nb_polylines, std::size_t total_nb_points, - std::size_t nb_vertices_after_autorefine, bool all_fixed, std::size_t nb_vertices_after_fix, - bool triple_intersection) +struct My_visitor { - std::cout << "Running tests on " << fname << "\n"; + My_visitor(std::size_t nb_input, std::size_t expected_nb_output) + : nb_input(nb_input) + , expected_nb_output(expected_nb_output) + {} + + ~My_visitor() + { + for(std::size_t i=0; i tgt_check; +}; + +void test_coref_based(const char* fname, std::size_t nb_polylines, std::size_t total_nb_points, + std::size_t nb_vertices_after_autorefine, bool all_fixed, std::size_t nb_vertices_after_fix, + bool triple_intersection) +{ + std::cout << "Running tests (coref based) on " << fname << "\n"; std::ifstream input(fname); Mesh mesh; @@ -41,7 +86,7 @@ void test(const char* fname, std::size_t nb_polylines, std::size_t total_nb_poin input.close(); std::size_t nb_vertices_before_autorefine = num_vertices(mesh); -// Testing surface_self_intersection() +// Testing PMP::experimental::surface_self_intersection() try{ std::vector< std::vector >polylines; PMP::experimental::surface_self_intersection(mesh, std::back_inserter(polylines)); @@ -57,9 +102,9 @@ void test(const char* fname, std::size_t nb_polylines, std::size_t total_nb_poin assert( triple_intersection ); } -// Testing autorefine() +// Testing PMP::experimental::autorefine() try{ - My_visitor visitor; + My_exp_visitor visitor; PMP::experimental::autorefine(mesh, CGAL::parameters::visitor(visitor)); mesh.collect_garbage(); @@ -72,7 +117,7 @@ void test(const char* fname, std::size_t nb_polylines, std::size_t total_nb_poin assert( triple_intersection ); } -// Testing autorefine_and_remove_self_intersections() +// Testing PMP::experimental::autorefine_and_remove_self_intersections() try{ input.open(fname); mesh.clear(); @@ -89,10 +134,42 @@ void test(const char* fname, std::size_t nb_polylines, std::size_t total_nb_poin } } +template +void test(const char* fname, std::size_t nb_vertices_after_autorefine, std::size_t expected_nb_output, Tag tag) +{ + std::cout << "Running tests on " << fname; + if (std::is_same_v) + std::cout << " (Sequential)\n"; + else + std::cout << " (Parallel)\n"; + + std::vector points; + std::vector< std::vector > triangles; + if (!CGAL::IO::read_polygon_soup(fname, points, triangles)) + { + std::cerr << " Input mesh is not a valid file." << std::endl; + exit(EXIT_FAILURE); + } + +// Testing autorefine() + My_visitor visitor(triangles.size(), expected_nb_output); + PMP::autorefine_triangle_soup(points, triangles, CGAL::parameters::visitor(visitor).concurrency_tag(tag)); + assert( nb_vertices_after_autorefine==points.size()); + assert( expected_nb_output==triangles.size()); + assert( !PMP::does_triangle_soup_self_intersect(points, triangles) ); +// CGAL::IO::write_polygon_soup("/tmp/debug.off", points, triangles); +} + int main(int argc, const char** argv) { // file nb_polylines total_nb_points nb_vertices_after_autorefine all_fixed nb_vertices_after_fix triple_intersection - for (int i=0;i<(argc-1)/7; ++i) - test(argv[1+7*i], atoi(argv[1+7*i+1]), atoi(argv[1+7*i+2]), - atoi(argv[1+7*i+3]), atoi(argv[1+7*i+4])==0?false:true, atoi(argv[1+7*i+5]), atoi(argv[1+7*i+6])==0?false:true); + for (int i=0;i<(argc-1)/9; ++i) + { + test_coref_based(argv[1+9*i], atoi(argv[1+9*i+1]), atoi(argv[1+9*i+2]), + atoi(argv[1+9*i+3]), atoi(argv[1+9*i+4])==0?false:true, atoi(argv[1+9*i+5]), atoi(argv[1+9*i+6])==0?false:true); + test(argv[1+9*i], atoi(argv[1+9*i+7]), atoi(argv[1+9*i+8]), CGAL::Sequential_tag()); +#ifdef CGAL_LINKED_WITH_TBB + test(argv[1+9*i], atoi(argv[1+9*i+7]), atoi(argv[1+9*i+8]), CGAL::Parallel_tag()); +#endif + } } From 10f4caa29638b86a15df361a4da9eba9db599391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 12 Dec 2023 11:53:22 +0100 Subject: [PATCH 117/139] add missing ref --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index b2d8427875c..c9751752d75 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -1200,7 +1200,7 @@ void autorefine_triangle_soup(PointRange& soup_points, //option 1 (using a mutex) CGAL_MUTEX point_container_mutex; /// Lambda concurrent_get_point_id() - auto concurrent_get_point_id = [&](const typename EK::Point_3 pt) + auto concurrent_get_point_id = [&](const typename EK::Point_3& pt) { auto insert_res = point_id_map.insert(std::make_pair(pt, -1)); @@ -1243,7 +1243,7 @@ void autorefine_triangle_soup(PointRange& soup_points, //option 2 (without mutex) /// Lambda concurrent_get_point_id() tbb::concurrent_vector iterators; - auto concurrent_get_point_id = [&](const typename EK::Point_3 pt) + auto concurrent_get_point_id = [&](const typename EK::Point_3& pt) { auto insert_res = point_id_map.insert(std::make_pair(pt, -1)); if (insert_res.second) From b267b31bea9737dffaaa4b34f0a284ca991d9174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 12 Dec 2023 13:12:21 +0100 Subject: [PATCH 118/139] workaround MSVC 2022 bug --- .../include/CGAL/Polygon_mesh_processing/autorefinement.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index c9751752d75..ec3f02633c8 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -996,9 +996,10 @@ void autorefine_triangle_soup(PointRange& soup_points, if (!all_points[ti].empty()) { - std::vector tmp; + using EPoint_3 = EK::Point_3; // workaround for MSVC 2022 bug + std::vector tmp; tmp.swap(all_points[ti]); - for (const typename EK::Point_3& pt : tmp) + for (const EPoint_3& pt : tmp) get_point_id(pt); } From 814a92655dfe38b96032772f3eae5aa351becde2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 12 Dec 2023 13:12:45 +0100 Subject: [PATCH 119/139] remove non needed typenames + missing ref --- .../Polygon_mesh_processing/autorefinement.h | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index ec3f02633c8..8a61b92f717 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -447,8 +447,7 @@ bool collect_intersections(const std::array& t1, } template + class PointVector> void generate_subtriangles(std::size_t ti, std::vector>& segments, std::vector& points, @@ -896,7 +895,7 @@ void autorefine_triangle_soup(PointRange& soup_points, // init the vector of triangles used for the autorefinement of triangles typedef CGAL::Exact_predicates_exact_constructions_kernel EK; - std::vector< std::array > triangles(tiid+1); + std::vector< std::array > triangles(tiid+1); Cartesian_converter to_exact; for(Input_TID f : intersected_faces) @@ -926,14 +925,14 @@ void autorefine_triangle_soup(PointRange& soup_points, if (i1==-1 || i2==-1) continue; //skip degenerate faces - const std::array& t1 = triangles[i1]; - const std::array& t2 = triangles[i2]; + const std::array& t1 = triangles[i1]; + const std::array& t2 = triangles[i2]; - std::vector inter_pts; + std::vector inter_pts; bool triangles_are_coplanar = autorefine_impl::collect_intersections(t1, t2, inter_pts); CGAL_assertion( - CGAL::do_intersect(typename EK::Triangle_3(t1[0], t1[1], t1[2]), typename EK::Triangle_3(t2[0], t2[1], t2[2])) + CGAL::do_intersect(EK::Triangle_3(t1[0], t1[1], t1[2]), EK::Triangle_3(t2[0], t2[1], t2[2])) != inter_pts.empty()); if (!inter_pts.empty()) @@ -985,7 +984,7 @@ void autorefine_triangle_soup(PointRange& soup_points, std::map point_id_map; - auto get_point_id = [&](const typename EK::Point_3& pt) + auto get_point_id = [&](const EK::Point_3& pt) { auto insert_res = point_id_map.insert(std::make_pair(pt, all_points[ti].size())); if (insert_res.second) @@ -1010,8 +1009,8 @@ void autorefine_triangle_soup(PointRange& soup_points, std::set> segset; for (std::size_t si=0; si iterators; - auto concurrent_get_point_id = [&](const typename EK::Point_3& pt) + auto concurrent_get_point_id = [&](const EK::Point_3& pt) { auto insert_res = point_id_map.insert(std::make_pair(pt, -1)); if (insert_res.second) From 35e845d8dcf7d88c25c33ac73d9f96052578ec43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 12 Dec 2023 15:11:40 +0100 Subject: [PATCH 120/139] do no use delete event --- .../CGAL/Surface_sweep_2/Surface_sweep_2_impl.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h index cd36570d27b..88ff82a63f5 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h @@ -573,10 +573,12 @@ void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, Event* left_event = first_parent->left_event(); Event* right_event = first_parent->right_event(); - if (! second_parent->is_start_point(left_event)) - left_event->add_curve_to_left(second_parent); - else - left_event->remove_curve_from_right(second_parent); + if (left_event != nullptr) { + if (! second_parent->is_start_point(left_event)) + left_event->add_curve_to_left(second_parent); + else + left_event->remove_curve_from_right(second_parent); + } CGAL_SS_PRINT_CURVE(c1); CGAL_SS_PRINT_TEXT(" + "); @@ -596,7 +598,8 @@ void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, // add the overlapping curve kept of the right of the left end right_event->add_curve_to_left(first_parent); - _add_curve_to_right(left_event, first_parent); + if (left_event != nullptr) + _add_curve_to_right(left_event, first_parent); this->m_visitor->found_overlap(c1, c2, first_parent); From 8cc75d642cff010f8166d7d23c82afe7b2efe41a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 12 Dec 2023 15:27:00 +0100 Subject: [PATCH 121/139] fix warnings --- Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp index cc11bbabac3..d44a2bbdd34 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp +++ b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp @@ -149,7 +149,6 @@ std::istream& skip_comment(std::istream& in) { bool read_points(std::ifstream& inp, Points& points, const Traits&) { int count; inp >> skip_comment >> count; - char ch; // std::cout << "read_points " << count << "\n"; for (int i = 0; i < count; i++) { @@ -330,7 +329,7 @@ bool read_curves(std::ifstream& inp, Curves& curves, const Traits&) { #if CGAL_ARR_TEST_TRAITS != CGAL_CONIC_TRAITS // Test subcurves w/o overlapping -bool test_curves_no_overlap(std::ifstream& inp, Curves& curves, +bool test_curves_no_overlap(std::ifstream& inp, Curves& /* curves */, const X_monotone_curves& curves_no_overlap_out, const Traits& tr) { X_monotone_curves curves_no_overlap; @@ -346,7 +345,7 @@ bool test_curves_no_overlap(std::ifstream& inp, Curves& curves, } // Test subcurves w/ overlapping -bool test_curves_with_overlap(std::ifstream& inp, Curves& curves, +bool test_curves_with_overlap(std::ifstream& inp, Curves& /* curves */, const X_monotone_curves& curves_with_overlap_out, const Traits& tr) { X_monotone_curves curves_with_overlap; @@ -363,7 +362,7 @@ bool test_curves_with_overlap(std::ifstream& inp, Curves& curves, } // Test intersection points (with endpoints) -bool test_points_with_ends(std::ifstream& inp, Curves& curves, +bool test_points_with_ends(std::ifstream& inp, Curves& /* curves */, const Points& points_with_ends_out, const Traits& tr) { Points points_with_ends; @@ -379,7 +378,7 @@ bool test_points_with_ends(std::ifstream& inp, Curves& curves, } // Test intersection points w/o end points -bool test_points_no_ends(std::ifstream& inp, Curves& curves, +bool test_points_no_ends(std::ifstream& inp, Curves& /* curves */, const Points& points_no_ends_out, const Traits& tr) { Points points_no_ends; @@ -403,7 +402,6 @@ bool test_conic(std::ifstream& inp, Curves& curves, const Points& points_with_ends_out, const Points& points_no_ends_out, const Traits&) { - char dummy[256]; CGAL::Bbox_2 bbox = curves.front().bbox(); for (auto it = std::next(curves.begin()); it != curves.end(); ++it) From dac26de5c34734ed6e0bddaa555d0f0910e9395e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 12 Dec 2023 17:09:57 +0100 Subject: [PATCH 122/139] update test cc @efifogel --- Surface_sweep_2/test/Surface_sweep_2/data/polylines/test00.txt | 3 +-- Surface_sweep_2/test/Surface_sweep_2/data/polylines/test01.txt | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test00.txt b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test00.txt index a024e6ccf8f..d2ae0552ae7 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test00.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test00.txt @@ -30,8 +30,7 @@ 7 0 8 0 # No. of intersection points followed by points -4 -2 0 +3 4 0 6 0 7 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test01.txt b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test01.txt index 60cda75d7fd..93d9d322792 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test01.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test01.txt @@ -18,8 +18,7 @@ 50 0 60 0 # No. of intersection points followed by points -2 -25 10 +1 50 0 # No. of output polylines with overlaps followed by polylines 6 From 54677b388c8fa8ad5cbae15c0948ac82c302ef81 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 14 Dec 2023 15:35:06 +0100 Subject: [PATCH 123/139] set default minimal_size_ to -1 and add helper function to check if it is set --- .../CGAL/Mesh_3/Protect_edges_sizing_field.h | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index 4cd4d1c3af4..a04664e8de6 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -139,7 +139,7 @@ public: Protect_edges_sizing_field(C3T3& c3t3, const MeshDomain& domain, SizingFunction size=SizingFunction(), - const FT minimal_size = FT(), + const FT minimal_size = FT(-1), std::size_t maximal_number_of_vertices = 0, Mesh_error_code* error_code = 0 #ifndef CGAL_NO_ATOMIC @@ -455,12 +455,17 @@ private: return s; } + bool use_minimal_size() const + { + return minimal_size_ != FT(-1); + } + private: C3T3& c3t3_; const MeshDomain& domain_; SizingFunction size_; - FT minimal_size_; - Weight minimal_weight_; + const FT minimal_size_; + const Weight minimal_weight_; std::set treated_edges_; Vertex_set unchecked_vertices_; int refine_balls_iteration_nb; @@ -540,7 +545,7 @@ operator()(const bool refine) std::cerr << "refine_balls() done. Nb of points in triangulation: " << c3t3_.triangulation().number_of_vertices() << std::endl; #endif - CGAL_assertion(minimal_size_ > 0 || c3t3_.is_valid()); + CGAL_assertion(use_minimal_size() || c3t3_.is_valid()); } // debug_dump_c3t3("dump-mesh-after-protect_edges.binary.cgal", c3t3_); @@ -760,10 +765,10 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, while ( ! is_special(nearest_vh) && cwsr(c3t3_.triangulation().point(nearest_vh), - sq_d) == CGAL::SMALLER ) { - CGAL_assertion( minimal_size_ > 0 || sq_d > 0 ); + CGAL_assertion( use_minimal_size() || sq_d > 0); bool special_ball = false; - if(minimal_weight_ != Weight() && sq_d < minimal_weight_) + if(use_minimal_size() && sq_d < minimal_weight_) { sq_d = minimal_weight_; w = minimal_weight_; @@ -817,7 +822,7 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, const FT sq_d = tr.min_squared_distance(p, cp(c3t3_.triangulation().point(v))); - if(minimal_weight_ != Weight() && sq_d < minimal_weight_) { + if(use_minimal_size() && sq_d < minimal_weight_) { insert_a_special_ball = true; #if CGAL_MESH_3_PROTECTION_DEBUG & 1 nearest_point = c3t3_.triangulation().point(v); @@ -876,7 +881,7 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, if ( cwsr(it_wp, - sq_d) == CGAL::SMALLER ) { bool special_ball = false; - if(minimal_weight_ != Weight() && sq_d < minimal_weight_) + if(use_minimal_size() && sq_d < minimal_weight_) { sq_d = minimal_weight_; w = minimal_weight_; @@ -1436,7 +1441,7 @@ refine_balls() const Vertex_handle v = it->first; const FT new_size = it->second; // Set size of the ball to new value - if(minimal_size_ != FT() && new_size < minimal_size_) { + if(use_minimal_size() && new_size < minimal_size_) { if(!is_special(v)) { change_ball_size(v, minimal_weight_, true); // special ball @@ -1456,7 +1461,7 @@ refine_balls() dump_c3t3_edges(c3t3_, "dump-before-check_and_repopulate_edges"); #endif // Check edges - if(!forced_stop() && minimal_size_ == FT()) { + if(!forced_stop() && !use_minimal_size()) { check_and_repopulate_edges(); } } From 85b8da120dce6246320bc7565983a60cd74083e5 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 14 Dec 2023 15:36:57 +0100 Subject: [PATCH 124/139] constify more --- Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index a04664e8de6..61e13ee4bda 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -140,7 +140,7 @@ public: const MeshDomain& domain, SizingFunction size=SizingFunction(), const FT minimal_size = FT(-1), - std::size_t maximal_number_of_vertices = 0, + const std::size_t maximal_number_of_vertices = 0, Mesh_error_code* error_code = 0 #ifndef CGAL_NO_ATOMIC , std::atomic* stop_ptr = 0 @@ -470,7 +470,7 @@ private: Vertex_set unchecked_vertices_; int refine_balls_iteration_nb; bool nonlinear_growth_of_balls; - std::size_t maximal_number_of_vertices_; + const std::size_t maximal_number_of_vertices_; Mesh_error_code* const error_code_; #ifndef CGAL_NO_ATOMIC /// Pointer to the atomic Boolean that can stop the process @@ -483,7 +483,7 @@ template Protect_edges_sizing_field:: Protect_edges_sizing_field(C3T3& c3t3, const MD& domain, Sf size, const FT minimal_size, - std::size_t maximal_number_of_vertices, + const std::size_t maximal_number_of_vertices, Mesh_error_code* error_code #ifndef CGAL_NO_ATOMIC , std::atomic* stop_ptr From 7fa2db8dfc9552d18744f45ebe148a704592ff13 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 14 Dec 2023 19:01:57 +0100 Subject: [PATCH 125/139] add helper function minimal_weight() --- .../CGAL/Mesh_3/Protect_edges_sizing_field.h | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index 61e13ee4bda..885c6f53160 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -459,6 +459,13 @@ private: { return minimal_size_ != FT(-1); } + Weight minimal_weight() const + { + if (use_minimal_size()) + return minimal_weight_; + else + return Weight(0); + } private: C3T3& c3t3_; @@ -822,16 +829,16 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, const FT sq_d = tr.min_squared_distance(p, cp(c3t3_.triangulation().point(v))); - if(use_minimal_size() && sq_d < minimal_weight_) { + if(use_minimal_size() && sq_d < minimal_weight()) { insert_a_special_ball = true; #if CGAL_MESH_3_PROTECTION_DEBUG & 1 nearest_point = c3t3_.triangulation().point(v); #endif - min_sq_d = minimal_weight_; + min_sq_d = minimal_weight(); if(! is_special(v)) { *out++ = v; - ch = change_ball_size(v, minimal_weight_, true)->cell(); // special ball + ch = change_ball_size(v, minimal_weight(), true)->cell(); // special ball } } else @@ -881,10 +888,10 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, if ( cwsr(it_wp, - sq_d) == CGAL::SMALLER ) { bool special_ball = false; - if(use_minimal_size() && sq_d < minimal_weight_) + if(use_minimal_size() && sq_d < minimal_weight()) { - sq_d = minimal_weight_; - w = minimal_weight_; + sq_d = minimal_weight(); + w = minimal_weight(); special_ball = true; insert_a_special_ball = true; } @@ -938,13 +945,13 @@ smart_insert_point(const Bare_point& p, Weight w, int dim, const Index& index, add_handle_to_unchecked = true; } - if( w < minimal_weight_) { + if( w < minimal_weight()) { #if CGAL_MESH_3_PROTECTION_DEBUG & 1 std::cerr << "smart_insert_point: weight " << w - << " was smaller than minimal weight (" << minimal_weight_ << ")\n"; + << " was smaller than minimal weight (" << minimal_weight() << ")\n"; #endif - w = minimal_weight_; + w = minimal_weight(); insert_a_special_ball = true; } Vertex_handle v = insert_point(p,w,dim,index, insert_a_special_ball); @@ -1179,7 +1186,7 @@ insert_balls(const Vertex_handle& vp, const FT d_signF = static_cast(d_sign); int n = static_cast(std::floor(FT(2)*(d-sq) / (sp+sq))+.5); - // if( minimal_weight_ != 0 && n == 0 ) return; + // if( minimal_weight() != 0 && n == 0 ) return; if(nonlinear_growth_of_balls && refine_balls_iteration_nb < 3) { @@ -1188,7 +1195,7 @@ insert_balls(const Vertex_handle& vp, // balls at corner. When the curve segment is long enough, pick a point // at the middle and choose a new size. if(n >= internal::max_nb_vertices_to_reevaluate_size && - d >= (internal::max_nb_vertices_to_reevaluate_size * minimal_weight_)) { + d >= (internal::max_nb_vertices_to_reevaluate_size * minimal_weight())) { #if CGAL_MESH_3_PROTECTION_DEBUG & 1 const Weighted_point& vq_wp = c3t3_.triangulation().point(vq); std::cerr << "Number of to-be-inserted balls is: " @@ -1443,7 +1450,7 @@ refine_balls() // Set size of the ball to new value if(use_minimal_size() && new_size < minimal_size_) { if(!is_special(v)) { - change_ball_size(v, minimal_weight_, true); // special ball + change_ball_size(v, minimal_weight(), true); // special ball // Loop will have to be run again restart = true; From 3ef2ce91639f99b8ac277311af568fc542e03b00 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 15 Dec 2023 14:44:33 +0100 Subject: [PATCH 126/139] check_and_repopulate_edges() reactivated with minimal size disabling it may give too bad results change the arc_length computation when minimal size is used, instead, by approximating it by the segment length --- Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index 885c6f53160..c74e2ca63e0 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -1468,7 +1468,7 @@ refine_balls() dump_c3t3_edges(c3t3_, "dump-before-check_and_repopulate_edges"); #endif // Check edges - if(!forced_stop() && !use_minimal_size()) { + if(!forced_stop()) { check_and_repopulate_edges(); } } @@ -1771,7 +1771,9 @@ is_sampling_dense_enough(const Vertex_handle& v1, const Vertex_handle& v2, const Weighted_point& v1_wp = c3t3_.triangulation().point(v1); const Weighted_point& v2_wp = c3t3_.triangulation().point(v2); - FT arc_length = domain_.curve_segment_length(cp(v1_wp), + FT arc_length = use_minimal_size() + ? compute_distance(v1, v2) //curve polyline may not be consistent + : domain_.curve_segment_length(cp(v1_wp), cp(v2_wp), curve_index, orientation); From a66e78a6729a83d74c6d39d9da40ab917f26c211 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 15 Dec 2023 15:52:02 +0100 Subject: [PATCH 127/139] when curves topology is valid, use curve_segment_length --- .../CGAL/Mesh_3/Protect_edges_sizing_field.h | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index c74e2ca63e0..a2e13b81123 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -1763,20 +1763,33 @@ is_sampling_dense_enough(const Vertex_handle& v1, const Vertex_handle& v2, FT size_v1 = get_radius(v1); FT size_v2 = get_radius(v2); - CGAL_assertion(get_dimension(v1) != 1 || - curve_index == domain_.curve_index(v1->index())); - CGAL_assertion(get_dimension(v2) != 1 || - curve_index == domain_.curve_index(v2->index())); + bool v1_valid_curve_index = true; + bool v2_valid_curve_index = true; + + if(use_minimal_size()) + { + v1_valid_curve_index = (get_dimension(v1) != 1 + || curve_index == domain_.curve_index(v1->index())); + v2_valid_curve_index = (get_dimension(v2) != 1 + || curve_index == domain_.curve_index(v2->index())); + } + else + { + CGAL_assertion(get_dimension(v1) != 1 || + curve_index == domain_.curve_index(v1->index())); + CGAL_assertion(get_dimension(v2) != 1 || + curve_index == domain_.curve_index(v2->index())); + } const Weighted_point& v1_wp = c3t3_.triangulation().point(v1); const Weighted_point& v2_wp = c3t3_.triangulation().point(v2); - FT arc_length = use_minimal_size() - ? compute_distance(v1, v2) //curve polyline may not be consistent - : domain_.curve_segment_length(cp(v1_wp), + FT arc_length = (v1_valid_curve_index && v2_valid_curve_index) + ? domain_.curve_segment_length(cp(v1_wp), cp(v2_wp), curve_index, - orientation); + orientation) + : compute_distance(v1, v2); //curve polyline may not be consistent // Sufficient condition so that the curve portion between v1 and v2 is // inside the union of the two balls. From 03ea4c3df538b49194b28f12dd81ebbb5be78cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 18 Dec 2023 15:14:09 +0100 Subject: [PATCH 128/139] Revert "fix warnings" This reverts commit 8cc75d642cff010f8166d7d23c82afe7b2efe41a. --- Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp index d44a2bbdd34..cc11bbabac3 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp +++ b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp @@ -149,6 +149,7 @@ std::istream& skip_comment(std::istream& in) { bool read_points(std::ifstream& inp, Points& points, const Traits&) { int count; inp >> skip_comment >> count; + char ch; // std::cout << "read_points " << count << "\n"; for (int i = 0; i < count; i++) { @@ -329,7 +330,7 @@ bool read_curves(std::ifstream& inp, Curves& curves, const Traits&) { #if CGAL_ARR_TEST_TRAITS != CGAL_CONIC_TRAITS // Test subcurves w/o overlapping -bool test_curves_no_overlap(std::ifstream& inp, Curves& /* curves */, +bool test_curves_no_overlap(std::ifstream& inp, Curves& curves, const X_monotone_curves& curves_no_overlap_out, const Traits& tr) { X_monotone_curves curves_no_overlap; @@ -345,7 +346,7 @@ bool test_curves_no_overlap(std::ifstream& inp, Curves& /* curves */, } // Test subcurves w/ overlapping -bool test_curves_with_overlap(std::ifstream& inp, Curves& /* curves */, +bool test_curves_with_overlap(std::ifstream& inp, Curves& curves, const X_monotone_curves& curves_with_overlap_out, const Traits& tr) { X_monotone_curves curves_with_overlap; @@ -362,7 +363,7 @@ bool test_curves_with_overlap(std::ifstream& inp, Curves& /* curves */, } // Test intersection points (with endpoints) -bool test_points_with_ends(std::ifstream& inp, Curves& /* curves */, +bool test_points_with_ends(std::ifstream& inp, Curves& curves, const Points& points_with_ends_out, const Traits& tr) { Points points_with_ends; @@ -378,7 +379,7 @@ bool test_points_with_ends(std::ifstream& inp, Curves& /* curves */, } // Test intersection points w/o end points -bool test_points_no_ends(std::ifstream& inp, Curves& /* curves */, +bool test_points_no_ends(std::ifstream& inp, Curves& curves, const Points& points_no_ends_out, const Traits& tr) { Points points_no_ends; @@ -402,6 +403,7 @@ bool test_conic(std::ifstream& inp, Curves& curves, const Points& points_with_ends_out, const Points& points_no_ends_out, const Traits&) { + char dummy[256]; CGAL::Bbox_2 bbox = curves.front().bbox(); for (auto it = std::next(curves.begin()); it != curves.end(); ++it) From aee0c1557e156a69168aa2883d3992c991987bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 18 Dec 2023 15:14:26 +0100 Subject: [PATCH 129/139] Revert "Ported test_sweep_conic to test_sweep and fixed the conic test cases" This reverts commit 2e99b211b0e22579f76093eec62cfbb1697e17d9. --- .../test/Surface_sweep_2/CMakeLists.txt | 2 +- .../Surface_sweep_2/data/conics/con01.txt | 1 + .../Surface_sweep_2/data/conics/con02.txt | 2 + .../Surface_sweep_2/data/conics/con03.txt | 5 + .../Surface_sweep_2/data/conics/con04.txt | 4 +- .../Surface_sweep_2/data/conics/con05.txt | 4 + .../Surface_sweep_2/data/conics/con06.txt | 1 + .../Surface_sweep_2/data/conics/con07.txt | 1 + .../Surface_sweep_2/data/conics/con08.txt | 2 + .../Surface_sweep_2/data/conics/con09.txt | 3 +- .../Surface_sweep_2/data/conics/con10.txt | 3 +- .../polylines/{test01.txt => big_overlap.txt} | 0 .../Surface_sweep_2/data/polylines/test02.txt | 51 -- .../test/Surface_sweep_2/test_sweep.cpp | 434 +++++------------- .../test/Surface_sweep_2/test_sweep_conic.cpp | 279 +++++++++++ 15 files changed, 416 insertions(+), 376 deletions(-) rename Surface_sweep_2/test/Surface_sweep_2/data/polylines/{test01.txt => big_overlap.txt} (100%) delete mode 100644 Surface_sweep_2/test/Surface_sweep_2/data/polylines/test02.txt create mode 100644 Surface_sweep_2/test/Surface_sweep_2/test_sweep_conic.cpp diff --git a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt index 9e96fa6dc1c..ac96a58ca42 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt @@ -49,7 +49,7 @@ endfunction() compile_and_run_sweep(test_sweep test_sweep.cpp ${NAIVE} ${CGAL_SEGMENT_TRAITS} "data/segments_tight") -compile_and_run_sweep(test_sweep_conic test_sweep.cpp ${NAIVE} +compile_and_run_sweep(test_sweep_conic test_sweep_conic.cpp ${NAIVE} ${CGAL_CONIC_TRAITS} "data/conics") compile_and_run_sweep(test_sweep_polyline test_sweep.cpp ${NAIVE} ${CGAL_POLYLINE_TRAITS} "data/polylines") diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con01.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con01.txt index 1ff457efdb1..a3464614b95 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con01.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con01.txt @@ -8,3 +8,4 @@ e 3 3 7 5 4 5 10 5 {1*x^2 + 1*y^2 + 0*xy + -14*x + -10*y + 65} : (4.66667,6.88562) --cw--> (10,5) 5 1 + diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con02.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con02.txt index c404b51caa1..f3ca4fd2817 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con02.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con02.txt @@ -10,3 +10,5 @@ e 3 3 4 9 7 9 1 9 {1*x^2 + 1*y^2 + 0*xy + -8*x + -18*y + 88} : (7,9) --cw--> (5.45237,6.375) 6 2 + + diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con03.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con03.txt index 599a66f9b14..6ed5fcbab23 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con03.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con03.txt @@ -12,3 +12,8 @@ f 3 3 4 9 {1*x^2 + 1*y^2 + 0*xy + -8*x + -18*y + 88} : (1,9) --cw--> (7,9) 6 2 + + + + + diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con04.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con04.txt index eb6a5c18711..d9a9875cdeb 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con04.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con04.txt @@ -12,4 +12,6 @@ f 1 1 3 2 {1*x^2 + 1*y^2 + 0*xy + -6*x + -4*y + 12} : (4,2) --cw--> (2,2) {1*x^2 + 1*y^2 + 0*xy + -6*x + -4*y + 12} : (2,2) --cw--> (4,2) 6 -1 +0 + + diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con05.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con05.txt index e68e06cb488..224bbc2397a 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con05.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con05.txt @@ -12,3 +12,7 @@ f 3 3 4 9 {1*x^2 + 1*y^2 + 0*xy + -8*x + -18*y + 88} : (1,9) --cw--> (7,9) 6 2 + + + + diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con06.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con06.txt index f82851db1c1..59ac8c5f663 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con06.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con06.txt @@ -14,3 +14,4 @@ f 1 1 1 1 {1*x^2 + 1*y^2 + 0*xy + -4*x + 0*y + 3} : (2,1) --cw--> (3,0) 5 3 + diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con07.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con07.txt index e884bd40154..2b2253b5594 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con07.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con07.txt @@ -10,3 +10,4 @@ f 2 2 2 2 {1*x^2 + 1*y^2 + 0*xy + -4*x + -4*y + 4} : (0,2) --cw--> (4,2) 5 1 + diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con08.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con08.txt index 63063346910..54aae8118a0 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con08.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con08.txt @@ -26,3 +26,5 @@ f 3 1 0 0 {4*x^2 + 25*y^2 + 0*xy + -16*x + 0*y + -84} : (2.75552,1.97704) --cw--> (7,0) 10 6 + + diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con09.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con09.txt index 6afc8ee809c..543d1cff813 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con09.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con09.txt @@ -121,4 +121,5 @@ f 1 1 -4 0 {1*x^2 + 1*y^2 + 0*xy + -8*x + 0*y + 0} : (8,0) --cw--> (4.5,-3.96863) {1*x^2 + 1*y^2 + 0*xy + -8*x + 0*y + 0} : (4.5,3.96863) --cw--> (8,0) 59 -41 +34 + diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con10.txt b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con10.txt index d5f29cc3101..51c9e3ffb2a 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/data/conics/con10.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/data/conics/con10.txt @@ -18,4 +18,5 @@ s 7 -2 3 2 {1*x^2 + 1*y^2 + 0*xy + -14*x + 2*y + 49} : (8,-1) --cw--> (7,-2) {1*x^2 + 1*y^2 + 0*xy + -14*x + 2*y + 49} : (7,0) --cw--> (8,-1) 8 -5 +7 + diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test01.txt b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/big_overlap.txt similarity index 100% rename from Surface_sweep_2/test/Surface_sweep_2/data/polylines/test01.txt rename to Surface_sweep_2/test/Surface_sweep_2/data/polylines/big_overlap.txt diff --git a/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test02.txt b/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test02.txt deleted file mode 100644 index 7af88f99c7a..00000000000 --- a/Surface_sweep_2/test/Surface_sweep_2/data/polylines/test02.txt +++ /dev/null @@ -1,51 +0,0 @@ -# No. of input polylines followed by polylines -4 -2 0 0 7 0 -2 1 0 6 0 -2 2 0 5 0 -2 3 0 4 0 -# No. of output polylines followed by polylines -7 -2 0 0 1 0 -2 1 0 2 0 -2 2 0 3 0 -2 3 0 4 0 -2 4 0 5 0 -2 5 0 6 0 -2 6 0 7 0 -# No. of output points followed by points -8 -0 0 -1 0 -2 0 -3 0 -4 0 -5 0 -6 0 -7 0 -# No. of intersection points followed by points -6 -1 0 -2 0 -3 0 -4 0 -5 0 -6 0 -# No. of output polylines with overlaps followed by polylines -16 -2 0 0 1 0 -2 1 0 2 0 -2 1 0 2 0 -2 2 0 3 0 -2 2 0 3 0 -2 2 0 3 0 -2 3 0 4 0 -2 3 0 4 0 -2 3 0 4 0 -2 3 0 4 0 -2 4 0 5 0 -2 4 0 5 0 -2 4 0 5 0 -2 5 0 6 0 -2 5 0 6 0 -2 6 0 7 0 diff --git a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp index cc11bbabac3..97265afa626 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp +++ b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp @@ -101,8 +101,8 @@ typedef Rat_kernel::Segment_2 Rat_segment_2; typedef Rat_kernel::Circle_2 Rat_circle_2; typedef CGAL::Cartesian Alg_kernel; typedef CGAL::Arr_conic_traits_2 - Traits; -#elif CGAL_ARR_TEST_TRAITS == CGAL_POLYCONIC_TRAITS + Traits_2; +#elif CGAL_ARR_TEST_TRAITS == CGAL_POLYCURVE_TRAITS typedef CGAL::CORE_algebraic_number_traits Nt_traits; typedef Nt_traits::Rational Rational; typedef Nt_traits::Algebraic Algebraic; @@ -125,6 +125,10 @@ typedef std::list Points; typedef std::list Curves; typedef std::list X_monotone_curves; +bool read_curves(std::ifstream& inp, Curves& curves, const Traits& traits); +bool read_xcurves(std::ifstream& inp, X_monotone_curves& xcurves, + const Traits& traits); +bool read_points(std::ifstream& inp, Points& points, const Traits& traits); bool curves_identical(X_monotone_curves& list1, X_monotone_curves& list2); bool points_identical(Points& list1, Points& list2); @@ -144,32 +148,109 @@ std::istream& skip_comment(std::istream& in) { return in; } -#if CGAL_ARR_TEST_TRAITS != CGAL_CONIC_TRAITS - -bool read_points(std::ifstream& inp, Points& points, const Traits&) { - int count; - inp >> skip_comment >> count; - char ch; - - // std::cout << "read_points " << count << "\n"; - for (int i = 0; i < count; i++) { - NT x, y; - inp >> skip_comment >> x >> y; - Point_2 p(x, y); - // std::cout << p << "\n"; - points.push_back(p); +int main(int argc, char* argv[]) { + if (argc != 2) { + std::cout << "Specify a file name " << std::endl; + return -1; } - return true; -} -#endif + std::ifstream inp(argv[1]); + if (! inp.is_open()) { + std::cerr << "Error: Cannot open file " << argv[1] << "!" << std::endl; + return -1; + } + + Traits tr; + + Curves curves; + if (! read_curves(inp, curves, tr)) return -1; + + // Test subcurves w/o overlapping + X_monotone_curves curves_no_overlap_out; + CGAL::compute_subcurves(curves.begin(), curves.end(), + std::back_inserter(curves_no_overlap_out), + false, tr); + + + X_monotone_curves curves_no_overlap; + if (! read_xcurves(inp, curves_no_overlap, tr)) return -1; + + if (! compare_lists(curves_no_overlap_out, curves_no_overlap, tr)) { + std::cerr << "Curves w/o overlapping do not match!\n"; + for (const auto& xcv : curves_no_overlap_out) std::cerr << xcv << std::endl; + return -1; + } + + // Test intersection points (with endpoints) + Points points_with_ends_out; + CGAL::compute_intersection_points(curves.begin(), curves.end(), + std::back_inserter(points_with_ends_out), + true, tr); + + Points points_with_ends; + if (! read_points(inp, points_with_ends, tr)) return -1; + + if (! compare_lists(points_with_ends_out, points_with_ends, tr)) { + std::cerr << "Endpoints do not match!\n"; + for (const auto& p : points_with_ends_out) std::cerr << p << std::endl; + return -1; + } + + // Test intersection points w/o end points + Points points_without_ends_out; + CGAL::compute_intersection_points(curves.begin(), curves.end(), + std::back_inserter(points_without_ends_out), + false, tr); + + Points points_without_ends; + if (! read_points(inp, points_without_ends, tr)) return -1; + + if (! compare_lists(points_without_ends_out, points_without_ends, tr)) { + std::cerr << "Intersection points do not match!\n"; + for (const auto& p : points_without_ends_out) std::cerr << p << std::endl; + return -1; + } + + // Test subcurves w/ overlapping + X_monotone_curves curves_with_overlap_out; + CGAL::compute_subcurves(curves.begin(), curves.end(), + std::back_inserter(curves_with_overlap_out), + true, tr); + + X_monotone_curves curves_with_overlap; + if (! read_xcurves(inp, curves_with_overlap, tr)) return -1; + + if (! compare_lists(curves_with_overlap_out, curves_with_overlap, tr)) { + std::cerr << "Curves w/ overlapping do not match!\n"; + for (const auto& xcv : curves_with_overlap_out) + std::cerr << xcv << std::endl; + return -1; + } + + // Test the do_curves_intersecting method + bool do_intersect_out = + CGAL::do_curves_intersect(curves.begin(), curves.end()); + + bool do_intersect = false; + if ((points_without_ends.size() != 0) || + (curves_no_overlap_out.size() != curves_with_overlap_out.size())) + do_intersect = true; + + if (do_intersect_out != do_intersect) { + std::cerr << "Error: do_intersect()\n"; + return -1; + } + + std::cout << "Passed\n"; + return 0; +} #if CGAL_ARR_TEST_TRAITS == CGAL_SEGMENT_TRAITS bool read_curves(std::ifstream& inp, Curves& curves, const Traits&) { int count; inp >> skip_comment >> count; - // std::cout << "read_curves " << count << "\n"; + std::cout << "read_curves " << count << "\n"; for (int i = 0; i < count; ++i) { NT x0, y0, x1, y1; @@ -178,7 +259,7 @@ bool read_curves(std::ifstream& inp, Curves& curves, const Traits&) { Point_2 p2(x1, y1); Curve_2 curve(p1, p2); curves.push_back(curve); - // std::cout << curve << "\n"; + std::cout << curve << "\n"; } return true; } @@ -221,313 +302,24 @@ bool read_xcurves(std::ifstream& inp, X_monotone_curves& xcurves, return read_curves_(inp, xcurves, traits, ctr_xcv); } -#elif CGAL_ARR_TEST_TRAITS == CGAL_CONIC_TRAITS - -void read_curve(std::ifstream& is, Curve_2& cv) { - // Read a line from the input file. - char one_line[128]; - - is >> skip_comment; - is.getline(one_line, 128); - std::string stringvalues(one_line); - std::istringstream str_line(stringvalues, std::istringstream::in); - - // Get the arc type. - // Supported types are: 'f' - Full ellipse (or circle). - // 'e' - Elliptic arc (or circular arc). - // 's' - Line segment. - char type; - bool is_circle = false; // Is this a circle. - Rat_circle_2 circle; - Rational r, s, t, u, v, w; // The conic coefficients. - - str_line >> type; - - // An ellipse (full ellipse or a partial ellipse): - if (type == 'f' || type == 'F' || type == 'e' || type == 'E') { - // Read the ellipse (using the format "a b x0 y0"): - // - // x - x0 2 y - y0 2 - // ( -------- ) + ( -------- ) = 1 - // a b - // - int a, b, x0, y0; - - str_line >> a >> b >> x0 >> y0; - - Rational a_sq = Rational(a*a); - Rational b_sq = Rational(b*b); - - if (a == b) { - is_circle = true; - circle = - Rat_circle_2(Rat_point_2(Rational(x0), Rational(y0)), Rational(a*b)); - } - else { - r = b_sq; - s = a_sq; - t = 0; - u = Rational(-2*x0*b_sq); - v = Rational(-2*y0*a_sq); - w = Rational(x0*x0*b_sq + y0*y0*a_sq - a_sq*b_sq); - } - - if (type == 'f' || type == 'F') { - // Create a full ellipse (or circle). - if (is_circle) cv = Curve_2 (circle); - else cv = Curve_2(r, s, t, u, v, w); - } - else { - // Read the endpointd of the arc. - int x1, y1, x2, y2; - - str_line >> x1 >> y1 >> x2 >> y2; - - Point_2 source = Point_2(Algebraic(x1), Algebraic(y1)); - Point_2 target = Point_2(Algebraic(x2), Algebraic(y2)); - - // Create the arc. Note that it is always clockwise oriented. - if (is_circle) cv = Curve_2(circle, CGAL::CLOCKWISE, source, target); - else cv = Curve_2(r, s, t, u, v, w, CGAL::CLOCKWISE, source, target); - } - } - else if (type == 's' || type == 'S') { - // Read a segment, given by its endpoints (x1,y1) and (x2,y2); - int x1, y1, x2, y2; - - str_line >> x1 >> y1 >> x2 >> y2; - - // Create the segment. - Rat_point_2 source = Rat_point_2 (Rational(x1), Rational(y1)); - Rat_point_2 target = Rat_point_2 (Rational(x2), Rational(y2)); - - cv = Curve_2(Rat_segment_2 (source, target)); - } - - // std::cout << cv << std::endl; -} - -/*! Read curves. - */ -bool read_curves(std::ifstream& inp, Curves& curves, const Traits&) { - // auto ctr_cv = traits.construct_curve_2_object(); - int count; - inp >> skip_comment >> count; - Curve_2 cv; - char dummy[256]; - inp.getline(dummy, sizeof(dummy)); - for (int i = 0; i < count; ++i) { - read_curve(inp, cv); - curves.push_back(cv); - } - return true; -} - #else #error No traits defined for test #endif -#if CGAL_ARR_TEST_TRAITS != CGAL_CONIC_TRAITS +bool read_points(std::ifstream& inp, Points& points, const Traits&) { + int count; + inp >> skip_comment >> count; + char ch; -// Test subcurves w/o overlapping -bool test_curves_no_overlap(std::ifstream& inp, Curves& curves, - const X_monotone_curves& curves_no_overlap_out, - const Traits& tr) { - X_monotone_curves curves_no_overlap; - if (! read_xcurves(inp, curves_no_overlap, tr)) return false; - - if (! compare_lists(curves_no_overlap_out, curves_no_overlap, tr)) { - std::cerr << "Error: Curves w/o overlapping do not match!\n"; - for (const auto& xcv : curves_no_overlap_out) std::cerr << xcv << std::endl; - return false; + // std::cout << "read_points " << count << "\n"; + for (int i = 0; i < count; i++) { + NT x, y; + inp >> skip_comment >> x >> y; + Point_2 p(x, y); + // std::cout << p << "\n"; + points.push_back(p); } - - return true; -} - -// Test subcurves w/ overlapping -bool test_curves_with_overlap(std::ifstream& inp, Curves& curves, - const X_monotone_curves& curves_with_overlap_out, - const Traits& tr) { - X_monotone_curves curves_with_overlap; - if (! read_xcurves(inp, curves_with_overlap, tr)) return false; - - if (! compare_lists(curves_with_overlap_out, curves_with_overlap, tr)) { - std::cerr << "Error: Curves w/ overlapping do not match!\n"; - for (const auto& xcv : curves_with_overlap_out) - std::cerr << xcv << std::endl; - return false; - } - - return true; -} - -// Test intersection points (with endpoints) -bool test_points_with_ends(std::ifstream& inp, Curves& curves, - const Points& points_with_ends_out, - const Traits& tr) { - Points points_with_ends; - if (! read_points(inp, points_with_ends, tr)) return false; - - if (! compare_lists(points_with_ends_out, points_with_ends, tr)) { - std::cerr << "Error: Endpoints do not match!\n"; - for (const auto& p : points_with_ends_out) std::cerr << p << std::endl; - return false; - } - - return true; -} - -// Test intersection points w/o end points -bool test_points_no_ends(std::ifstream& inp, Curves& curves, - const Points& points_no_ends_out, - const Traits& tr) { - Points points_no_ends; - if (! read_points(inp, points_no_ends, tr)) return -1; - - if (! compare_lists(points_no_ends_out, points_no_ends, tr)) { - std::cerr << "Error: Intersection points do not match!\n"; - for (const auto& p : points_no_ends_out) std::cerr << p << std::endl; - return false; - } - - return true; -} - -#else - -/*! Test the surface sweep with conic traits. - */ -bool test_conic(std::ifstream& inp, Curves& curves, - const X_monotone_curves& curves_no_overlap_out, - const Points& points_with_ends_out, - const Points& points_no_ends_out, - const Traits&) { - char dummy[256]; - - CGAL::Bbox_2 bbox = curves.front().bbox(); - for (auto it = std::next(curves.begin()); it != curves.end(); ++it) - bbox = bbox + it->bbox(); - - // generate the string for the output - std::stringstream out1; - for (const auto& xcv : curves_no_overlap_out) out1 << xcv << "\n"; - - // read the output from the file - std::stringstream out2; - char buf[1024]; - int count = 0; - - inp >> count; - inp.getline(buf, 1024); // to get rid of the new line - for (int i = 0; i < count; ++i) { - inp.getline(buf, 1024); - out2 << buf << "\n"; - } - - // std::cout << "Result: \n" << curves_no_overlap_out.size() << "\n"; - // for (const auto& xcv : curves_no_overlap_out) - // std::cout << xcv << "\n"; - - std::string calculated = out1.str(); - std::string infile = out2.str(); - - if (infile != calculated) { - std::cerr << "Error\n"; - std::cerr << "\ncalculated:\n"; - std::cerr << calculated << std::endl; - std::cerr << "\nin file:\n"; - std::cerr << infile << std::endl; - std::cerr << "--" << std::endl; - return false; - } - - std::size_t points_with_ends_size, points_no_ends_size; - inp >> skip_comment >> points_with_ends_size >> points_no_ends_size; - - auto points_with_ends_out_size = points_with_ends_out.size(); - if (points_with_ends_size != points_with_ends_out_size ) { - std::cerr << "Error: Number of endpoints do not match (" - << points_with_ends_out_size << ", " - << points_with_ends_size << ")\n"; - return false; - } - - auto points_no_ends_out_size = points_no_ends_out.size(); - if (points_no_ends_size != points_no_ends_out_size) { - std::cerr << "Error: Number of intersection points do not match (" - << points_no_ends_out_size << ", " - << points_no_ends_size << ")\n"; - return false; - } - return true; } #endif - -int main(int argc, char* argv[]) { - if (argc != 2) { - std::cout << "Specify a file name " << std::endl; - return -1; - } - - std::ifstream inp(argv[1]); - if (! inp.is_open()) { - std::cerr << "Error: Cannot open file " << argv[1] << "!" << std::endl; - return -1; - } - - Traits tr; - - Curves curves; - if (! read_curves(inp, curves, tr)) return -1; - - X_monotone_curves curves_no_overlap_out; - CGAL::compute_subcurves(curves.begin(), curves.end(), - std::back_inserter(curves_no_overlap_out), - false, tr); - - X_monotone_curves curves_with_overlap_out; - CGAL::compute_subcurves(curves.begin(), curves.end(), - std::back_inserter(curves_with_overlap_out), - true, tr); - - Points points_with_ends_out; - CGAL::compute_intersection_points(curves.begin(), curves.end(), - std::back_inserter(points_with_ends_out), - true, tr); - - Points points_no_ends_out; - CGAL::compute_intersection_points(curves.begin(), curves.end(), - std::back_inserter(points_no_ends_out), - false, tr); - -#if CGAL_ARR_TEST_TRAITS == CGAL_CONIC_TRAITS - if (! test_conic(inp, curves, curves_no_overlap_out, - points_with_ends_out, points_no_ends_out, tr)) - return -1; -#else - if (! test_curves_no_overlap(inp, curves, curves_no_overlap_out, tr)) - return -1; - if (! test_points_with_ends(inp, curves, points_with_ends_out, tr)) return -1; - if (! test_points_no_ends(inp, curves, points_no_ends_out, tr)) return -1; - if (! test_curves_with_overlap(inp, curves, curves_with_overlap_out, tr)) - return -1; -#endif - - // Test the do_curves_intersecting method - bool do_intersect_out = - CGAL::do_curves_intersect(curves.begin(), curves.end()); - bool do_intersect = ! points_no_ends_out.empty() || - (curves_no_overlap_out.size() != curves_with_overlap_out.size()); - if (do_intersect_out != do_intersect) { - std::cerr << "Error: do_intersect()\n"; - return -1; - } - - std::cout << "Passed\n"; - return 0; -} - -#endif diff --git a/Surface_sweep_2/test/Surface_sweep_2/test_sweep_conic.cpp b/Surface_sweep_2/test/Surface_sweep_2/test_sweep_conic.cpp new file mode 100644 index 00000000000..45ae9544851 --- /dev/null +++ b/Surface_sweep_2/test/Surface_sweep_2/test_sweep_conic.cpp @@ -0,0 +1,279 @@ +#include + +#if !defined(CGAL_USE_CORE) +#include +int main() +{ + std::cout << "CORE is not installed. Test aborted!" << std::endl; + return 0; +} +#else + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +typedef CGAL::CORE_algebraic_number_traits Nt_traits; +typedef Nt_traits::Rational Rational; +typedef Nt_traits::Algebraic Algebraic; +typedef CGAL::Cartesian Rat_kernel; +typedef Rat_kernel::Point_2 Rat_point_2; +typedef Rat_kernel::Segment_2 Rat_segment_2; +typedef Rat_kernel::Circle_2 Rat_circle_2; +typedef CGAL::Cartesian Alg_kernel; +typedef CGAL::Arr_conic_traits_2 + Traits_2; + +typedef Traits_2::Curve_2 Curve_2; +typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; +typedef Traits_2::Point_2 Point_2; +typedef std::list CurveList; + +typedef std::list PointList; +typedef PointList::iterator PointListIter; + + +/*! Conic reader */ +template +class Conic_reader { +public: + int ReadData(const char* filename, CurveList& curves, CGAL::Bbox_2& bbox) + { + Curve_2 cv; + char dummy[256]; + + std::ifstream inp(filename); + if (!inp.is_open()) { + std::cerr << "Cannot open file " << filename << "!" << std::endl; + return -1; + } + int count; + inp >> count; + inp.getline(dummy, sizeof(dummy)); + for (int i = 0; i < count; i++) { + ReadCurve(inp, cv); + curves.push_back(cv); + CGAL::Bbox_2 curve_bbox = cv.bbox(); + if (i == 0) bbox = curve_bbox; + else bbox = bbox + curve_bbox; + } + inp.close(); + return 0; + } + + void ReadCurve(std::ifstream & is, Curve_2 & cv) + { + // Read a line from the input file. + char one_line[128]; + + skip_comments (is, one_line); + std::string stringvalues(one_line); + std::istringstream str_line (stringvalues, std::istringstream::in); + + // Get the arc type. + // Supported types are: 'f' - Full ellipse (or circle). + // 'e' - Elliptic arc (or circular arc). + // 's' - Line segment. + char type; + bool is_circle = false; // Is this a circle. + Rat_circle_2 circle; + Rational r, s, t, u, v, w; // The conic coefficients. + + str_line >> type; + + // An ellipse (full ellipse or a partial ellipse): + if (type == 'f' || type == 'F' || type == 'e' || type == 'E') + { + // Read the ellipse (using the format "a b x0 y0"): + // + // x - x0 2 y - y0 2 + // ( -------- ) + ( -------- ) = 1 + // a b + // + int a, b, x0, y0; + + str_line >> a >> b >> x0 >> y0; + + Rational a_sq = Rational(a*a); + Rational b_sq = Rational(b*b); + + if (a == b) + { + is_circle = true; + circle = Rat_circle_2 (Rat_point_2 (Rational(x0), Rational(y0)), + Rational(a*b)); + } + else + { + r = b_sq; + s = a_sq; + t = 0; + u = Rational(-2*x0*b_sq); + v = Rational(-2*y0*a_sq); + w = Rational(x0*x0*b_sq + y0*y0*a_sq - a_sq*b_sq); + } + + if (type == 'f' || type == 'F') + { + // Create a full ellipse (or circle). + if (is_circle) + cv = Curve_2 (circle); + else + cv = Curve_2 (r, s, t, u, v, w); + } + else + { + // Read the endpointd of the arc. + int x1, y1, x2, y2; + + str_line >> x1 >> y1 >> x2 >> y2; + + Point_2 source = Point_2 (Algebraic(x1), Algebraic(y1)); + Point_2 target = Point_2 (Algebraic(x2), Algebraic(y2)); + + // Create the arc. Note that it is always clockwise oriented. + if (is_circle) + cv = Curve_2 (circle, + CGAL::CLOCKWISE, + source, target); + else + cv = Curve_2 (r, s, t, u, v, w, + CGAL::CLOCKWISE, + source, target); + } + } + else if (type == 's' || type == 'S') + { + // Read a segment, given by its endpoints (x1,y1) and (x2,y2); + int x1, y1, x2, y2; + + str_line >> x1 >> y1 >> x2 >> y2; + + // Create the segment. + Rat_point_2 source = Rat_point_2 (Rational(x1), Rational(y1)); + Rat_point_2 target = Rat_point_2 (Rational(x2), Rational(y2)); + + cv = Curve_2(Rat_segment_2 (source, target)); + } + + return; + } + + void skip_comments( std::ifstream& is, char* one_line ) + { + while( !is.eof() ){ + is.getline( one_line, 128 ); + if( one_line[0] != '#' ){ + break; + } + } + } +}; + +//--------------------------------------------------------------------------- +// The main: +// +int main (int argc, char** argv) +{ + bool verbose = false; + + // Define a test objects to read the conic arcs from it. + if (argc<2) + { + std::cerr << "Usage: Conic_traits_test " << std::endl; + exit(1); + } + + CGAL::Bbox_2 bbox; + CurveList curves; + + Conic_reader reader; + reader.ReadData(argv[1], curves, bbox); + + // run the sweep + std::list mylist; + + CGAL::compute_subcurves(curves.begin(), curves.end(), + std::back_inserter(mylist), false); + + + PointList point_list_with_ends; + CGAL::compute_intersection_points(curves.begin(), curves.end(), + std::back_inserter(point_list_with_ends), true); + std::size_t point_count_with_ends_calculated = point_list_with_ends.size(); + + // generate the string for the output + std::stringstream out1; + for ( std::list::iterator iter = mylist.begin() ; + iter != mylist.end() ; ++iter ) + { + out1 << *iter << "\n"; + } + + // read the output from the file + std::stringstream out2; + char buf[1024]; + int count = 0; + + std::ifstream in_file(argv[1]); + in_file >> count; + in_file.getline(buf, 1024); // to get rid of the new line + for ( int i = 0 ; i < count ; i++ ) { + in_file.getline(buf, 1024); + } + in_file >> count; + in_file.getline(buf, 1024); // to get rid of the new line + for (int i = 0; i < count; i++) { + in_file.getline(buf, 1024); + out2 << buf << "\n"; + } + std::size_t point_count_with_ends_from_file = 0; + in_file >> point_count_with_ends_from_file; + in_file.close(); + + if ( verbose ) + { + std::cout << "Result: \n" << mylist.size() << "\n"; + for ( std::list::iterator i = mylist.begin() ; + i != mylist.end() ; ++i ) + { + std::cout << *i << "\n"; + } + } + + std::string calculated = out1.str(); + std::string infile = out2.str(); + + if ( infile == calculated ) { + if ( point_count_with_ends_from_file != + point_count_with_ends_calculated ) { + std::cout << "number of intersection points (with ends):" + << point_count_with_ends_calculated << ". Should be " + << point_count_with_ends_from_file << "\n"; + std::cout << argv[1] << " Error\n"; + return -1; + } else { + std::cout << argv[1] << " OK!\n"; + } + } else { + std::cout << argv[1] << " Error\n"; + std::cout << "\ncalculated:\n"; + std::cout << calculated << std::endl; + std::cout << "\nin file:\n"; + std::cout << infile << std::endl; + std::cout << "--" << std::endl; + return -1; + } + + return 0; +} + +#endif From 5d61c35a643dd1d17a4b471cfe6314cd9025858d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 18 Dec 2023 15:20:10 +0100 Subject: [PATCH 130/139] fix warning --- Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp index 97265afa626..326307f8461 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp +++ b/Surface_sweep_2/test/Surface_sweep_2/test_sweep.cpp @@ -309,7 +309,6 @@ bool read_xcurves(std::ifstream& inp, X_monotone_curves& xcurves, bool read_points(std::ifstream& inp, Points& points, const Traits&) { int count; inp >> skip_comment >> count; - char ch; // std::cout << "read_points " << count << "\n"; for (int i = 0; i < count; i++) { From 4fe88f8b4901b3c4429d95dbf1abb28c0d707a2f Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Mon, 18 Dec 2023 15:35:25 +0100 Subject: [PATCH 131/139] added transformation of normals --- .../Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp index 1a0a9e34f35..d651bdcd61b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp @@ -614,12 +614,20 @@ endPointSet(const QMatrix4x4& transform_matrix) Point_set* new_ps = new_item->point_set(); CGAL::qglviewer::Vec c = aff_transformed_item->center(); + QMatrix3x3 normal_matrix = transform_matrix.normalMatrix(); + for(Point_set::Index idx : *new_ps) { QVector3D vec = transform_matrix.map(QVector3D(new_ps->point(idx).x() - c.x, new_ps->point(idx).y() - c.y, new_ps->point(idx).z() - c.z)); new_ps->point(idx) = Kernel::Point_3(vec.x(), vec.y(), vec.z()); + if (new_ps->has_normal_map()) { + QVector3D n(new_ps->normal(idx).x(), new_ps->normal(idx).y(), new_ps->normal(idx).z()); + new_ps->normal(idx) = Kernel::Vector_3(normal_matrix(0, 0) * n[0] + normal_matrix(0, 1) * n[1] + normal_matrix(0, 2) * n[2], + normal_matrix(1, 0) * n[0] + normal_matrix(1, 1) * n[1] + normal_matrix(1, 2) * n[2], + normal_matrix(2, 0) * n[0] + normal_matrix(2, 1) * n[1] + normal_matrix(2, 2) * n[2]); + } } new_item->setName(aff_transformed_item->name()); From c36f0ac091e0e668c1f6beff29d41355d4396f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 19 Dec 2023 14:42:02 +0100 Subject: [PATCH 132/139] add a switch to get rid of QP_Solver dependency --- .../CGAL/Convex_hull_3/dual/halfspace_intersection_3.h | 10 +++++++++- .../dual/halfspace_intersection_with_constructions_3.h | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h index 2edd7244422..e140c8a227c 100644 --- a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h +++ b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h @@ -26,7 +26,9 @@ #include #include // For interior_polyhedron_3 +#ifndef CGAL_CH3_DUAL_WITHOUT_QP_SOLVER #include +#endif #include #include @@ -230,7 +232,11 @@ namespace CGAL template void halfspace_intersection_3 (PlaneIterator begin, PlaneIterator end, Polyhedron &P, - boost::optional::value_type>::Kernel::Point_3> origin = boost::none) { + boost::optional::value_type>::Kernel::Point_3> origin +#ifndef CGAL_CH3_DUAL_WITHOUT_QP_SOLVER + = boost::none +#endif + ) { // Checks whether the intersection is a polyhedron CGAL_assertion_msg(Convex_hull_3::internal::is_intersection_dim_3(begin, end), "halfspace_intersection_3: intersection not a polyhedron"); @@ -241,8 +247,10 @@ namespace CGAL // if a point inside is not provided find one using linear programming if (!origin) { +#ifndef CGAL_CH3_DUAL_WITHOUT_QP_SOLVER // find a point inside the intersection origin = halfspace_intersection_interior_point_3(begin, end); +#endif CGAL_assertion_msg(origin!=boost::none, "halfspace_intersection_3: problem when determing a point inside the intersection"); if (origin==boost::none) diff --git a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h index 31dcb337b98..b09c632555b 100644 --- a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h +++ b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_with_constructions_3.h @@ -23,7 +23,9 @@ #include // For interior_polyhedron_3 +#ifndef CGAL_CH3_DUAL_WITHOUT_QP_SOLVER #include +#endif #include #include @@ -99,7 +101,9 @@ namespace CGAL // if a point inside is not provided find one using linear programming if (!origin) { // find a point inside the intersection +#ifndef CGAL_CH3_DUAL_WITHOUT_QP_SOLVER origin = halfspace_intersection_interior_point_3(pbegin, pend); +#endif CGAL_assertion_msg(origin!=boost::none, "halfspace_intersection_with_constructions_3: problem when determing a point inside the intersection"); if (origin==boost::none) @@ -134,7 +138,11 @@ namespace CGAL void halfspace_intersection_with_constructions_3 (PlaneIterator pbegin, PlaneIterator pend, Polyhedron &P, - boost::optional::value_type>::Kernel::Point_3> const& origin = boost::none) { + boost::optional::value_type>::Kernel::Point_3> const& origin +#ifndef CGAL_CH3_DUAL_WITHOUT_QP_SOLVER + = boost::none +#endif + ) { typedef typename Kernel_traits::value_type>::Kernel K; typedef typename K::Point_3 Point_3; typedef typename Convex_hull_3::internal::Default_traits_for_Chull_3::type Traits; From bd98f389b15c22b41d4ecde183f797f5f8d8e0da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 22 Dec 2023 15:09:29 +0100 Subject: [PATCH 133/139] update for qt6 --- Scripts/developer_scripts/cgal_demo_copy_all_dlls_cygwin.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/developer_scripts/cgal_demo_copy_all_dlls_cygwin.sh b/Scripts/developer_scripts/cgal_demo_copy_all_dlls_cygwin.sh index 2af501d48c0..6699629f7c2 100644 --- a/Scripts/developer_scripts/cgal_demo_copy_all_dlls_cygwin.sh +++ b/Scripts/developer_scripts/cgal_demo_copy_all_dlls_cygwin.sh @@ -1,7 +1,7 @@ #!/bin/bash #use this script from inside the build directory of the Polyhedron demo -#Needs the Qt5_DIR env variable set to /lib/cmake/Qt5 +#Needs the Qt6_DIR env variable set to /lib/cmake/Qt6 #No config : in autotest_cgal we use NMake as generator #If using MSVC Generator, declare config="Release" @@ -43,4 +43,4 @@ for file in "${files[@]}"; do done; #check dependencies done #loop over directories mkdir -p "$target_directory/platforms" -cp "$Qt5_INSTALLATION_DIR/plugins/platforms/qwindows.dll" "$target_directory/platforms" +cp "$Qt6_INSTALLATION_DIR/plugins/platforms/qwindows.dll" "$target_directory/platforms" From 4942b8e9180ee8c3b29a15670f9de77d2214f8e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 27 Dec 2023 10:19:15 +0100 Subject: [PATCH 134/139] add QT6 version in test results --- Maintenance/test_handling/create_testresult_page | 1 + Maintenance/test_handling/to_zipped_format | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Maintenance/test_handling/create_testresult_page b/Maintenance/test_handling/create_testresult_page index 3747a4a8313..4b183402d48 100755 --- a/Maintenance/test_handling/create_testresult_page +++ b/Maintenance/test_handling/create_testresult_page @@ -475,6 +475,7 @@ sub print_platform_descriptions() MPFR GMP QT5 +QT6 LEDA CXXFLAGS LDFLAGS diff --git a/Maintenance/test_handling/to_zipped_format b/Maintenance/test_handling/to_zipped_format index d8c7c1cd433..e4d8e66bd56 100755 --- a/Maintenance/test_handling/to_zipped_format +++ b/Maintenance/test_handling/to_zipped_format @@ -51,7 +51,7 @@ sub reformat_results($) $_ = $line; open (PLATFORM_INFO,">${platform}.info") or return; open (PLATFORM_NEW_RESULTS,">${platform}.new_results") or return; - my ($CGAL_VERSION,$LEDA_VERSION,$COMPILER,$TESTER_NAME,$TESTER_ADDRESS,$GMP,$MPFR,$ZLIB,$OPENGL,$BOOST,$QT,$QT4,$QT5,$CMAKE) = ("-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","no"); + my ($CGAL_VERSION,$LEDA_VERSION,$COMPILER,$TESTER_NAME,$TESTER_ADDRESS,$GMP,$MPFR,$ZLIB,$OPENGL,$BOOST,$QT,$QT4,$QT5,$QT6,$CMAKE) = ("-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","no"); my ($LDFLAGS,$CXXFLAGS) = ("", ""); while (! /^------/) { if(/^\s*$/) { @@ -102,6 +102,9 @@ sub reformat_results($) if (/Qt5_VERSION = '([^']+)'/) { $QT5="$1"; } + if (/Qt6_VERSION = '([^']+)'/) { + $QT6="$1"; + } if (/BOOST_VERSION = '([^']+)'/) { $BOOST="$1"; } @@ -148,6 +151,7 @@ $BOOST $MPFR $GMP $QT5 +$QT6 $LEDA_VERSION $CXXFLAGS $LDFLAGS From e760e9795999da66038818ffe789379634e6069a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 27 Dec 2023 11:05:57 +0100 Subject: [PATCH 135/139] update indices --- Maintenance/test_handling/create_testresult_page | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Maintenance/test_handling/create_testresult_page b/Maintenance/test_handling/create_testresult_page index 4b183402d48..8fd78fc5820 100755 --- a/Maintenance/test_handling/create_testresult_page +++ b/Maintenance/test_handling/create_testresult_page @@ -531,7 +531,7 @@ EOF print OUTPUT "$counto\n"; print OUTPUT "$countn\n"; print OUTPUT "$countr\n"; - $index = 8; + $index = 9; while ($index) { $index--; $_ = $tmp[$index]; @@ -543,7 +543,7 @@ EOF } } else { print OUTPUT ">$pf_short"; - my $index = 12; + my $index = 13; while ($index) { print OUTPUT "?\n"; } From ee6c73b8494c24a2dd08d8e96c1155464211f3e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 27 Dec 2023 11:08:23 +0100 Subject: [PATCH 136/139] another index --- Maintenance/test_handling/create_testresult_page | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Maintenance/test_handling/create_testresult_page b/Maintenance/test_handling/create_testresult_page index 8fd78fc5820..02d4fb4a38f 100755 --- a/Maintenance/test_handling/create_testresult_page +++ b/Maintenance/test_handling/create_testresult_page @@ -512,7 +512,7 @@ EOF my $countn = $testresults[$platform_num]->{"n"}; my $countr = $testresults[$platform_num]->{"r"}; - my $index = 8; + my $index = 9; my @tmp; while ($index) { $index--; From 37c792a764e9837a94048c5feafcc291301b393b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 27 Dec 2023 11:56:08 +0100 Subject: [PATCH 137/139] fix qt6 version --- Installation/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 744e4fed4ab..1e912131c12 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -1253,6 +1253,6 @@ if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) "USING BOOST_VERSION = '${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}'" ) if(Qt6_FOUND) - message(STATUS "USING Qt6_VERSION = '${Qt6Core_VERSION_STRING}'") + message(STATUS "USING Qt6_VERSION = '${Qt6Core_VERSION}'") endif()#Qt6_FOUND endif()#RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE From ea07530d1d5ee5b17ea8dc8ffb3efee7e1d63ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 27 Dec 2023 12:01:55 +0100 Subject: [PATCH 138/139] add missing decrement --- Maintenance/test_handling/create_testresult_page | 1 + 1 file changed, 1 insertion(+) diff --git a/Maintenance/test_handling/create_testresult_page b/Maintenance/test_handling/create_testresult_page index 02d4fb4a38f..37934a2fbcb 100755 --- a/Maintenance/test_handling/create_testresult_page +++ b/Maintenance/test_handling/create_testresult_page @@ -545,6 +545,7 @@ EOF print OUTPUT ">$pf_short"; my $index = 13; while ($index) { + $index--; print OUTPUT "?\n"; } } From 3564fd185161c17f82c9b2827e9b53ba2b029b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 27 Dec 2023 14:12:35 +0100 Subject: [PATCH 139/139] unify QT --- Maintenance/test_handling/create_testresult_page | 9 ++++----- Maintenance/test_handling/to_zipped_format | 11 +++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Maintenance/test_handling/create_testresult_page b/Maintenance/test_handling/create_testresult_page index 37934a2fbcb..edde28fff96 100755 --- a/Maintenance/test_handling/create_testresult_page +++ b/Maintenance/test_handling/create_testresult_page @@ -474,8 +474,7 @@ sub print_platform_descriptions() BOOST MPFR GMP -QT5 -QT6 +QT LEDA CXXFLAGS LDFLAGS @@ -512,7 +511,7 @@ EOF my $countn = $testresults[$platform_num]->{"n"}; my $countr = $testresults[$platform_num]->{"r"}; - my $index = 9; + my $index = 8; my @tmp; while ($index) { $index--; @@ -531,7 +530,7 @@ EOF print OUTPUT "$counto\n"; print OUTPUT "$countn\n"; print OUTPUT "$countr\n"; - $index = 9; + $index = 8; while ($index) { $index--; $_ = $tmp[$index]; @@ -543,7 +542,7 @@ EOF } } else { print OUTPUT ">$pf_short"; - my $index = 13; + my $index = 12; while ($index) { $index--; print OUTPUT "?\n"; diff --git a/Maintenance/test_handling/to_zipped_format b/Maintenance/test_handling/to_zipped_format index e4d8e66bd56..fdf62712b02 100755 --- a/Maintenance/test_handling/to_zipped_format +++ b/Maintenance/test_handling/to_zipped_format @@ -51,7 +51,7 @@ sub reformat_results($) $_ = $line; open (PLATFORM_INFO,">${platform}.info") or return; open (PLATFORM_NEW_RESULTS,">${platform}.new_results") or return; - my ($CGAL_VERSION,$LEDA_VERSION,$COMPILER,$TESTER_NAME,$TESTER_ADDRESS,$GMP,$MPFR,$ZLIB,$OPENGL,$BOOST,$QT,$QT4,$QT5,$QT6,$CMAKE) = ("-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","no"); + my ($CGAL_VERSION,$LEDA_VERSION,$COMPILER,$TESTER_NAME,$TESTER_ADDRESS,$GMP,$MPFR,$ZLIB,$OPENGL,$BOOST,$QT,$CMAKE) = ("-","-","-","-","-","-","-","-","-","-","-","-","-","no"); my ($LDFLAGS,$CXXFLAGS) = ("", ""); while (! /^------/) { if(/^\s*$/) { @@ -97,13 +97,13 @@ sub reformat_results($) $QT="$1"; } if (/QT4_VERSION = '([^']+)'/) { - $QT4="$1"; + $QT="$1"; } if (/Qt5_VERSION = '([^']+)'/) { - $QT5="$1"; + $QT="$1"; } if (/Qt6_VERSION = '([^']+)'/) { - $QT6="$1"; + $QT="$1"; } if (/BOOST_VERSION = '([^']+)'/) { $BOOST="$1"; @@ -150,8 +150,7 @@ $CMAKE $BOOST $MPFR $GMP -$QT5 -$QT6 +$QT $LEDA_VERSION $CXXFLAGS $LDFLAGS