From 50766d9d0303da2ad5621a7a7a67fa2db2231691 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 21 Apr 2020 10:03:00 +0200 Subject: [PATCH 1/8] Fixes for min/max --- AABB_tree/demo/AABB_tree/Scene.cpp | 10 +- AABB_tree/demo/AABB_tree/Scene.h | 2 +- .../ArrangementDemoGraphicsView.cpp | 8 +- .../CGAL/Curved_kernel_via_analysis_2/Arc_2.h | 8 +- .../gfx/Curve_renderer_2.h | 6 +- BGL/include/CGAL/boost/graph/selection.h | 485 +++++++++++++++++- .../test_extensive/stability/stability.cpp | 4 +- .../demo/CGAL_ipelets/alpha_shapes.cpp | 2 +- CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp | 2 +- .../Feature/Cluster_vertical_extent.h | 4 +- .../CGAL/Classification/Feature/Elevation.h | 6 +- .../Classification/Feature/Height_above.h | 4 +- .../Classification/Feature/Height_below.h | 4 +- .../Classification/Feature/Vertical_range.h | 8 +- .../CGAL/Classification/compressed_float.h | 8 +- .../Coplanar_side_of_bounded_circle_3.h | 2 +- .../heat_method_surface_mesh.cpp | 8 +- .../Heat_method_3/heat_method_concept.cpp | 6 +- .../heat_method_surface_mesh_direct_test.cpp | 10 +- .../heat_method_surface_mesh_test.cpp | 10 +- .../demo/Hyperbolic_triangulation_2/HDT2.cpp | 2 +- .../config/testfiles/CGAL_CFG_NO_LIMITS.cpp | 2 +- Kernel_23/include/CGAL/Dimension.h | 2 +- .../surface_mesh/IO_off.cpp | 4 +- .../surface_mesh/Vector.h | 4 +- .../cgogn_performance_3.h | 2 +- .../Linear_cell_complex_3/lcc_performance_3.h | 2 +- .../openvolumemesh_performance.h | 2 +- .../applications/CGAL/min_dihedral_angle.h | 20 +- Mesh_3/include/CGAL/Mesh_3/Sizing_grid.h | 2 +- .../Visual_hull/Nef_3/visual_hull_creator.h | 4 +- Nef_3/include/CGAL/Nef_3/Infimaximal_box.h | 18 +- Number_types/include/CGAL/Quotient.h | 2 +- .../CGAL/Periodic_3_mesh_3/IO/File_medit.h | 12 +- .../test_triply_periodic_minimal_surfaces.cpp | 22 +- .../CGAL/_test_periodic_3_static_filters.h | 12 +- .../P4HDT2.cpp | 2 +- .../Periodic_4_hyperbolic_triangulation_2.h | 6 +- .../Point_set_shape_detection_3/generators.h | 4 +- ...ABB_traversal_traits_with_transformation.h | 12 +- Polyhedron/demo/Polyhedron/MainWindow.cpp | 1 - .../Classification/Cluster_classification.cpp | 6 +- .../Point_set_item_classification.cpp | 6 +- .../Point_set_item_classification.h | 4 +- .../Surface_mesh_item_classification.cpp | 6 +- .../Plugins/PCA/Create_bbox_mesh_plugin.cpp | 6 +- .../Plugins/PCA/Scene_edit_box_item.cpp | 11 +- .../Plugins/PMP/Engrave_text_plugin.cpp | 8 +- .../Surface_mesh/Mesh_segmentation_plugin.cpp | 2 +- .../Mesh_simplification_plugin.cpp | 2 +- .../demo/Polyhedron/Scene_c3t3_item.cpp | 8 +- .../demo/Polyhedron/Scene_polylines_item.cpp | 2 +- .../include/CGAL/Polynomial/bezout_matrix.h | 4 +- .../include/CGAL/Straight_skeleton_2/test.h | 8 +- .../include/CGAL/Surface_mesh/Properties.h | 4 +- .../include/CGAL/Surface_mesh/Surface_mesh.h | 10 +- .../CGAL/Variational_shape_approximation.h | 2 +- .../benchmark_shortest_paths.cpp | 8 +- .../Surface_mesh_shortest_path.h | 2 +- .../include/CGAL/enriched_polyhedron.h | 12 +- .../CGAL/vtkSurfaceMesherContourFilter.h | 4 +- .../CGAL/internal/Combination_enumerator.h | 8 +- 62 files changed, 669 insertions(+), 188 deletions(-) diff --git a/AABB_tree/demo/AABB_tree/Scene.cpp b/AABB_tree/demo/AABB_tree/Scene.cpp index f5807c419a5..b362f854c16 100644 --- a/AABB_tree/demo/AABB_tree/Scene.cpp +++ b/AABB_tree/demo/AABB_tree/Scene.cpp @@ -857,8 +857,8 @@ void Scene::update_grid_size() } void Scene::generate_points_in(const unsigned int nb_points, - const double min, - const double max) + const double vmin, + const double vmax) { if(m_pPolyhedron == NULL) { @@ -877,7 +877,7 @@ void Scene::generate_points_in(const unsigned int nb_points, CGAL::Timer timer; timer.start(); std::cout << "Generate " << nb_points << " points in interval [" - << min << ";" << max << "]"; + << vmin << ";" << vmax << "]"; unsigned int nb_trials = 0; Vector vec = random_vector(); @@ -894,8 +894,8 @@ void Scene::generate_points_in(const unsigned int nb_points, if(nb_intersections % 2 != 0) signed_distance *= -1.0; - if(signed_distance >= min && - signed_distance <= max) + if(signed_distance >= vmin && + signed_distance <= vmax) { m_points.push_back(p); if(m_points.size()%(nb_points/10) == 0) diff --git a/AABB_tree/demo/AABB_tree/Scene.h b/AABB_tree/demo/AABB_tree/Scene.h index aad62368874..4e9fabd735b 100644 --- a/AABB_tree/demo/AABB_tree/Scene.h +++ b/AABB_tree/demo/AABB_tree/Scene.h @@ -192,7 +192,7 @@ public: void generate_boundary_points(const unsigned int nb_points); void generate_boundary_segments(const unsigned int nb_slices); void generate_points_in(const unsigned int nb_points, - const double min, const double max); + const double vmin, const double vmax); // algorithms/refine void refine_loop(); diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp index 30aa393ac22..8510bdd5e0d 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp @@ -118,10 +118,10 @@ QRectF ArrangementDemoGraphicsView::getViewportRect( ) const QPointF p1 = this->mapToScene( 0, 0 ); QPointF p2 = this->mapToScene( this->width( ), this->height( ) ); - double xmin = std::min( p1.x( ), p2.x( ) ); - double xmax = std::max( p1.x( ), p2.x( ) ); - double ymin = std::min( p1.y( ), p2.y( ) ); - double ymax = std::max( p1.y( ), p2.y( ) ); + double xmin = (std::min)( p1.x( ), p2.x( ) ); + double xmax = (std::max)( p1.x( ), p2.x( ) ); + double ymin = (std::min)( p1.y( ), p2.y( ) ); + double ymax = (std::max)( p1.y( ), p2.y( ) ); QRectF res = QRectF( QPointF( xmin, ymin ), QPointF( xmax, ymax ) ); diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h index 3430fd31dfc..ded1c5fb5a7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h @@ -3031,8 +3031,8 @@ public: y_dapprox = y_interval_for_curve_end(*this, CGAL::ARR_MIN_END, prec); // adapt y-interval - ymin = CGAL::min(ymin, y_dapprox.first); - ymax = CGAL::max(ymax, y_dapprox.second); + ymin = (CGAL::min)(ymin, y_dapprox.first); + ymax = (CGAL::max)(ymax, y_dapprox.second); // right end @@ -3112,9 +3112,9 @@ public: (curr_xy, prec); // adapt y-interval - ymin = CGAL::min(ymin, + ymin = (CGAL::min)(ymin, CGAL::to_double(xy_approx.first)); - ymax = CGAL::max(ymax, + ymax = (CGAL::max)(ymax, CGAL::to_double(xy_approx.second)); } } diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h index da1e45c73f7..edcbefdb1c4 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h @@ -581,7 +581,7 @@ void draw(const Arc_2& arc, ref_bound = engine.pixel_h_r/CGAL_REFINE_X; #ifdef CGAL_CKVA_RENDER_WITH_REFINEMENT - ref_bound = std::min(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX)); + ref_bound = (std::min)(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX)); #endif Gfx_OUT("computing y-coordinates\n"); @@ -921,7 +921,7 @@ bool draw(const Point_2& pt, Coord_2& coord) { const Coordinate_1& x0 = pt.x(); Rational ref_bound = engine.pixel_w_r / 2; #ifdef CGAL_CKVA_RENDER_WITH_REFINEMENT - ref_bound = std::min(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX)); + ref_bound = (std::min)(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX)); #endif typename Curve_kernel_2::Algebraic_kernel_d_1::Approximate_relative_1 @@ -941,7 +941,7 @@ bool draw(const Point_2& pt, Coord_2& coord) { ref_bound = engine.pixel_h_r / CGAL_REFINE_X; #ifdef CGAL_CKVA_RENDER_WITH_REFINEMENT - ref_bound = std::min(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX)); + ref_bound = (std::min)(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX)); #endif Coordinate_2 xy(x0, pt.curve(), pt.arcno()); diff --git a/BGL/include/CGAL/boost/graph/selection.h b/BGL/include/CGAL/boost/graph/selection.h index eab43458238..37f566098c1 100644 --- a/BGL/include/CGAL/boost/graph/selection.h +++ b/BGL/include/CGAL/boost/graph/selection.h @@ -26,6 +26,12 @@ #include #include +#include +#include +#include + +#include +#include namespace CGAL { @@ -66,6 +72,225 @@ extract_selection_boundary( } return out; } + +template +struct Regularization_graph +{ + typedef boost::graph_traits GT; + typedef typename GT::face_descriptor fg_face_descriptor; + typedef typename GT::face_iterator fg_face_iterator; + typedef typename GT::halfedge_descriptor fg_halfedge_descriptor; + typedef typename GT::edge_descriptor fg_edge_descriptor; + typedef typename GT::edge_iterator fg_edge_iterator; + typedef typename GT::vertex_descriptor fg_vertex_descriptor; + + typedef fg_face_descriptor vertex_descriptor; + typedef fg_face_iterator vertex_iterator; + typedef fg_edge_descriptor edge_descriptor; + typedef boost::undirected_tag directed_category; + typedef boost::disallow_parallel_edge_tag edge_parallel_category; + typedef boost::edge_list_graph_tag traversal_category; + + struct Filter_border_edges + { + FaceGraph* fg; + Filter_border_edges (FaceGraph& fg) : fg (&fg) { } + bool operator() (const fg_edge_descriptor ed) const + { + return !is_border (ed, *fg); + } + }; + + typedef boost::filter_iterator edge_iterator; + + struct Vertex_label_map + { + typedef vertex_descriptor key_type; + typedef std::size_t value_type; + typedef std::size_t& reference; + typedef boost::lvalue_property_map_tag category; + + Regularization_graph* rg; + + Vertex_label_map (Regularization_graph* rg) + : rg (rg) { } + + friend reference get (const Vertex_label_map& map, key_type k) + { + return (map.rg->labels)[get(map.rg->face_index_map,k)]; + } + friend void put (const Vertex_label_map& map, key_type k, const value_type& v) + { + (map.rg->labels)[get(map.rg->face_index_map,k)] = v; + } + }; + + struct Vertex_label_probability_map + { + typedef vertex_descriptor key_type; + typedef std::vector value_type; + typedef value_type reference; + typedef boost::readable_property_map_tag category; + + const Regularization_graph* rg; + + Vertex_label_probability_map (const Regularization_graph* rg) + : rg (rg) + { } + + friend reference get (const Vertex_label_probability_map& pmap, key_type fd) + { + double value = (1. - pmap.rg->weight) * pmap.rg->area (fd) / pmap.rg->total_area; + + std::vector out(2); + if (get(pmap.rg->is_selected_map, fd)) + { + if (pmap.rg->prevent_unselection) + out[0] = (std::numeric_limits::max)(); + else + out[0] = value; + out[1] = 0.; + } + else + { + out[0] = 0.; + out[1] = value; + } + + return out; + } + }; + + struct Edge_cost_map + { + typedef edge_descriptor key_type; + typedef double value_type; + typedef value_type reference; + typedef boost::readable_property_map_tag category; + + const Regularization_graph* rg; + + Edge_cost_map (const Regularization_graph* rg) + : rg (rg) { } + + friend reference get (const Edge_cost_map& pmap, key_type ed) + { + fg_vertex_descriptor esource = source(ed, pmap.rg->fg); + fg_vertex_descriptor etarget = target(ed, pmap.rg->fg); + + // Cost + double edge_length = std::sqrt(CGAL::squared_distance (get (pmap.rg->vertex_point_map, esource), + get (pmap.rg->vertex_point_map, etarget))); + return pmap.rg->weight * edge_length / pmap.rg->total_length; + } + }; + + FaceGraph& fg; + IsSelectedMap is_selected_map; + FaceIndexMap face_index_map; + VertexPointMap vertex_point_map; + double total_length; + double total_area; + double weight; + bool prevent_unselection; + std::vector labels; + + Regularization_graph (FaceGraph& fg, + IsSelectedMap is_selected_map, + FaceIndexMap face_index_map, + VertexPointMap vertex_point_map, + double weight, + bool prevent_unselection) + : fg (fg), + is_selected_map (is_selected_map), + face_index_map (face_index_map), + vertex_point_map (vertex_point_map), + total_length(0), + total_area(0), + weight (weight), + prevent_unselection (prevent_unselection) + { + labels.reserve(num_faces(fg)); + std::size_t nb_selected = 0; + for (fg_face_descriptor fd : faces(fg)) + { + if (get(is_selected_map,fd)) + { + labels.push_back(1); + ++ nb_selected; + } + else + labels.push_back(0); + } + + // Compute normalization factors + for (fg_edge_descriptor ed : edges(fg)) + total_length += length (ed); + for (fg_face_descriptor fd : faces(fg)) + total_area += area (fd); + } + + double length (fg_edge_descriptor ed) const + { + fg_vertex_descriptor esource = source(ed, fg); + fg_vertex_descriptor etarget = target(ed, fg); + return approximate_sqrt (typename GeomTraits::Compute_squared_distance_3() + (get (vertex_point_map, esource), + get (vertex_point_map, etarget))); + } + + double area (fg_face_descriptor fd) const + { + fg_halfedge_descriptor hd = halfedge (fd, fg); + fg_halfedge_descriptor nhd = next (hd, fg); + + return approximate_sqrt (typename GeomTraits::Compute_squared_area_3() + (get (vertex_point_map, source (hd, fg)), + get (vertex_point_map, target (hd, fg)), + get (vertex_point_map, target (nhd, fg)))); + } + + friend CGAL::Iterator_range + vertices (const Regularization_graph& graph) + { + return faces (graph.fg); + } + + friend std::size_t num_vertices (const Regularization_graph& graph) { return num_faces(graph.fg); } + + friend CGAL::Iterator_range + edges (const Regularization_graph& graph) + { + return CGAL::make_range (boost::make_filter_iterator + (Filter_border_edges(graph.fg), + begin(edges(graph.fg)), end(edges(graph.fg))), + boost::make_filter_iterator + (Filter_border_edges(graph.fg), + end(edges(graph.fg)), end(edges(graph.fg)))); + } + + friend vertex_descriptor source (edge_descriptor ed, const Regularization_graph& graph) + { + return face (halfedge (ed, graph.fg), graph.fg); + } + + friend vertex_descriptor target (edge_descriptor ed, const Regularization_graph& graph) + { + return face (opposite(halfedge (ed, graph.fg), graph.fg), graph.fg); + } + + Vertex_label_map vertex_label_map() { return Vertex_label_map(this); } + Vertex_label_probability_map vertex_label_probability_map() const + { return Vertex_label_probability_map(this); } + Edge_cost_map edge_cost_map() const + { return Edge_cost_map(this); } +}; + + } //end of namespace internal @@ -213,6 +438,265 @@ reduce_face_selection( return out; } +/*! + \ingroup PkgBGLSelectionFct + + regularizes a selection in order to minimize the length of the + border of the selection. + + The alpha expansion algorithm is used (see + `CGAL::alpha_expansion_graphcut()`) using the length of the edge + between two faces as the edge cost and the initial + selected/unselected property of a face as the face cost. + + If `prevent_unselection` is set to `true`, the cost of unselecting a + face is set to infinity, which forces the regularization to only + select new faces and ensures that the regularization keeps all + selected faces. + + \tparam TriangleMesh a model of `FaceGraph` + + \tparam IsSelectedMap a model of `ReadWritePropertyMap` with + `boost::graph_traits::%face_descriptor` as key type and + `bool` as value type + + \tparam NamedParameters a sequence of named parameters + + \param mesh the mesh containing the selected faces. + + \param is_selected indicates if a face is part of the selection. It + is updated by the function to accommodate faces added or removed + from the selection. + + \param weight sets the tradeoff between data fidelity and + regularity, ranging from 0 (no regularization at all, selection is + left unaltered) to 1 (maximum regularization, usually selects or + unselects everything so that the length of the border of the + selection is 0) + + \param np optional sequence of named parameters among the ones listed below + + \cgalNamedParamsBegin + \cgalParamBegin{face_index_map} + the property map with the indices associated to the faces of `mesh` + \cgalParamEnd + \cgalParamBegin{vertex_point_map} + the property map with the points associated to the vertices of `mesh` + \cgalParamEnd + \cgalParamBegin{prevent_unselection} + if `true` only new faces can be selected, if `false` (default) some + faces can be unselected + \cgalParamEnd + \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd + \cgalNamedParamsEnd +*/ +template +void +regularize_face_selection_borders( + TriangleMesh& mesh, + IsSelectedMap is_selected, + double weight, + const NamedParameters& np) +{ + using parameters::choose_parameter; + using parameters::get_parameter; + + CGAL_precondition (0.0 <= weight && weight < 1.0); + + typedef boost::graph_traits GT; + typedef typename GT::face_descriptor mesh_face_descriptor; + + typedef typename GetInitializedFaceIndexMap::type FaceIndexMap; + FaceIndexMap face_index_map = CGAL::get_initialized_face_index_map(mesh, np); + + typedef typename GetVertexPointMap::const_type VertexPointMap; + VertexPointMap vertex_point_map + = choose_parameter(get_parameter(np, internal_np::vertex_point), + get_const_property_map(vertex_point, mesh)); + + typedef typename GetGeomTraits::type Kernel; + + bool prevent_unselection = choose_parameter(get_parameter(np, internal_np::prevent_unselection), + false); + + internal::Regularization_graph + graph (mesh, is_selected, + face_index_map, + vertex_point_map, + weight, + prevent_unselection); + + alpha_expansion_graphcut (graph, + graph.edge_cost_map(), + graph.vertex_label_probability_map(), + graph.vertex_label_map(), + CGAL::parameters::vertex_index_map + (face_index_map)); + + for (mesh_face_descriptor fd : faces(mesh)) + put(is_selected, fd, graph.labels[get(face_index_map,fd)]); +} + +/// \cond SKIP_IN_MANUAL +// variant with default np +template +void +regularize_face_selection_borders( + TriangleMesh& fg, + IsSelectedMap is_selected, + double weight) +{ + regularize_face_selection_borders (fg, is_selected, weight, + CGAL::parameters::all_default()); +} +/// \endcond + +/// \cond SKIP_IN_MANUAL +// TODO: improve and document if useful +// +// Variant of regularization without graphcut but with brut-force +// local expansions. Can be interesting in some cases but too +// experimental/messy so far to be officially integrated. +template +void +regularize_face_selection_borders( + FaceGraph& fg, + IsSelectedMap is_selected, + VertexPointMap vertex_point_map) +{ + typedef boost::graph_traits GT; + typedef typename GT::face_descriptor fg_face_descriptor; + typedef typename GT::halfedge_descriptor fg_halfedge_descriptor; + typedef typename GT::edge_descriptor fg_edge_descriptor; + typedef typename GT::vertex_descriptor fg_vertex_descriptor; + + // TODO: this is a quick and dirty version, the complexity is + // crazy and it should be easy to do better (with priority queues, + // for example) + + auto border_length = + [&]() -> double + { + double out = 0.; + for(fg_edge_descriptor ed : edges(fg)) + { + fg_face_descriptor f0 = face (halfedge (ed, fg), fg); + fg_face_descriptor f1 = face (opposite(halfedge (ed, fg), fg), fg); + if (get(is_selected,f0) == get(is_selected,f1)) + continue; + + fg_vertex_descriptor esource = source(ed, fg); + fg_vertex_descriptor etarget = target(ed, fg); + + out += std::sqrt(CGAL::squared_distance (get (vertex_point_map, esource), + get (vertex_point_map, etarget))); + } + return out; + }; + + // First: try edges + while (true) + { + fg_edge_descriptor chosen; + double length_before = border_length(); + double shortest_length = length_before; + + for (fg_edge_descriptor ed : edges(fg)) + { + fg_face_descriptor selected = face (halfedge (ed, fg), fg); + fg_face_descriptor unselected = face (opposite(halfedge (ed, fg), fg), fg); + if (get(is_selected,selected) == get(is_selected,unselected)) + continue; + + if (get(is_selected, unselected)) + std::swap (selected, unselected); + + put(is_selected, unselected, true); + double length_after = border_length(); + + if (length_after < shortest_length) + { + chosen = ed; + shortest_length = length_after; + } + + // Cancel + put(is_selected, unselected, false); + } + + if (shortest_length == length_before) + break; + + fg_face_descriptor selected = face (halfedge (chosen, fg), fg); + fg_face_descriptor unselected = face (opposite(halfedge (chosen, fg), fg), fg); + if (get(is_selected,selected) == get(is_selected,unselected)) + continue; + + if (get(is_selected, unselected)) + std::swap (selected, unselected); + + put(is_selected, unselected, true); + } + + // Second: try 1-ring of vertices + while (true) + { + fg_vertex_descriptor chosen; + double length_before = border_length(); + double shortest_length = length_before; + + for (fg_vertex_descriptor vd : vertices(fg)) + { + fg_halfedge_descriptor hd = halfedge(vd, fg); + bool adjacent_to_selected = false, adjacent_to_nonselected = false; + for (fg_face_descriptor fd : faces_around_target (hd, fg)) + { + if (get(is_selected, fd)) + adjacent_to_selected = true; + else + adjacent_to_nonselected = true; + + if (adjacent_to_selected && adjacent_to_nonselected) + break; + } + + if (!(adjacent_to_selected && adjacent_to_nonselected)) + continue; + + std::vector newly_selected; + for (fg_face_descriptor fd : faces_around_target (hd, fg)) + { + if (!get(is_selected, fd)) + { + newly_selected.push_back (fd); + put(is_selected, fd, true); + } + } + double length_after = border_length(); + + if (length_after < shortest_length) + { + chosen = vd; + shortest_length = length_after; + } + + // Cancel + for (fg_face_descriptor fd : newly_selected) + put(is_selected, fd, false); + } + + if (shortest_length == length_before) + break; + + fg_halfedge_descriptor hd = halfedge (chosen, fg); + + for (fg_face_descriptor fd : faces_around_target (hd, fg)) + put(is_selected, fd, true); + } +} +/// \endcond + /*! \ingroup PkgBGLSelectionFct @@ -662,4 +1146,3 @@ bool is_selection_a_topological_disk(const FaceRange& face_selection, } //end of namespace CGAL #endif //CGAL_BOOST_GRAPH_SELECTION_H - diff --git a/Bounding_volumes/archive/test_extensive/stability/stability.cpp b/Bounding_volumes/archive/test_extensive/stability/stability.cpp index 419c50460c8..7b3c8673926 100644 --- a/Bounding_volumes/archive/test_extensive/stability/stability.cpp +++ b/Bounding_volumes/archive/test_extensive/stability/stability.cpp @@ -17,8 +17,8 @@ int nr = 0; double rerr(double exact,double approx) { const double e = std::abs((exact-approx)/exact); - mine = std::min(mine,e); - maxe = std::max(maxe,e); + mine = (std::min)(mine,e); + maxe = (std::max)(maxe,e); avge += e; ++nr; return e; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp b/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp index 2b7d9d7e334..deafa59d0a1 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp @@ -103,7 +103,7 @@ void ASphapeIpelet::protected_run(int fn) } - A.set_alpha(alpha==0?std::max(std::numeric_limits::epsilon(),A.get_nth_alpha(0)/2.): + A.set_alpha(alpha==0?(std::max)(std::numeric_limits::epsilon(),A.get_nth_alpha(0)/2.): (std::size_t) alpha==A.number_of_alphas()?A.get_nth_alpha(alpha-1)+1:A.get_nth_alpha(alpha-1)/2.+A.get_nth_alpha(alpha)/2.); for ( Alpha_shape_2::Alpha_shape_edges_iterator it=A.alpha_shape_edges_begin();it!=A.alpha_shape_edges_end();++it) draw_in_ipe(A.segment(*it)); diff --git a/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp b/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp index c4f2df8b14e..56998fcc75e 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp @@ -114,7 +114,7 @@ void SkeletonIpelet::protected_run(int fn) std::list offsets; //~ "Interior skeleton", "Exterior skeleton","Interior offset","Exterior offset","Interior offsets","Exterior offsets", "Help" SkeletonPtr ss; - double max_edge=std::max((bbox.xmax()-bbox.xmin()),(bbox.ymax()-bbox.ymin())); + double max_edge=(std::max)((bbox.xmax()-bbox.xmin()),(bbox.ymax()-bbox.ymin())); double dist=0.; int ret_val=-1; switch(fn){ diff --git a/Classification/include/CGAL/Classification/Feature/Cluster_vertical_extent.h b/Classification/include/CGAL/Classification/Feature/Cluster_vertical_extent.h index 939c3792534..205d39e5496 100644 --- a/Classification/include/CGAL/Classification/Feature/Cluster_vertical_extent.h +++ b/Classification/include/CGAL/Classification/Feature/Cluster_vertical_extent.h @@ -67,8 +67,8 @@ public: m_values.reserve (clusters.size()); for (std::size_t i = 0; i < clusters.size(); ++ i) { - float min_z = std::numeric_limits::max(); - float max_z = -std::numeric_limits::min(); + float min_z = (std::numeric_limits::max)(); + float max_z = -(std::numeric_limits::min)(); for (std::size_t j = 0; j < clusters[i].size(); ++ j) { diff --git a/Classification/include/CGAL/Classification/Feature/Elevation.h b/Classification/include/CGAL/Classification/Feature/Elevation.h index 3df9a378b09..117409491de 100644 --- a/Classification/include/CGAL/Classification/Feature/Elevation.h +++ b/Classification/include/CGAL/Classification/Feature/Elevation.h @@ -97,7 +97,7 @@ public: Image_float dem(grid.width(),grid.height()); z_max = 0.f; - z_min = std::numeric_limits::max(); + z_min = (std::numeric_limits::max)(); for (std::size_t j = 0; j < grid.height(); ++ j) for (std::size_t i = 0; i < grid.width(); ++ i) @@ -109,8 +109,8 @@ public: for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it) { float z = float(get(point_map, *(input.begin()+(*it))).z()); - z_min = (std::min(z_min, z)); - z_max = (std::max(z_max, z)); + z_min = ((std::min)(z_min, z)); + z_max = ((std::max)(z_max, z)); mean += z; ++ nb; } diff --git a/Classification/include/CGAL/Classification/Feature/Height_above.h b/Classification/include/CGAL/Classification/Feature/Height_above.h index f3dff5d0e0e..2beb6ad7898 100644 --- a/Classification/include/CGAL/Classification/Feature/Height_above.h +++ b/Classification/include/CGAL/Classification/Feature/Height_above.h @@ -90,13 +90,13 @@ public: for (std::size_t i = 0; i < grid.width(); ++ i) if (grid.has_points(i,j)) { - float z_max = -std::numeric_limits::max(); + float z_max = -(std::numeric_limits::max)(); typename Grid::iterator end = grid.indices_end(i,j); for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it) { float z = float(get(point_map, *(input.begin()+(*it))).z()); - z_max = (std::max(z_max, z)); + z_max = ((std::max)(z_max, z)); } dtm(i,j) = z_max; diff --git a/Classification/include/CGAL/Classification/Feature/Height_below.h b/Classification/include/CGAL/Classification/Feature/Height_below.h index 8f209c1f209..0574ac5524b 100644 --- a/Classification/include/CGAL/Classification/Feature/Height_below.h +++ b/Classification/include/CGAL/Classification/Feature/Height_below.h @@ -90,13 +90,13 @@ public: for (std::size_t i = 0; i < grid.width(); ++ i) if (grid.has_points(i,j)) { - float z_min = std::numeric_limits::max(); + float z_min = (std::numeric_limits::max)(); typename Grid::iterator end = grid.indices_end(i,j); for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it) { float z = float(get(point_map, *(input.begin()+(*it))).z()); - z_min = (std::min(z_min, z)); + z_min = ((std::min)(z_min, z)); } dtm(i,j) = z_min; diff --git a/Classification/include/CGAL/Classification/Feature/Vertical_range.h b/Classification/include/CGAL/Classification/Feature/Vertical_range.h index e5dacbb8aae..0780dcbee75 100644 --- a/Classification/include/CGAL/Classification/Feature/Vertical_range.h +++ b/Classification/include/CGAL/Classification/Feature/Vertical_range.h @@ -90,15 +90,15 @@ public: for (std::size_t i = 0; i < grid.width(); ++ i) if (grid.has_points(i,j)) { - float z_max = -std::numeric_limits::max(); - float z_min = std::numeric_limits::max(); + float z_max = -(std::numeric_limits::max)(); + float z_min = (std::numeric_limits::max)(); typename Grid::iterator end = grid.indices_end(i,j); for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it) { float z = float(get(point_map, *(input.begin()+(*it))).z()); - z_max = (std::max(z_max, z)); - z_min = (std::min(z_min, z)); + z_max = ((std::max)(z_max, z)); + z_min = ((std::min)(z_min, z)); } dtm(i,j) = z_max - z_min; diff --git a/Classification/include/CGAL/Classification/compressed_float.h b/Classification/include/CGAL/Classification/compressed_float.h index 4e06c8dfb4f..6520f76a6ac 100644 --- a/Classification/include/CGAL/Classification/compressed_float.h +++ b/Classification/include/CGAL/Classification/compressed_float.h @@ -49,15 +49,15 @@ typedef unsigned short compressed_float; typedef unsigned char compressed_float; # endif -inline compressed_float compress_float (const float& f, const float& min = 0.f, const float& max = 1.f) +inline compressed_float compress_float (const float& f, const float& fmin = 0.f, const float& fmax = 1.f) { return static_cast - (float(std::numeric_limits::max()) * (f - min) / (max - min)); + (float((std::numeric_limits::max)()) * (f - fmin) / (fmax - fmin)); } -inline float decompress_float (const compressed_float& t, const float& min = 0.f, const float& max = 1.f) +inline float decompress_float (const compressed_float& t, const float& fmin = 0.f, const float& fmax = 1.f) { - return ((max - min) * (t / float(std::numeric_limits::max())) + min); + return ((fmax - fmin) * (t / float((std::numeric_limits::max)())) + fmin); } #endif diff --git a/Filtered_kernel/include/CGAL/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h b/Filtered_kernel/include/CGAL/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h index 69661b62aad..f946f334159 100644 --- a/Filtered_kernel/include/CGAL/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h +++ b/Filtered_kernel/include/CGAL/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h @@ -135,7 +135,7 @@ public: if (maxz < arz) maxz = arz; if (maxz < atz) maxz = atz; - double d = std::max(maxx, std::max(maxy, maxz)); + double d = (std::max)(maxx, (std::max)(maxy, maxz)); double eps = 3.27418e-11 * d * d * d * d * d * d; if (det > eps) return ON_BOUNDED_SIDE; diff --git a/Heat_method_3/examples/Heat_method_3/heat_method_surface_mesh.cpp b/Heat_method_3/examples/Heat_method_3/heat_method_surface_mesh.cpp index 99387734ff0..20555030c91 100644 --- a/Heat_method_3/examples/Heat_method_3/heat_method_surface_mesh.cpp +++ b/Heat_method_3/examples/Heat_method_3/heat_method_surface_mesh.cpp @@ -39,20 +39,20 @@ int main(int argc, char* argv[]) Point_3 sp = tm.point(source); std::cout << "source: " << sp << " " << source << std::endl; - vertex_descriptor far; + vertex_descriptor vfar; double sdistance = 0; BOOST_FOREACH(vertex_descriptor vd , vertices(tm)){ std::cout << vd << " is at distance " << get(vertex_distance, vd) << " to " << source << std::endl; if(get(vertex_distance, vd) > sdistance){ - far = vd; + vfar = vd; sdistance = get(vertex_distance, vd); } } - std::cout << "far: " << tm.point(far) << " " << far << std::endl; + std::cout << "vfar: " << tm.point(vfar) << " " << vfar << std::endl; - hm.add_source(far); + hm.add_source(vfar); hm.estimate_geodesic_distances(vertex_distance); BOOST_FOREACH(vertex_descriptor vd , vertices(tm)){ diff --git a/Heat_method_3/test/Heat_method_3/heat_method_concept.cpp b/Heat_method_3/test/Heat_method_3/heat_method_concept.cpp index 6d0380520aa..717b54a2e66 100644 --- a/Heat_method_3/test/Heat_method_3/heat_method_concept.cpp +++ b/Heat_method_3/test/Heat_method_3/heat_method_concept.cpp @@ -43,19 +43,19 @@ int main() //Point_3 sp = sm.point(source); - vertex_descriptor far; + vertex_descriptor vfar; // double sdistance = 0; BOOST_FOREACH(vertex_descriptor vd , vertices(sm)){ std::cout << vd << " is at distance " << get(heat_intensity, vd) << " from " << source << std::endl; /* if(squared_distance(sp,sm.point(vd)) > sdistance){ - far = vd; + vfar = vd; sdistance = squared_distance(sp,sm.point(vd)); } */ } - hm.add_source(far); + hm.add_source(vfar); hm.estimate_geodesic_distances(heat_intensity); BOOST_FOREACH(vertex_descriptor vd , vertices(sm)){ diff --git a/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_direct_test.cpp b/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_direct_test.cpp index 22ee8fa083c..7118e73dbbc 100644 --- a/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_direct_test.cpp +++ b/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_direct_test.cpp @@ -37,19 +37,19 @@ int main(int argc, char* argv[]) Point_3 sp = sm.point(source); std::cout << "source: " << sp << " " << source << std::endl; - vertex_descriptor far; + vertex_descriptor vfar; double sdistance = 0; BOOST_FOREACH(vertex_descriptor vd , vertices(sm)){ if(get(vertex_distance,vd) > sdistance){ - far = vd; + vfar = vd; sdistance = get(vertex_distance,vd); } } assert(sdistance > 2.9); assert(sdistance < CGAL_PI); - hm.add_source(far); + hm.add_source(vfar); assert(hm.sources().size() == 2); hm.estimate_geodesic_distances(vertex_distance); @@ -63,7 +63,7 @@ int main(int argc, char* argv[]) assert(sdistance > 1.4); assert(sdistance < CGAL_PI/2.0); - hm.remove_source(far); + hm.remove_source(vfar); assert(hm.sources().size() == 1); hm.clear_sources(); @@ -71,7 +71,7 @@ int main(int argc, char* argv[]) // add range of sources std::vector vrange; vrange.push_back(source); - vrange.push_back(far); + vrange.push_back(vfar); hm.add_sources(vrange); assert(hm.sources().size() == 2); hm.estimate_geodesic_distances(vertex_distance); diff --git a/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_test.cpp b/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_test.cpp index 2cec29f4fda..f5c53f18df3 100644 --- a/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_test.cpp +++ b/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_test.cpp @@ -37,19 +37,19 @@ int main(int argc, char* argv[]) Point_3 sp = sm.point(source); std::cout << "source: " << sp << " " << source << std::endl; - vertex_descriptor far; + vertex_descriptor vfar; double sdistance = 0; BOOST_FOREACH(vertex_descriptor vd , vertices(sm)){ if(get(vertex_distance,vd) > sdistance){ - far = vd; + vfar = vd; sdistance = get(vertex_distance,vd); } } assert(sdistance > 2.9); assert(sdistance < CGAL_PI); - hm.add_source(far); + hm.add_source(vfar); assert(hm.sources().size() == 2); hm.estimate_geodesic_distances(vertex_distance); @@ -63,7 +63,7 @@ int main(int argc, char* argv[]) assert(sdistance > 1.4); assert(sdistance < CGAL_PI/2.0); - hm.remove_source(far); + hm.remove_source(vfar); assert(hm.sources().size() == 1); hm.clear_sources(); @@ -71,7 +71,7 @@ int main(int argc, char* argv[]) // add range of sources std::vector vrange; vrange.push_back(source); - vrange.push_back(far); + vrange.push_back(vfar); hm.add_sources(vrange); assert(hm.sources().size() == 2); hm.estimate_geodesic_distances(vertex_distance); diff --git a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/HDT2.cpp b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/HDT2.cpp index 135d3ee7148..980f10ae422 100644 --- a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/HDT2.cpp +++ b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/HDT2.cpp @@ -319,7 +319,7 @@ MainWindow::on_actionInsertRandomPoints_triggered() tr("Enter number of random points"), 100, 0, - std::numeric_limits::max(), + (std::numeric_limits::max)(), 1, &ok); diff --git a/Installation/cmake/modules/config/testfiles/CGAL_CFG_NO_LIMITS.cpp b/Installation/cmake/modules/config/testfiles/CGAL_CFG_NO_LIMITS.cpp index 57fbb21aac1..2ac65ba230a 100644 --- a/Installation/cmake/modules/config/testfiles/CGAL_CFG_NO_LIMITS.cpp +++ b/Installation/cmake/modules/config/testfiles/CGAL_CFG_NO_LIMITS.cpp @@ -32,7 +32,7 @@ int main() { double d = std::numeric_limits::denorm_min(); - double e = std::numeric_limits::min(); + double e = (std::numeric_limits::min)(); // Note : denorm_min == min is actually not necessarily a bug. // So a better test should be found. if (d == 0 || d == e) diff --git a/Kernel_23/include/CGAL/Dimension.h b/Kernel_23/include/CGAL/Dimension.h index b1125b02456..d0175539977 100644 --- a/Kernel_23/include/CGAL/Dimension.h +++ b/Kernel_23/include/CGAL/Dimension.h @@ -34,7 +34,7 @@ namespace CGAL { #ifdef CGAL_EIGEN3_ENABLED const int UNKNOWN_DIMENSION=Eigen::Dynamic; #elif defined CGAL_CXX11 -const int UNKNOWN_DIMENSION=std::numeric_limits::max(); +const int UNKNOWN_DIMENSION=(std::numeric_limits::max)(); #else const int UNKNOWN_DIMENSION=(unsigned)-1/2; #endif diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/IO_off.cpp b/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/IO_off.cpp index 3f77147c898..e89b6ae570f 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/IO_off.cpp +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/IO_off.cpp @@ -71,7 +71,7 @@ bool read_off_ascii(Surface_mesh& mesh, // #Vertice, #Faces, #Edges items = fscanf(in, "%d %d %d\n", (int*)&nV, (int*)&nF, (int*)&nE); mesh.clear(); - mesh.reserve(nV, std::max(3*nV, nE), nF); + mesh.reserve(nV, (std::max)(3*nV, nE), nF); // read vertices: pos [normal] [color] [texcoord] @@ -186,7 +186,7 @@ bool read_off_binary(Surface_mesh& mesh, read(in, nF); read(in, nE); mesh.clear(); - mesh.reserve(nV, std::max(3*nV, nE), nF); + mesh.reserve(nV, (std::max)(3*nV, nE), nF); // read vertices: pos [normal] [color] [texcoord] diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/Vector.h b/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/Vector.h index e35ec734e06..205b880c23d 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/Vector.h +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/Vector.h @@ -223,7 +223,7 @@ public: Vector& normalize() { Scalar n = norm(*this); - if (n > std::numeric_limits::min()) + if (n > (std::numeric_limits::min)()) *this *= 1.0/n; return *this; } @@ -513,7 +513,7 @@ public: Vector& normalize() { Scalar n = norm(*this); - n = (n > std::numeric_limits::min()) ? 1.0/n : 0.0; + n = (n > (std::numeric_limits::min)()) ? 1.0/n : 0.0; x *= n; y *= n; z *= n; diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_3/cgogn_performance_3.h b/Linear_cell_complex/benchmark/Linear_cell_complex_3/cgogn_performance_3.h index b780ccd231d..fd91d3dde0a 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_3/cgogn_performance_3.h +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_3/cgogn_performance_3.h @@ -63,7 +63,7 @@ private: Dart getShortestEdge() { - double weight = std::numeric_limits::max(); + double weight = (std::numeric_limits::max)(); Dart dart = NIL; bool boundary=false; diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_3/lcc_performance_3.h b/Linear_cell_complex/benchmark/Linear_cell_complex_3/lcc_performance_3.h index f8f7f40b876..2ec36b617d9 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_3/lcc_performance_3.h +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_3/lcc_performance_3.h @@ -319,7 +319,7 @@ private: Dart_handle getShortestEdge() { - double weight = std::numeric_limits::max(); + double weight = (std::numeric_limits::max)(); Dart_handle dart = lcc.null_dart_handle; int m=lcc.get_new_mark(); diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_3/openvolumemesh_performance.h b/Linear_cell_complex/benchmark/Linear_cell_complex_3/openvolumemesh_performance.h index 929d9ff8313..f9a30b83476 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_3/openvolumemesh_performance.h +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_3/openvolumemesh_performance.h @@ -129,7 +129,7 @@ private: // Find the mesh's shortest edge EdgeHandle getShortestEdge() { - double max_weight = std::numeric_limits::max(); + double max_weight = (std::numeric_limits::max)(); EdgeHandle eh = Mesh::InvalidEdgeHandle; bool boundary=false; diff --git a/Mesh_3/archive/applications/CGAL/min_dihedral_angle.h b/Mesh_3/archive/applications/CGAL/min_dihedral_angle.h index 0be12960c89..267607232b1 100644 --- a/Mesh_3/archive/applications/CGAL/min_dihedral_angle.h +++ b/Mesh_3/archive/applications/CGAL/min_dihedral_angle.h @@ -41,15 +41,15 @@ class Compute_min_angle operator()(const Cell_handle ch) const { double min_quotient = compute_quotient(ch, 0, 1, 2, 3); - min_quotient = std::min(min_quotient, + min_quotient = (std::min)(min_quotient, compute_quotient(ch, 0, 2, 1, 3)); - min_quotient = std::min(min_quotient, + min_quotient = (std::min)(min_quotient, compute_quotient(ch, 0, 3, 1, 2)); - min_quotient = std::min(min_quotient, + min_quotient = (std::min)(min_quotient, compute_quotient(ch, 1, 2, 0, 3)); - min_quotient = std::min(min_quotient, + min_quotient = (std::min)(min_quotient, compute_quotient(ch, 1, 3, 0, 2)); - min_quotient = std::min(min_quotient, + min_quotient = (std::min)(min_quotient, compute_quotient(ch, 2, 3, 0, 1)); const double volume = CGAL::to_double(tr.tetrahedron(ch).volume()); @@ -128,19 +128,19 @@ namespace CGAL { min_dihedral_angle_aux_compute_quotient(p0, p1, p2, p3, k); min_quotient = - std::min(min_quotient, + (std::min)(min_quotient, min_dihedral_angle_aux_compute_quotient(p0, p2, p1, p3, k)); min_quotient = - std::min(min_quotient, + (std::min)(min_quotient, min_dihedral_angle_aux_compute_quotient(p0, p3, p1, p2, k)); min_quotient = - std::min(min_quotient, + (std::min)(min_quotient, min_dihedral_angle_aux_compute_quotient(p1, p2, p0, p3, k)); min_quotient = - std::min(min_quotient, + (std::min)(min_quotient, min_dihedral_angle_aux_compute_quotient(p1, p3, p0, p2, k)); min_quotient = - std::min(min_quotient, + (std::min)(min_quotient, min_dihedral_angle_aux_compute_quotient(p2, p3, p0, p1, k)); // std::cerr << CGAL::sqrt(min_quotient) << " - " diff --git a/Mesh_3/include/CGAL/Mesh_3/Sizing_grid.h b/Mesh_3/include/CGAL/Mesh_3/Sizing_grid.h index f90aab595b5..ff7f36b7694 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Sizing_grid.h +++ b/Mesh_3/include/CGAL/Mesh_3/Sizing_grid.h @@ -452,7 +452,7 @@ private: pNode->ref_node(candidate.ref_node()); pNode->size() = candidate.size(); pNode->done() = true; - m_max_size = std::max(m_max_size,pNode->size()); + m_max_size = (std::max)(m_max_size,pNode->size()); // explore neighbors for(unsigned int index_neighbor = 0; diff --git a/Nef_3/archive/Visual_hull/Nef_3/visual_hull_creator.h b/Nef_3/archive/Visual_hull/Nef_3/visual_hull_creator.h index 244da5108ae..857c5af1736 100644 --- a/Nef_3/archive/Visual_hull/Nef_3/visual_hull_creator.h +++ b/Nef_3/archive/Visual_hull/Nef_3/visual_hull_creator.h @@ -87,9 +87,9 @@ class visual_hull_creator : public CGAL::Modifier_base { public: - visual_hull_creator(Point_3 min, Point_3 max, Point_3 position, + visual_hull_creator(Point_3 pmin, Point_3 pmax, Point_3 position, std::list > p) : - room_min(min), room_max(max), c_pos(position), polygon_list(p) { } + room_min(pmin), room_max(pmax), c_pos(position), polygon_list(p) { } /* void recompute_scene() { diff --git a/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h b/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h index 152df61e4b3..e2cc3a6e199 100644 --- a/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h +++ b/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h @@ -384,24 +384,24 @@ class Infimaximal_box { C.create_vertices_of_box_with_plane(h, b); } - static void compute_min_max(const Plane_3& h, NT orth_coords[3], int& min, int& max) { + static void compute_min_max(const Plane_3& h, NT orth_coords[3], int& cmin, int& cmax) { Vector_3 orth = h.orthogonal_vector(); orth_coords[0] = CGAL_NTS abs(orth.hx()[0]); orth_coords[1] = CGAL_NTS abs(orth.hy()[0]); orth_coords[2] = CGAL_NTS abs(orth.hz()[0]); - max = 0; + cmax = 0; if(orth_coords[1] > orth_coords[0]) - max = 1; - if(orth_coords[2] > orth_coords[max]) - max = 2; + cmax = 1; + if(orth_coords[2] > orth_coords[cmax]) + cmax = 2; - min = 0; + cmin = 0; if(orth_coords[1] < orth_coords[0]) - min = 1; - if(orth_coords[2] < orth_coords[min]) - min = 2; + cmin = 1; + if(orth_coords[2] < orth_coords[cmin]) + cmin = 2; } template diff --git a/Number_types/include/CGAL/Quotient.h b/Number_types/include/CGAL/Quotient.h index ba42b3ebf53..c46588f7567 100644 --- a/Number_types/include/CGAL/Quotient.h +++ b/Number_types/include/CGAL/Quotient.h @@ -172,7 +172,7 @@ class Quotient } #ifdef CGAL_ROOT_OF_2_ENABLE_HISTOGRAM_OF_NUMBER_OF_DIGIT_ON_THE_COMPLEX_CONSTRUCTOR - int tam() const { return std::max(num.tam(), den.tam()); } + int tam() const { return (std::max)(num.tam(), den.tam()); } #endif public: diff --git a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/IO/File_medit.h b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/IO/File_medit.h index 0c1bbb339e5..6619151c819 100644 --- a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/IO/File_medit.h +++ b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/IO/File_medit.h @@ -52,9 +52,9 @@ canonicalize_triangle(const typename Triangulation::Periodic_triangle& pt) Offset o0 = pt[0].second; Offset o1 = pt[1].second; Offset o2 = pt[2].second; - int diffx = std::min(o0.x(), std::min(o1.x(), o2.x())); - int diffy = std::min(o0.y(), std::min(o1.y(), o2.y())); - int diffz = std::min(o0.z(), std::min(o1.z(), o2.z())); + int diffx = (std::min)(o0.x(), (std::min)(o1.x(), o2.x())); + int diffy = (std::min)(o0.y(), (std::min)(o1.y(), o2.y())); + int diffz = (std::min)(o0.z(), (std::min)(o1.z(), o2.z())); Offset diff_off(diffx, diffy, diffz); return CGAL::make_array(std::make_pair(pt[0].first, o0 - diff_off), @@ -73,9 +73,9 @@ canonicalize_tetrahedron(const typename Triangulation::Periodic_tetrahedron& pt) Offset o2 = pt[2].second; Offset o3 = pt[3].second; - int diffx = std::min(std::min(o0.x(), o1.x()), std::min(o2.x(), o3.x())); - int diffy = std::min(std::min(o0.y(), o1.y()), std::min(o2.y(), o3.y())); - int diffz = std::min(std::min(o0.z(), o1.z()), std::min(o2.z(), o3.z())); + int diffx = (std::min)((std::min)(o0.x(), o1.x()), (std::min)(o2.x(), o3.x())); + int diffy = (std::min)((std::min)(o0.y(), o1.y()), (std::min)(o2.y(), o3.y())); + int diffz = (std::min)((std::min)(o0.z(), o1.z()), (std::min)(o2.z(), o3.z())); Offset diff_off(diffx, diffy, diffz); return CGAL::make_array(std::make_pair(pt[0].first, o0 - diff_off), diff --git a/Periodic_3_mesh_3/test/Periodic_3_mesh_3/test_triply_periodic_minimal_surfaces.cpp b/Periodic_3_mesh_3/test/Periodic_3_mesh_3/test_triply_periodic_minimal_surfaces.cpp index e7ff3beeacb..812fde428ba 100644 --- a/Periodic_3_mesh_3/test/Periodic_3_mesh_3/test_triply_periodic_minimal_surfaces.cpp +++ b/Periodic_3_mesh_3/test/Periodic_3_mesh_3/test_triply_periodic_minimal_surfaces.cpp @@ -184,18 +184,18 @@ struct Segments_function Segments_function() : segments(), nb_evals(0) { - const FT min = 1, max = 3; - const FT mid = 0.5 * (min + max); + const FT vmin = 1, vmax = 3; + const FT mid = 0.5 * (vmin + vmax); const Point pmid(mid, mid, mid); - segments.push_back(Segment(Point(min, mid, min), pmid)); - segments.push_back(Segment(Point(max, mid, min), pmid)); - segments.push_back(Segment(Point(min, mid, max), pmid)); - segments.push_back(Segment(Point(max, mid, max), pmid)); - segments.push_back(Segment(Point(mid, min, min), pmid)); - segments.push_back(Segment(Point(mid, max, min), pmid)); - segments.push_back(Segment(Point(mid, min, max), pmid)); - segments.push_back(Segment(Point(mid, max, max), pmid)); + segments.push_back(Segment(Point(vmin, mid, vmin), pmid)); + segments.push_back(Segment(Point(vmax, mid, vmin), pmid)); + segments.push_back(Segment(Point(vmin, mid, vmax), pmid)); + segments.push_back(Segment(Point(vmax, mid, vmax), pmid)); + segments.push_back(Segment(Point(mid, vmin, vmin), pmid)); + segments.push_back(Segment(Point(mid, vmax, vmin), pmid)); + segments.push_back(Segment(Point(mid, vmin, vmax), pmid)); + segments.push_back(Segment(Point(mid, vmax, vmax), pmid)); } FT operator()(const Point& p) @@ -204,7 +204,7 @@ struct Segments_function FT min_distance = 1000000; for (Segments::const_iterator si = segments.begin(); si != segments.end(); ++si) - min_distance = std::min(CGAL::squared_distance(p, *si), min_distance); + min_distance = (std::min)(CGAL::squared_distance(p, *si), min_distance); return min_distance - 0.01; // Change the squared beam radius here } diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_periodic_3_static_filters.h b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_periodic_3_static_filters.h index 2177fbf51b7..6dfb3273e4d 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_periodic_3_static_filters.h +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_periodic_3_static_filters.h @@ -70,17 +70,17 @@ Point my_rand_p3() } // Random int in [0;256). -int my_rand_int(int min, int max) +int my_rand_int(int imin, int imax) { - return r->get_int(min, max+1); + return r->get_int(imin, imax+1); } // Random offset -Offset my_rand_o3(int min, int max) +Offset my_rand_o3(int imin, int imax) { - int x = my_rand_int(min,max); - int y = my_rand_int(min,max); - int z = my_rand_int(min,max); + int x = my_rand_int(imin,imax); + int y = my_rand_int(imin,imax); + int z = my_rand_int(imin,imax); return Offset(x, y, z); } diff --git a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/P4HDT2.cpp b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/P4HDT2.cpp index ffaf11c3eff..9df877ad6e0 100644 --- a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/P4HDT2.cpp +++ b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/P4HDT2.cpp @@ -351,7 +351,7 @@ MainWindow::on_actionInsertRandomPoints_triggered() tr("Enter number of random points"), 100, 0, - std::numeric_limits::max(), + (std::numeric_limits::max)(), 1, &ok); diff --git a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2.h b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2.h index 5590147bd85..6785c06cca6 100644 --- a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2.h +++ b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2.h @@ -617,15 +617,15 @@ protected: } // Now we know that all vertices lie in different regions. - Hyperbolic_translation min(7, 2, 5); + Hyperbolic_translation vmin(7, 2, 5); Hyperbolic_translation trans; for(int i=0; i<3; ++i) { int j = (i + 1) % 3; // the index of the 'next' vertex Hyperbolic_translation tmp = fh->translation(i).inverse() * fh->translation(j); - if(tmp < min) + if(tmp < vmin) { - min = tmp; + vmin = tmp; trans = fh->translation(i).inverse(); } } diff --git a/Point_set_shape_detection_3/test/Point_set_shape_detection_3/generators.h b/Point_set_shape_detection_3/test/Point_set_shape_detection_3/generators.h index 7162250c8a9..9c62844b859 100644 --- a/Point_set_shape_detection_3/test/Point_set_shape_detection_3/generators.h +++ b/Point_set_shape_detection_3/test/Point_set_shape_detection_3/generators.h @@ -10,8 +10,8 @@ template -fl_t random_float(fl_t min, fl_t max) { - return fl_t(CGAL::get_default_random().get_double(min, max)); +fl_t random_float(fl_t fmin, fl_t fmax) { + return fl_t(CGAL::get_default_random().get_double(fmin, fmax)); } template 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 818b9c038d8..f2ef71f3623 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 @@ -61,9 +61,9 @@ class Traversal_traits_with_transformation_helper AK::Aff_transformation_3 a_at = c2f(at); - AK::FT xtrm[6] = { c2f(bbox.min(0)), c2f(bbox.max(0)), - c2f(bbox.min(1)), c2f(bbox.max(1)), - c2f(bbox.min(2)), c2f(bbox.max(2)) }; + AK::FT xtrm[6] = { c2f((bbox.min)(0)), c2f((bbox.max)(0)), + c2f((bbox.min)(1)), c2f((bbox.max)(1)), + c2f((bbox.min)(2)), c2f((bbox.max)(2)) }; typename AK::Point_3 ps[8]; ps[0] = a_at( AK::Point_3(xtrm[0], xtrm[2], xtrm[4]) ); @@ -93,9 +93,9 @@ class Traversal_traits_with_transformation_helper AK::Aff_transformation_3 a_at = c2f(at); - AK::FT xtrm[6] = { c2f(bbox.min(0)), c2f(bbox.max(0)), - c2f(bbox.min(1)), c2f(bbox.max(1)), - c2f(bbox.min(2)), c2f(bbox.max(2)) }; + AK::FT xtrm[6] = { c2f((bbox.min)(0)), c2f((bbox.max)(0)), + c2f((bbox.min)(1)), c2f((bbox.max)(1)), + c2f((bbox.min)(2)), c2f((bbox.max)(2)) }; typename AK::Point_3 ps[2]; ps[0] = a_at( AK::Point_3(xtrm[0], xtrm[2], xtrm[4]) ); diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index f02434647b5..5bc7025933b 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -965,7 +965,6 @@ void MainWindow::updateViewerBBox(bool recenter = true) for(int i=0; i<3; ++i) { offset[i] = -bbox_center[i]; - } if(offset != viewer->offset()) { diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp index 42102db77fa..3f77fe4efff 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp @@ -527,7 +527,7 @@ void Cluster_classification::change_color (int index, float* vmin, float* vmax) int cid = m_cluster_id[*it]; if (cid != -1) { - float v = std::max (0.f, std::min(1.f, m_label_probabilities[corrected_index][cid])); + float v = std::max (0.f, (std::min)(1.f, m_label_probabilities[corrected_index][cid])); m_points->point_set()->set_color(*it, ramp.r(v) * 255, ramp.g(v) * 255, ramp.b(v) * 255); } else @@ -546,8 +546,8 @@ void Cluster_classification::change_color (int index, float* vmin, float* vmax) Feature_handle feature = m_features[corrected_index]; - float min = std::numeric_limits::max(); - float max = -std::numeric_limits::max(); + float min = (std::numeric_limits::max)(); + float max = -(std::numeric_limits::max)(); if (vmin != NULL && vmax != NULL && *vmin != std::numeric_limits::infinity() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp index 2d1d0e007f7..08e253b9729 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp @@ -429,7 +429,7 @@ void Point_set_item_classification::change_color (int index, float* vmin, float* for (Point_set::const_iterator it = m_points->point_set()->begin(); it != m_points->point_set()->first_selected(); ++ it) { - float v = std::max (0.f, std::min(1.f, m_label_probabilities[corrected_index][*it])); + float v = std::max (0.f, (std::min)(1.f, m_label_probabilities[corrected_index][*it])); m_points->point_set()->set_color(*it, ramp.r(v) * 255, ramp.g(v) * 255, ramp.b(v) * 255); } } @@ -444,8 +444,8 @@ void Point_set_item_classification::change_color (int index, float* vmin, float* } Feature_handle feature = m_features[corrected_index]; - float min = std::numeric_limits::max(); - float max = -std::numeric_limits::max(); + float min = (std::numeric_limits::max)(); + float max = -(std::numeric_limits::max)(); if (vmin != NULL && vmax != NULL && *vmin != std::numeric_limits::infinity() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.h b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.h index 4811a071c58..03b470278b2 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.h @@ -125,8 +125,8 @@ class Point_set_item_classification : public Item_classification_base for (std::size_t i = 0; i < m_features.size(); ++ i) { - float vmin = std::numeric_limits::max(); - float vmax = -std::numeric_limits::max(); + float vmin = (std::numeric_limits::max)(); + float vmax = -(std::numeric_limits::max)(); float vmean = 0.f; std::size_t nb = 0; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp index 8ce32e699cd..1d033c02fdb 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp @@ -151,7 +151,7 @@ void Surface_mesh_item_classification::change_color (int index, float* vmin, flo { BOOST_FOREACH(face_descriptor fd, faces(*(m_mesh->polyhedron()))) { - float v = std::max (0.f, std::min(1.f, m_label_probabilities[corrected_index][fd])); + float v = std::max (0.f, (std::min)(1.f, m_label_probabilities[corrected_index][fd])); m_color[fd] = CGAL::Color((unsigned char)(ramp.r(v) * 255), (unsigned char)(ramp.g(v) * 255), (unsigned char)(ramp.b(v) * 255)); @@ -169,8 +169,8 @@ void Surface_mesh_item_classification::change_color (int index, float* vmin, flo Feature_handle feature = m_features[corrected_index]; - float min = std::numeric_limits::max(); - float max = -std::numeric_limits::max(); + float min = (std::numeric_limits::max)(); + float max = -(std::numeric_limits::max)(); if (vmin != NULL && vmax != NULL && *vmin != std::numeric_limits::infinity() diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp index 57b23a66f33..13bf84315e3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp @@ -116,9 +116,9 @@ bool Create_bbox_mesh_plugin::bbox(bool extended) bbox.zmax() + delta_z); } - if(bbox.min(0) > bbox.max(0) || - bbox.min(1) > bbox.max(1) || - bbox.min(2) > bbox.max(2)) + if((bbox.min)(0) > (bbox.max)(0) || + (bbox.min)(1) > (bbox.max)(1) || + (bbox.min)(2) > (bbox.max)(2)) { return false; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp index 8f391dd1213..94ff02436e1 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp @@ -540,16 +540,15 @@ void Scene_edit_box_item::compute_bbox() const const CGAL::qglviewer::Vec offset = static_cast(CGAL::QGLViewer::QGLViewerPool().first())->offset(); - QVector3D min(d->pool[0], d->pool[1], d->pool[2]); - QVector3D max(d->pool[3], d->pool[4], d->pool[5]); + QVector3D vmin(d->pool[0], d->pool[1], d->pool[2]); + QVector3D vmax(d->pool[3], d->pool[4], d->pool[5]); for(int i=0; i< 3; ++i) { - min[i] += d->frame->translation()[i]-d->center_[i]-offset[i]; - max[i] += d->frame->translation()[i]-d->center_[i]-offset[i]; + vmin[i] += d->frame->translation()[i]-d->center_[i]-offset[i]; + vmax[i] += d->frame->translation()[i]-d->center_[i]-offset[i]; } - - _bbox = Scene_item::Bbox(min.x(),min.y(),min.z(),max.x(),max.y(),max.z()); + _bbox = Scene_item::Bbox(vmin.x(),vmin.y(),vmin.z(),vmax.x(),vmax.y(),vmax.z()); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 27412ec9cb4..783f321416b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -485,10 +485,10 @@ public Q_SLOTS: } std::cout << "Parameterized with ARAP (SM) computed." << std::endl; - xmin = std::numeric_limits::max(); - xmax = std::numeric_limits::min(); - ymin = std::numeric_limits::max(); - ymax = std::numeric_limits::min(); + xmin = (std::numeric_limits::max)(); + xmax = (std::numeric_limits::min)(); + ymin = (std::numeric_limits::max)(); + ymax = (std::numeric_limits::min)(); uv_map_3 = sm->add_property_map("v:uv3").first; for(SMesh::Vertex_index v : sm->vertices()) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp index 4d2a8197bb2..54725385fd4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp @@ -306,7 +306,7 @@ void Polyhedron_demo_mesh_segmentation_plugin::apply_Partition_button_clicked(Fa faces(*pair->first->face_graph())) { if(sdf_pmap[f] != -1 - && sdf_pmap[f] != std::numeric_limits::max()) + && sdf_pmap[f] != (std::numeric_limits::max)()) { has_sdf_values = true; break; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp index 4fbef08e1cc..94b2278a79a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp @@ -150,7 +150,7 @@ void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered() : 0), (ui.m_use_edge_length->isChecked() ? ui.m_edge_length->value() - : std::numeric_limits::max())); + : (std::numeric_limits::max)())); if (selection_item) { diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp index ce32dc1aa98..d2c0f2de15e 100644 --- a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp @@ -438,10 +438,10 @@ struct Scene_c3t3_item_priv { void invalidate_stats() { - min_edges_length = std::numeric_limits::max(); + min_edges_length = (std::numeric_limits::max)(); max_edges_length = 0; mean_edges_length = 0; - min_dihedral_angle = std::numeric_limits::max(); + min_dihedral_angle = (std::numeric_limits::max)(); max_dihedral_angle = 0; mean_dihedral_angle = 0; nb_subdomains = 0; @@ -449,8 +449,8 @@ struct Scene_c3t3_item_priv { nb_cnc = 0; nb_vertices = 0; nb_tets = 0; - smallest_radius_radius = std::numeric_limits::max(); - smallest_edge_radius = std::numeric_limits::max(); + smallest_radius_radius = (std::numeric_limits::max)(); + smallest_edge_radius = (std::numeric_limits::max)(); biggest_v_sma_cube = 0; computed_stats = false; } diff --git a/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp index f2f21725831..36a9105b21c 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp @@ -30,7 +30,7 @@ struct Scene_polylines_item_private { { nb_vertices = 0; nb_edges = 0; - min_length = std::numeric_limits::max(); + min_length = (std::numeric_limits::max)(); max_length = 0; mean_length = 0; computed_stats = false; diff --git a/Polynomial/include/CGAL/Polynomial/bezout_matrix.h b/Polynomial/include/CGAL/Polynomial/bezout_matrix.h index 1c2528cee90..4105a0a9cf3 100644 --- a/Polynomial/include/CGAL/Polynomial/bezout_matrix.h +++ b/Polynomial/include/CGAL/Polynomial/bezout_matrix.h @@ -118,8 +118,8 @@ hybrid_bezout_matrix(typename Polynomial_traits_d::Polynomial_d f, B[i-sub-1][j-1] = s; } } - for (i = std::max(m+1, 1+sub); i <= n; i++) { - for (j = i-m; j <= std::min(i, n-sub); j++) { + for (i = (std::max)(m+1, 1+sub); i <= n; i++) { + for (j = i-m; j <= (std::min)(i, n-sub); j++) { B[i-sub-1][j-1] = coeff(g,i-j); } } diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/test.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/test.h index f0aa2dffea5..d6da26057a6 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/test.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/test.h @@ -146,8 +146,8 @@ inline bool is_time_clearly_not_within_possibly_inexact_bisector_time_interval( { FT lSrcT = aBisector->opposite()->vertex()->time() ; FT lTgtT = aBisector->vertex()->time() ; - FT lLoT = std::min(lSrcT,lTgtT); - FT lHiT = std::max(lSrcT,lTgtT); + FT lLoT = (std::min)(lSrcT,lTgtT); + FT lHiT = (std::max)(lSrcT,lTgtT); return ( aT < lLoT || aT > lHiT ) && is_possibly_inexact_time_clearly_not_equal_to(aT,lLoT) @@ -159,8 +159,8 @@ inline bool is_time_clearly_within_possibly_inexact_bisector_time_interval( FT c { FT lSrcT = aBisector->opposite()->vertex()->time() ; FT lTgtT = aBisector->vertex()->time() ; - FT lLoT = std::min(lSrcT,lTgtT); - FT lHiT = std::max(lSrcT,lTgtT); + FT lLoT = (std::min)(lSrcT,lTgtT); + FT lHiT = (std::max)(lSrcT,lTgtT); return ( lLoT < aT && aT < lHiT ) && is_possibly_inexact_time_clearly_not_equal_to(aT,lLoT) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Properties.h b/Surface_mesh/include/CGAL/Surface_mesh/Properties.h index b3733031b9a..38d209f78a1 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Properties.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Properties.h @@ -449,7 +449,7 @@ public: { for (std::size_t i=0; ireserve(n); - capacity_ = std::max(n, capacity_); + capacity_ = (std::max)(n, capacity_); } // resize all arrays to size n @@ -474,7 +474,7 @@ public: for (std::size_t i=0; ipush_back(); ++size_; - capacity_ = (std::max(size_, capacity_)); + capacity_ = ((std::max)(size_, capacity_)); } // reset element to its default property values diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index 395312d7e3d..80d6d49f318 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -74,17 +74,17 @@ namespace CGAL { typedef boost::uint32_t size_type; /// Constructor. %Default construction creates an invalid index. /// We write -1, which is - /// std::numeric_limits::max() + /// (std::numeric_limits::max)() /// as `size_type` is an unsigned type. explicit SM_Index(size_type _idx=(std::numeric_limits::max)()) : idx_(_idx) {} /// Get the underlying index of this index operator size_type() const { return idx_; } - /// reset index to be invalid (index=std::numeric_limits::max()) + /// reset index to be invalid (index=(std::numeric_limits::max)()) void reset() { idx_=(std::numeric_limits::max)(); } - /// return whether the index is valid, i.e., the index is not equal to `%std::numeric_limits::max()`. + /// return whether the index is valid, i.e., the index is not equal to `%(std::numeric_limits::max)()`. bool is_valid() const { size_type inf = (std::numeric_limits::max)(); return idx_ != inf; @@ -222,10 +222,10 @@ namespace CGAL { // compatibility with OpenMesh handles size_type idx() const { return (size_type)halfedge_ / 2; } - // resets index to be invalid (index=std::numeric_limits::max()) + // resets index to be invalid (index=(std::numeric_limits::max)()) void reset() { halfedge_.reset(); } - // returns whether the index is valid, i.e., the index is not equal to std::numeric_limits::max(). + // returns whether the index is valid, i.e., the index is not equal to (std::numeric_limits::max)(). bool is_valid() const { return halfedge_.is_valid(); } // Are two indices equal? diff --git a/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h b/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h index 6dd715ff50a..9b2be7c7ac8 100644 --- a/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h +++ b/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h @@ -64,7 +64,7 @@ #include #endif -#define CGAL_VSA_INVALID_TAG std::numeric_limits::max() +#define CGAL_VSA_INVALID_TAG (std::numeric_limits::max)() namespace CGAL { diff --git a/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp b/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp index 00465148257..412d7ed844f 100644 --- a/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp +++ b/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp @@ -99,8 +99,8 @@ public: } else { - m_minimum = std::min(m_minimum, sample); - m_maximum = std::max(m_maximum, sample); + m_minimum = (std::min)(m_minimum, sample); + m_maximum = (std::max)(m_maximum, sample); } m_sum += sample; ++m_numSamples; @@ -227,7 +227,7 @@ void run_benchmarks(CGAL::Random& rand, size_t numTrials, size_t numSources, siz outData.constructionTime.add_sample(elapsed.wall); #if !defined(NDEBUG) - outData.peakMemoryUsage.add_sample(std::max(shortestPaths.peak_memory_usage(), shortestPaths.current_memory_usage())); + outData.peakMemoryUsage.add_sample((std::max)(shortestPaths.peak_memory_usage(), shortestPaths.current_memory_usage())); #endif for (size_t j = 0; j < numQueries; ++j) @@ -333,4 +333,4 @@ int main(int argc, char* argv[]) } return EXIT_SUCCESS; -} \ No newline at end of file +} diff --git a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h index 4b7f8cb5d3d..6fc2b2567d7 100644 --- a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h +++ b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h @@ -422,7 +422,7 @@ public: + (sizeof(Cone_expansion_event) + (sizeof(Cone_expansion_event*)) * m_peakQueueSize) + (sizeof(Cone_tree_node) * m_nodesAtPeakQueue); - return std::max(peakNodeUsage, peakQueueUsage); + return (std::max)(peakNodeUsage, peakQueueUsage); } /// \endcond diff --git a/Surface_mesher/archive/include/CGAL/enriched_polyhedron.h b/Surface_mesher/archive/include/CGAL/enriched_polyhedron.h index 2025d1a503f..52da4bec21c 100644 --- a/Surface_mesher/archive/include/CGAL/enriched_polyhedron.h +++ b/Surface_mesher/archive/include/CGAL/enriched_polyhedron.h @@ -332,13 +332,13 @@ public : { const Point& p = pVertex->point(); - xmin = std::min(xmin,p.x()); - ymin = std::min(ymin,p.y()); - zmin = std::min(zmin,p.z()); + xmin = (std::min)(xmin,p.x()); + ymin = (std::min)(ymin,p.y()); + zmin = (std::min)(zmin,p.z()); - xmax = std::max(xmax,p.x()); - ymax = std::max(ymax,p.y()); - zmax = std::max(zmax,p.z()); + xmax = (std::max)(xmax,p.x()); + ymax = (std::max)(ymax,p.y()); + zmax = (std::max)(zmax,p.z()); } m_bbox = Iso_cuboid(xmin,ymin,zmin, xmax,ymax,zmax); diff --git a/Surface_mesher/include/CGAL/vtkSurfaceMesherContourFilter.h b/Surface_mesher/include/CGAL/vtkSurfaceMesherContourFilter.h index e4c04b534ca..c14fe6789b7 100644 --- a/Surface_mesher/include/CGAL/vtkSurfaceMesherContourFilter.h +++ b/Surface_mesher/include/CGAL/vtkSurfaceMesherContourFilter.h @@ -139,8 +139,8 @@ int vtkCGALSurfaceMesherContourFilter::RequestData( return 0; Gray_level_image gray_level_image(image, Value); - GT::FT radius = std::max(image.xdim() * image.vx(), - std::max(image.ydim() * image.vy(), + GT::FT radius = (std::max)(image.xdim() * image.vx(), + (std::max)(image.ydim() * image.vy(), image.zdim() * image.vz()) ); GT::Sphere_3 bounding_sphere(GT::Point_3(image.xdim() * image.vx()/2., diff --git a/Triangulation/include/CGAL/internal/Combination_enumerator.h b/Triangulation/include/CGAL/internal/Combination_enumerator.h index c949e8e66ad..e8598410d50 100644 --- a/Triangulation/include/CGAL/internal/Combination_enumerator.h +++ b/Triangulation/include/CGAL/internal/Combination_enumerator.h @@ -46,11 +46,11 @@ public: // For generating all the combinations of |k| distinct elements in the // interval [min, max] (both included) - Combination_enumerator(const int k, const int min, const int max) - : combi_(k), k_(k), min_(min), max_(max), max_at_pos_0_(max + 1 - k) + Combination_enumerator(const int k, const int imin, const int imax) + : combi_(k), k_(k), min_(imin), max_(imax), max_at_pos_0_(imax + 1 - k) { - CGAL_assertion_msg( min <= max, "min is larger than max"); - CGAL_assertion_msg( 1 <= k && k <= ( max - min + 1 ), "wrong value of k"); + CGAL_assertion_msg( imin <= imax, "min is larger than max"); + CGAL_assertion_msg( 1 <= k && k <= ( imax - imin + 1 ), "wrong value of k"); init(); } From 5b2d46cfa0ce85d06e5614e56f12d3e977e059d5 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 21 Apr 2020 10:03:00 +0200 Subject: [PATCH 2/8] Fixes for min/max --- AABB_tree/demo/AABB_tree/Scene.cpp | 10 +- AABB_tree/demo/AABB_tree/Scene.h | 2 +- .../ArrangementDemoGraphicsView.cpp | 8 +- .../CGAL/Curved_kernel_via_analysis_2/Arc_2.h | 8 +- .../gfx/Curve_renderer_2.h | 6 +- .../test_extensive/stability/stability.cpp | 4 +- .../demo/CGAL_ipelets/alpha_shapes.cpp | 2 +- CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp | 2 +- .../Feature/Cluster_vertical_extent.h | 4 +- .../CGAL/Classification/Feature/Elevation.h | 6 +- .../Classification/Feature/Height_above.h | 4 +- .../Classification/Feature/Height_below.h | 4 +- .../Classification/Feature/Vertical_range.h | 8 +- .../CGAL/Classification/compressed_float.h | 8 +- .../include/CGAL/Combinatorial_map.h | 409 ++++++++++++++---- .../Coplanar_side_of_bounded_circle_3.h | 2 +- .../heat_method_surface_mesh.cpp | 8 +- .../Heat_method_3/heat_method_concept.cpp | 6 +- .../heat_method_surface_mesh_direct_test.cpp | 10 +- .../heat_method_surface_mesh_test.cpp | 10 +- .../demo/Hyperbolic_triangulation_2/HDT2.cpp | 2 +- .../config/testfiles/CGAL_CFG_NO_LIMITS.cpp | 2 +- Kernel_23/include/CGAL/Dimension.h | 2 +- .../surface_mesh/IO_off.cpp | 4 +- .../surface_mesh/Vector.h | 4 +- .../cgogn_performance_3.h | 2 +- .../Linear_cell_complex_3/lcc_performance_3.h | 2 +- .../openvolumemesh_performance.h | 2 +- .../applications/CGAL/min_dihedral_angle.h | 20 +- Mesh_3/include/CGAL/Mesh_3/Sizing_grid.h | 2 +- .../Visual_hull/Nef_3/visual_hull_creator.h | 4 +- Nef_3/include/CGAL/Nef_3/Infimaximal_box.h | 18 +- Number_types/include/CGAL/Quotient.h | 2 +- .../CGAL/Periodic_3_mesh_3/IO/File_medit.h | 12 +- .../test_triply_periodic_minimal_surfaces.cpp | 22 +- .../CGAL/_test_periodic_3_static_filters.h | 12 +- .../P4HDT2.cpp | 2 +- .../Periodic_4_hyperbolic_triangulation_2.h | 6 +- ...ABB_traversal_traits_with_transformation.h | 12 +- .../internal/Snapping/snap.h | 2 +- .../include/CGAL/internal/hypothesis.h | 4 +- Polyhedron/demo/Polyhedron/MainWindow.cpp | 6 +- Polyhedron/demo/Polyhedron/MainWindow.h | 2 +- .../Classification/Cluster_classification.cpp | 6 +- .../Point_set_item_classification.cpp | 6 +- .../Point_set_item_classification.h | 4 +- .../Surface_mesh_item_classification.cpp | 6 +- .../Plugins/PCA/Create_bbox_mesh_plugin.cpp | 6 +- .../Plugins/PCA/Scene_edit_box_item.cpp | 10 +- .../Plugins/PMP/Engrave_text_plugin.cpp | 8 +- .../Surface_mesh/Mesh_segmentation_plugin.cpp | 2 +- .../Mesh_simplification_plugin.cpp | 2 +- .../Surface_mesh/Offset_meshing_plugin.cpp | 6 +- .../demo/Polyhedron/Scene_c3t3_item.cpp | 8 +- .../demo/Polyhedron/Scene_polylines_item.cpp | 2 +- .../include/CGAL/Polynomial/bezout_matrix.h | 4 +- .../test_efficient_RANSAC_generators.h | 4 +- .../include/CGAL/Straight_skeleton_2/test.h | 8 +- .../test/Stream_support/test_read_WKT.cpp | 6 +- .../test/Stream_support/test_write_WKT.cpp | 22 +- .../include/CGAL/Surface_mesh/Properties.h | 4 +- .../include/CGAL/Surface_mesh/Surface_mesh.h | 10 +- .../CGAL/Variational_shape_approximation.h | 2 +- .../benchmark_shortest_paths.cpp | 8 +- .../Surface_mesh_shortest_path.h | 2 +- .../include/CGAL/enriched_polyhedron.h | 12 +- .../CGAL/vtkSurfaceMesherContourFilter.h | 4 +- .../CGAL/internal/Combination_enumerator.h | 8 +- 68 files changed, 538 insertions(+), 289 deletions(-) diff --git a/AABB_tree/demo/AABB_tree/Scene.cpp b/AABB_tree/demo/AABB_tree/Scene.cpp index f5807c419a5..b362f854c16 100644 --- a/AABB_tree/demo/AABB_tree/Scene.cpp +++ b/AABB_tree/demo/AABB_tree/Scene.cpp @@ -857,8 +857,8 @@ void Scene::update_grid_size() } void Scene::generate_points_in(const unsigned int nb_points, - const double min, - const double max) + const double vmin, + const double vmax) { if(m_pPolyhedron == NULL) { @@ -877,7 +877,7 @@ void Scene::generate_points_in(const unsigned int nb_points, CGAL::Timer timer; timer.start(); std::cout << "Generate " << nb_points << " points in interval [" - << min << ";" << max << "]"; + << vmin << ";" << vmax << "]"; unsigned int nb_trials = 0; Vector vec = random_vector(); @@ -894,8 +894,8 @@ void Scene::generate_points_in(const unsigned int nb_points, if(nb_intersections % 2 != 0) signed_distance *= -1.0; - if(signed_distance >= min && - signed_distance <= max) + if(signed_distance >= vmin && + signed_distance <= vmax) { m_points.push_back(p); if(m_points.size()%(nb_points/10) == 0) diff --git a/AABB_tree/demo/AABB_tree/Scene.h b/AABB_tree/demo/AABB_tree/Scene.h index aad62368874..4e9fabd735b 100644 --- a/AABB_tree/demo/AABB_tree/Scene.h +++ b/AABB_tree/demo/AABB_tree/Scene.h @@ -192,7 +192,7 @@ public: void generate_boundary_points(const unsigned int nb_points); void generate_boundary_segments(const unsigned int nb_slices); void generate_points_in(const unsigned int nb_points, - const double min, const double max); + const double vmin, const double vmax); // algorithms/refine void refine_loop(); diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp index 5c90d2b6f37..050a97e81df 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp @@ -109,10 +109,10 @@ QRectF ArrangementDemoGraphicsView::getViewportRect( ) const QPointF p1 = this->mapToScene( 0, 0 ); QPointF p2 = this->mapToScene( this->width( ), this->height( ) ); - double xmin = std::min( p1.x( ), p2.x( ) ); - double xmax = std::max( p1.x( ), p2.x( ) ); - double ymin = std::min( p1.y( ), p2.y( ) ); - double ymax = std::max( p1.y( ), p2.y( ) ); + double xmin = (std::min)( p1.x( ), p2.x( ) ); + double xmax = (std::max)( p1.x( ), p2.x( ) ); + double ymin = (std::min)( p1.y( ), p2.y( ) ); + double ymax = (std::max)( p1.y( ), p2.y( ) ); QRectF res = QRectF( QPointF( xmin, ymin ), QPointF( xmax, ymax ) ); diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h index 62a1271d89f..f0fdab150de 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h @@ -3024,8 +3024,8 @@ public: y_dapprox = y_interval_for_curve_end(*this, CGAL::ARR_MIN_END, prec); // adapt y-interval - ymin = CGAL::min(ymin, y_dapprox.first); - ymax = CGAL::max(ymax, y_dapprox.second); + ymin = (CGAL::min)(ymin, y_dapprox.first); + ymax = (CGAL::max)(ymax, y_dapprox.second); // right end @@ -3105,9 +3105,9 @@ public: (curr_xy, prec); // adapt y-interval - ymin = CGAL::min(ymin, + ymin = (CGAL::min)(ymin, CGAL::to_double(xy_approx.first)); - ymax = CGAL::max(ymax, + ymax = (CGAL::max)(ymax, CGAL::to_double(xy_approx.second)); } } diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h index 0bc77123f22..2389d8aea7b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h @@ -572,7 +572,7 @@ void draw(const Arc_2& arc, ref_bound = engine.pixel_h_r/CGAL_REFINE_X; #ifdef CGAL_CKVA_RENDER_WITH_REFINEMENT - ref_bound = std::min(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX)); + ref_bound = (std::min)(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX)); #endif Gfx_OUT("computing y-coordinates\n"); @@ -912,7 +912,7 @@ bool draw(const Point_2& pt, Coord_2& coord) { const Coordinate_1& x0 = pt.x(); Rational ref_bound = engine.pixel_w_r / 2; #ifdef CGAL_CKVA_RENDER_WITH_REFINEMENT - ref_bound = std::min(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX)); + ref_bound = (std::min)(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX)); #endif typename Curve_kernel_2::Algebraic_kernel_d_1::Approximate_relative_1 @@ -932,7 +932,7 @@ bool draw(const Point_2& pt, Coord_2& coord) { ref_bound = engine.pixel_h_r / CGAL_REFINE_X; #ifdef CGAL_CKVA_RENDER_WITH_REFINEMENT - ref_bound = std::min(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX)); + ref_bound = (std::min)(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX)); #endif Coordinate_2 xy(x0, pt.curve(), pt.arcno()); diff --git a/Bounding_volumes/archive/test_extensive/stability/stability.cpp b/Bounding_volumes/archive/test_extensive/stability/stability.cpp index 419c50460c8..7b3c8673926 100644 --- a/Bounding_volumes/archive/test_extensive/stability/stability.cpp +++ b/Bounding_volumes/archive/test_extensive/stability/stability.cpp @@ -17,8 +17,8 @@ int nr = 0; double rerr(double exact,double approx) { const double e = std::abs((exact-approx)/exact); - mine = std::min(mine,e); - maxe = std::max(maxe,e); + mine = (std::min)(mine,e); + maxe = (std::max)(maxe,e); avge += e; ++nr; return e; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp b/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp index 64cf2296591..f5423b0ab19 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp @@ -94,7 +94,7 @@ void ASphapeIpelet::protected_run(int fn) } - A.set_alpha(alpha==0?std::max(std::numeric_limits::epsilon(),A.get_nth_alpha(0)/2.): + A.set_alpha(alpha==0?(std::max)(std::numeric_limits::epsilon(),A.get_nth_alpha(0)/2.): (std::size_t) alpha==A.number_of_alphas()?A.get_nth_alpha(alpha-1)+1:A.get_nth_alpha(alpha-1)/2.+A.get_nth_alpha(alpha)/2.); for ( Alpha_shape_2::Alpha_shape_edges_iterator it=A.alpha_shape_edges_begin();it!=A.alpha_shape_edges_end();++it) draw_in_ipe(A.segment(*it)); diff --git a/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp b/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp index 3d25728ee5a..7d2026c5981 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp @@ -105,7 +105,7 @@ void SkeletonIpelet::protected_run(int fn) std::list offsets; //~ "Interior skeleton", "Exterior skeleton","Interior offset","Exterior offset","Interior offsets","Exterior offsets", "Help" SkeletonPtr ss; - double max_edge=std::max((bbox.xmax()-bbox.xmin()),(bbox.ymax()-bbox.ymin())); + double max_edge=(std::max)((bbox.xmax()-bbox.xmin()),(bbox.ymax()-bbox.ymin())); double dist=0.; int ret_val=-1; switch(fn){ diff --git a/Classification/include/CGAL/Classification/Feature/Cluster_vertical_extent.h b/Classification/include/CGAL/Classification/Feature/Cluster_vertical_extent.h index d57d8e7d10b..ed977c52da6 100644 --- a/Classification/include/CGAL/Classification/Feature/Cluster_vertical_extent.h +++ b/Classification/include/CGAL/Classification/Feature/Cluster_vertical_extent.h @@ -58,8 +58,8 @@ public: m_values.reserve (clusters.size()); for (std::size_t i = 0; i < clusters.size(); ++ i) { - float min_z = std::numeric_limits::max(); - float max_z = -std::numeric_limits::min(); + float min_z = (std::numeric_limits::max)(); + float max_z = -(std::numeric_limits::min)(); for (std::size_t j = 0; j < clusters[i].size(); ++ j) { diff --git a/Classification/include/CGAL/Classification/Feature/Elevation.h b/Classification/include/CGAL/Classification/Feature/Elevation.h index e4158800ef2..1205c757403 100644 --- a/Classification/include/CGAL/Classification/Feature/Elevation.h +++ b/Classification/include/CGAL/Classification/Feature/Elevation.h @@ -88,7 +88,7 @@ public: Image_float dem(grid.width(),grid.height()); z_max = 0.f; - z_min = std::numeric_limits::max(); + z_min = (std::numeric_limits::max)(); for (std::size_t j = 0; j < grid.height(); ++ j) for (std::size_t i = 0; i < grid.width(); ++ i) @@ -100,8 +100,8 @@ public: for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it) { float z = float(get(point_map, *(input.begin()+(*it))).z()); - z_min = (std::min(z_min, z)); - z_max = (std::max(z_max, z)); + z_min = ((std::min)(z_min, z)); + z_max = ((std::max)(z_max, z)); mean += z; ++ nb; } diff --git a/Classification/include/CGAL/Classification/Feature/Height_above.h b/Classification/include/CGAL/Classification/Feature/Height_above.h index a4cec436241..62eac6f20e2 100644 --- a/Classification/include/CGAL/Classification/Feature/Height_above.h +++ b/Classification/include/CGAL/Classification/Feature/Height_above.h @@ -81,13 +81,13 @@ public: for (std::size_t i = 0; i < grid.width(); ++ i) if (grid.has_points(i,j)) { - float z_max = -std::numeric_limits::max(); + float z_max = -(std::numeric_limits::max)(); typename Grid::iterator end = grid.indices_end(i,j); for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it) { float z = float(get(point_map, *(input.begin()+(*it))).z()); - z_max = (std::max(z_max, z)); + z_max = ((std::max)(z_max, z)); } dtm(i,j) = z_max; diff --git a/Classification/include/CGAL/Classification/Feature/Height_below.h b/Classification/include/CGAL/Classification/Feature/Height_below.h index 421b7622c79..0eae37370f6 100644 --- a/Classification/include/CGAL/Classification/Feature/Height_below.h +++ b/Classification/include/CGAL/Classification/Feature/Height_below.h @@ -81,13 +81,13 @@ public: for (std::size_t i = 0; i < grid.width(); ++ i) if (grid.has_points(i,j)) { - float z_min = std::numeric_limits::max(); + float z_min = (std::numeric_limits::max)(); typename Grid::iterator end = grid.indices_end(i,j); for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it) { float z = float(get(point_map, *(input.begin()+(*it))).z()); - z_min = (std::min(z_min, z)); + z_min = ((std::min)(z_min, z)); } dtm(i,j) = z_min; diff --git a/Classification/include/CGAL/Classification/Feature/Vertical_range.h b/Classification/include/CGAL/Classification/Feature/Vertical_range.h index 759fd4a274e..95fc5042e18 100644 --- a/Classification/include/CGAL/Classification/Feature/Vertical_range.h +++ b/Classification/include/CGAL/Classification/Feature/Vertical_range.h @@ -81,15 +81,15 @@ public: for (std::size_t i = 0; i < grid.width(); ++ i) if (grid.has_points(i,j)) { - float z_max = -std::numeric_limits::max(); - float z_min = std::numeric_limits::max(); + float z_max = -(std::numeric_limits::max)(); + float z_min = (std::numeric_limits::max)(); typename Grid::iterator end = grid.indices_end(i,j); for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it) { float z = float(get(point_map, *(input.begin()+(*it))).z()); - z_max = (std::max(z_max, z)); - z_min = (std::min(z_min, z)); + z_max = ((std::max)(z_max, z)); + z_min = ((std::min)(z_min, z)); } dtm(i,j) = z_max - z_min; diff --git a/Classification/include/CGAL/Classification/compressed_float.h b/Classification/include/CGAL/Classification/compressed_float.h index be994de81de..07c7600d33c 100644 --- a/Classification/include/CGAL/Classification/compressed_float.h +++ b/Classification/include/CGAL/Classification/compressed_float.h @@ -40,15 +40,15 @@ typedef unsigned short compressed_float; typedef unsigned char compressed_float; # endif -inline compressed_float compress_float (const float& f, const float& min = 0.f, const float& max = 1.f) +inline compressed_float compress_float (const float& f, const float& fmin = 0.f, const float& fmax = 1.f) { return static_cast - (float(std::numeric_limits::max()) * (f - min) / (max - min)); + (float((std::numeric_limits::max)()) * (f - fmin) / (fmax - fmin)); } -inline float decompress_float (const compressed_float& t, const float& min = 0.f, const float& max = 1.f) +inline float decompress_float (const compressed_float& t, const float& fmin = 0.f, const float& fmax = 1.f) { - return ((max - min) * (t / float(std::numeric_limits::max())) + min); + return ((fmax - fmin) * (t / float((std::numeric_limits::max)())) + fmin); } #endif diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index 6a4c44af749..829296e124f 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -41,6 +41,9 @@ #include #include #include +#include +#include + #include #if defined( __INTEL_COMPILER ) @@ -55,6 +58,16 @@ _Pragma("GCC diagnostic ignored \"-Warray-bounds\"") #endif namespace CGAL { + // functions to allow the call to next/opposite by ADL + template + auto CM_ADL_next(Desc&& d, G&& g) { + return next(std::forward(d), std::forward(g)); + } + + template + auto CM_ADL_opposite(Desc&& d, G&& g) { + return opposite(std::forward(d), std::forward(g)); + } /** @file Combinatorial_map.h * Definition of generic dD Combinatorial map. @@ -199,18 +212,27 @@ namespace CGAL { CGAL_assertion(number_of_darts()==0); } - /** Copy the given combinatorial map into *this. + /** Copy the given combinatorial map 'amap' into *this. * Note that both CMap can have different dimensions and/or non void attributes. * @param amap the combinatorial map to copy. * @post *this is valid. */ - template - void copy(const CMap2& amap, const Converters& converters, + void copy(const Combinatorial_map_base& amap, + const Converters& converters, const DartInfoConverter& dartinfoconverter, const PointConverter& pointconverter, - boost::unordered_map* dart_mapping=nullptr) + boost::unordered_map + :: + Dart_const_handle, Dart_handle>* origin_to_copy=NULL, + boost::unordered_map + ::Dart_const_handle>* copy_to_origin=NULL) { + typedef Combinatorial_map_base CMap2; this->clear(); this->mnb_used_marks = amap.mnb_used_marks; @@ -232,81 +254,113 @@ namespace CGAL { // Create an mapping between darts of the two maps (originals->copies). // (here we cannot use CGAL::Unique_hash_map because it does not provide // iterators... - boost::unordered_map local_dartmap; - if (dart_mapping==nullptr) - { dart_mapping=&local_dartmap; } + boost::unordered_map + local_dartmap; + if (origin_to_copy==NULL) // Used local_dartmap if user does not provides its own unordered_map + { origin_to_copy=&local_dartmap; } + Dart_handle new_dart; for (typename CMap2::Dart_const_range::const_iterator it=amap.darts().begin(), itend=amap.darts().end(); it!=itend; ++it) { - (*dart_mapping)[it]=mdarts.emplace(); - init_dart((*dart_mapping)[it], amap.get_marks(it)); - internal::Copy_dart_info_functor::run - (amap, static_cast(*this), it, (*dart_mapping)[it], - dartinfoconverter); + new_dart=mdarts.emplace(); + init_dart(new_dart, amap.get_marks(it)); + + (*origin_to_copy)[it]=new_dart; + if (copy_to_origin!=NULL) { (*copy_to_origin)[new_dart]=it; } + + internal::Copy_dart_info_functor::run + (static_cast(amap), static_cast(*this), + it, new_dart, dartinfoconverter); } unsigned int min_dim=(dimension - ::iterator dartmap_iter, dartmap_iter_end=dart_mapping->end(); - for (dartmap_iter=dart_mapping->begin(); dartmap_iter!=dartmap_iter_end; + ::iterator dartmap_iter, dartmap_iter_end=origin_to_copy->end(); + for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end; ++dartmap_iter) { for (unsigned int i=0; i<=min_dim; i++) { if (!amap.is_free(dartmap_iter->first,i) && - (dartmap_iter->first)<(amap.beta(dartmap_iter->first,i))) + is_free(dartmap_iter->second,i)) { basic_link_beta(dartmap_iter->second, - (*dart_mapping)[amap.beta(dartmap_iter->first,i)], i); + (*origin_to_copy)[amap.beta(dartmap_iter->first,i)], i); } } } /** Copy attributes */ - for (dartmap_iter=dart_mapping->begin(); dartmap_iter!=dartmap_iter_end; + for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end; ++dartmap_iter) { Helper::template Foreach_enabled_attributes - < internal::Copy_attributes_functor >:: - run(amap, static_cast(*this), + run(static_cast(amap), static_cast(*this), dartmap_iter->first, dartmap_iter->second, converters, pointconverter); } - CGAL_assertion (is_valid () == 1); + CGAL_assertion (is_valid()); } - template - void copy(const CMap2& amap, - boost::unordered_map* dart_mapping=nullptr) + template + void copy(const Combinatorial_map_base& amap, + boost::unordered_map + ::Dart_const_handle, Dart_handle>* origin_to_copy=NULL, + boost::unordered_map + ::Dart_const_handle>* copy_to_origin=NULL) { - std::tuple<> converters; - Default_converter_dart_info dartinfoconverter; - Default_converter_cmap_0attributes_with_point pointconverter; - copy(amap, converters, dartinfoconverter, pointconverter, dart_mapping); + CGAL::cpp11::tuple<> converters; + Default_converter_dart_info dartinfoconverter; + Default_converter_cmap_0attributes_with_point pointconverter; + copy(amap, converters, dartinfoconverter, pointconverter, + origin_to_copy, copy_to_origin); } - template - void copy(const CMap2& amap, const Converters& converters, - boost::unordered_map* dart_mapping=nullptr) + template + void copy(const Combinatorial_map_base& amap, + const Converters& converters, + boost::unordered_map + ::Dart_const_handle, Dart_handle>* origin_to_copy=NULL, + boost::unordered_map + ::Dart_const_handle>* copy_to_origin=NULL) { - Default_converter_cmap_0attributes_with_point pointconverter; - Default_converter_dart_info dartinfoconverter; - copy(amap, converters, dartinfoconverter, pointconverter, dart_mapping); + Default_converter_cmap_0attributes_with_point pointconverter; + Default_converter_dart_info dartinfoconverter; + copy(amap, converters, dartinfoconverter, pointconverter, + origin_to_copy, copy_to_origin); } - template - void copy(const CMap2& amap, const Converters& converters, + template + void copy(const Combinatorial_map_base& amap, + const Converters& converters, const DartInfoConverter& dartinfoconverter, - boost::unordered_map* dart_mapping=nullptr) + boost::unordered_map + ::Dart_const_handle, Dart_handle>* origin_to_copy=NULL, + boost::unordered_map + ::Dart_const_handle>* copy_to_origin=NULL) { - Default_converter_cmap_0attributes_with_point pointconverter; - copy(amap, converters, dartinfoconverter, pointconverter, dart_mapping); + Default_converter_cmap_0attributes_with_point pointconverter; + copy(amap, converters, dartinfoconverter, pointconverter, + origin_to_copy, copy_to_origin); } // Copy constructor from a map having exactly the same type. @@ -314,25 +368,37 @@ namespace CGAL { { copy(amap); } // "Copy constructor" from a map having different type. - template - Combinatorial_map_base(const CMap2& amap) + template + Combinatorial_map_base(const Combinatorial_map_base& amap) { copy(amap); } // "Copy constructor" from a map having different type. - template - Combinatorial_map_base(const CMap2& amap, Converters& converters) + template + Combinatorial_map_base(const Combinatorial_map_base& amap, + const Converters& converters) { copy(amap, converters); } // "Copy constructor" from a map having different type. - template - Combinatorial_map_base(const CMap2& amap, Converters& converters, + template + Combinatorial_map_base(const Combinatorial_map_base& amap, + const Converters& converters, const DartInfoConverter& dartinfoconverter) { copy(amap, converters, dartinfoconverter); } // "Copy constructor" from a map having different type. - template - Combinatorial_map_base(const CMap2& amap, Converters& converters, + template + Combinatorial_map_base(const Combinatorial_map_base& amap, + const Converters& converters, const DartInfoConverter& dartinfoconverter, const PointConverter& pointconverter) { copy(amap, converters, dartinfoconverter, pointconverter); } @@ -385,6 +451,62 @@ namespace CGAL { } } + /** Import the given hds which should be a model of an halfedge graph. */ + template + void import_from_halfedge_graph(const HEG& heg, + boost::unordered_map + ::halfedge_descriptor, + Dart_handle>* origin_to_copy=NULL, + boost::unordered_map + ::halfedge_descriptor>* + copy_to_origin=NULL) + + { + // Create an mapping between darts of the two maps (originals->copies). + // (here we cannot use CGAL::Unique_hash_map because it does not provide + // iterators... + boost::unordered_map + ::halfedge_descriptor, + Dart_handle> local_dartmap; + if (origin_to_copy==NULL) // Used local_dartmap if user does not provides its own unordered_map + { origin_to_copy=&local_dartmap; } + + Dart_handle new_dart; + for (typename boost::graph_traits::halfedge_iterator + it=halfedges(heg).begin(), itend=halfedges(heg).end(); + it!=itend; ++it) + { + if (!CGAL::is_border(*it, heg)) + { + new_dart=mdarts.emplace(); + (*origin_to_copy)[*it]=new_dart; + if (copy_to_origin!=NULL) { (*copy_to_origin)[new_dart]=*it; } + } + } + + typename boost::unordered_map + ::halfedge_descriptor, + Dart_handle>::iterator dartmap_iter, dartmap_iter_end=origin_to_copy->end(); + for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end; + ++dartmap_iter) + { + basic_link_beta(dartmap_iter->second, + (*origin_to_copy)[CM_ADL_next(dartmap_iter->first, heg)], + 1); + + if (!CGAL::is_border(CM_ADL_opposite(dartmap_iter->first, heg), heg) && + (dartmap_iter->first)first, heg)) + { + basic_link_beta(dartmap_iter->second, + (*origin_to_copy) + [CM_ADL_opposite(dartmap_iter->first, heg)], 2); + } + } + + CGAL_assertion (is_valid()); + } + /** Clear the combinatorial map. Remove all darts and all attributes. * Note that reserved marks are not free. */ @@ -498,6 +620,16 @@ namespace CGAL { { return mdarts.iterator_to(adart); } Dart_const_handle dart_handle(const Dart& adart) const { return mdarts.iterator_to(adart); } + Dart_handle dart_handle(size_type i) + { + CGAL_assertion(darts().is_used(i)); + return mdarts.iterator_to(darts()[i]); + } + Dart_const_handle dart_handle(size_type i) const + { + CGAL_assertion(darts().is_used(i)); + return mdarts.iterator_to(darts()[i]); + } /** Return the highest dimension for which dh is not free. * @param dh a dart handle @@ -673,6 +805,11 @@ namespace CGAL { Dart_const_handle next(Dart_const_handle ADart) const { return this->template beta<1>(ADart); } + Dart_handle opposite2(Dart_handle ADart) + { return this->template beta<2>(ADart); } + Dart_const_handle opposite2(Dart_const_handle ADart) const + { return this->template beta<2>(ADart); } + template Dart_handle opposite(Dart_handle ADart) { return this->template beta(ADart); } @@ -950,6 +1087,27 @@ namespace CGAL { mnb_times_reserved_marks[amark]=0; } + template + bool belong_to_same_cell(Dart_const_handle adart1, + Dart_const_handle adart2) const + { return CGAL::belong_to_same_cell(*this, adart1, adart2); } + + template + bool is_whole_cell_unmarked(Dart_const_handle adart, size_type amark) const + { return CGAL::is_whole_cell_unmarked(*this, adart, amark); } + + template + bool is_whole_cell_marked(Dart_const_handle adart, size_type amark) const + { return CGAL::is_whole_cell_marked(*this, adart, amark); } + + template + size_type mark_cell(Dart_const_handle adart, size_type amark) const + { return CGAL::mark_cell(*this, adart, amark); } + + template + size_type unmark_cell(Dart_const_handle adart, size_type amark) const + { return CGAL::unmark_cell(*this, adart, amark); } + /** Test if this map is without boundary for a given dimension. * @param i the dimension. * @return true iff all the darts are not i-free. @@ -2300,6 +2458,30 @@ namespace CGAL { run(*this, adart, amark); } + /// Keep the biggest connected component. + /// @return the size (in number of darts) of the biggest cc. + std::size_t keep_biggest_connected_component() + { + std::map ccs; + + size_type treated=get_new_mark(); + for (auto it=darts().begin(), itend=darts().end(); it!=itend; ++it) + { + if (!is_marked(it, treated)) + { ccs[mark_cell(it, treated)]=it; } + } + + if (ccs.size()>1) + { // Here all darts are marked + this->template unmark_cell(ccs.rbegin()->second, treated); // Unmark the biggest cc + erase_marked_darts(treated); + } + + free_mark(treated); + + return ccs.rbegin()->first; + } + /** Count the marked cells (at least one marked dart). * @param amark the mark to consider. * @param avector containing the dimensions of the cells to count. @@ -2433,6 +2615,64 @@ namespace CGAL { } public: + + /// @return the positive turn between the two given darts. + // @pre beta1(d1) and d2 must belong to the same vertex. + std::size_t positive_turn(Dart_const_handle d1, Dart_const_handle d2) const + { + CGAL_assertion((!this->template is_free<1>(d1))); + /* CGAL_assertion((belong_to_same_cell<0>(this->template beta<1>(d1), + d2))); */ + + if (d2==beta<2>(d1)) { return 0; } + + Dart_const_handle dd1=d1; + std::size_t res=1; + while (beta<1>(dd1)!=d2) + { + if (this->template is_free<2>(beta<1>(dd1))) + { return (std::numeric_limits::max)(); } + + ++res; + dd1=beta<1, 2>(dd1); + + CGAL_assertion(!this->template is_free<1>(dd1)); + CGAL_assertion(beta<1>(dd1)==d2 || dd1!=d1); + } + return res; + } + + /// @return the negative turn between the two given darts. + // @pre beta1(d1) and d2 must belong to the same vertex. + std::size_t negative_turn(Dart_const_handle d1, Dart_const_handle d2) const + { + CGAL_assertion((!this->template is_free<1>(d1))); + /* CGAL_assertion((belong_to_same_cell<0>(this->template beta<1>(d1), + d2))); */ + + if (d2==beta<2>(d1)) { return 0; } + + if (this->template is_free<2>(d1) || this->template is_free<2>(d2)) + { return (std::numeric_limits::max)(); } + + d1=beta<2>(d1); + d2=beta<2>(d2); + Dart_const_handle dd1=d1; + std::size_t res=1; + while (beta<0>(dd1)!=d2) + { + if (this->template is_free<2>(beta<0>(dd1))) + { return (std::numeric_limits::max)(); } + + ++res; + dd1=beta<0, 2>(dd1); + + CGAL_assertion(!this->template is_free<0>(dd1)); + CGAL_assertion(beta<0>(dd1)==d2 || dd1!=d1); + } + return res; + } + /** Erase marked darts from the map. * Marked darts are unlinked before to be removed, thus surviving darts * are correctly linked, but the map is not necessarily valid depending @@ -3513,12 +3753,12 @@ namespace CGAL { !is_face_combinatorial_polygon(d4, 3) ) return false; // TODO do better with marks (?). - if ( belong_to_same_cell(*this, d1, d2) || - belong_to_same_cell(*this, d1, d3) || - belong_to_same_cell(*this, d1, d4) || - belong_to_same_cell(*this, d2, d3) || - belong_to_same_cell(*this, d2, d4) || - belong_to_same_cell(*this, d3, d4) ) return false; + if ( belong_to_same_cell<2,1>(d1, d2) || + belong_to_same_cell<2,1>(d1, d3) || + belong_to_same_cell<2,1>(d1, d4) || + belong_to_same_cell<2,1>(d2, d3) || + belong_to_same_cell<2,1>(d2, d4) || + belong_to_same_cell<2,1>(d3, d4) ) return false; if ( beta(d1,1,2)!=beta(d3,0) || beta(d4,0,2)!=beta(d3,1) || @@ -3611,21 +3851,21 @@ namespace CGAL { !is_face_combinatorial_polygon(d6, 4) ) return false; // TODO do better with marks. - if ( belong_to_same_cell(*this, d1, d2) || - belong_to_same_cell(*this, d1, d3) || - belong_to_same_cell(*this, d1, d4) || - belong_to_same_cell(*this, d1, d5) || - belong_to_same_cell(*this, d1, d6) || - belong_to_same_cell(*this, d2, d3) || - belong_to_same_cell(*this, d2, d4) || - belong_to_same_cell(*this, d2, d5) || - belong_to_same_cell(*this, d2, d6) || - belong_to_same_cell(*this, d3, d4) || - belong_to_same_cell(*this, d3, d5) || - belong_to_same_cell(*this, d3, d6) || - belong_to_same_cell(*this, d4, d5) || - belong_to_same_cell(*this, d4, d6) || - belong_to_same_cell(*this, d5, d6) ) + if ( belong_to_same_cell<2,1>(d1, d2) || + belong_to_same_cell<2,1>(d1, d3) || + belong_to_same_cell<2,1>(d1, d4) || + belong_to_same_cell<2,1>(d1, d5) || + belong_to_same_cell<2,1>(d1, d6) || + belong_to_same_cell<2,1>(d2, d3) || + belong_to_same_cell<2,1>(d2, d4) || + belong_to_same_cell<2,1>(d2, d5) || + belong_to_same_cell<2,1>(d2, d6) || + belong_to_same_cell<2,1>(d3, d4) || + belong_to_same_cell<2,1>(d3, d5) || + belong_to_same_cell<2,1>(d3, d6) || + belong_to_same_cell<2,1>(d4, d5) || + belong_to_same_cell<2,1>(d4, d6) || + belong_to_same_cell<2,1>(d5, d6) ) return false; if ( beta(d1,2) !=beta(d4,1,1) || @@ -3781,7 +4021,7 @@ namespace CGAL { return this->template beta<1>(adart); } - /** Insert a vertex in the given 2-cell which is splitted in triangles, + /** Insert a vertex in the given 2-cell which is split in triangles, * once for each inital edge of the facet. * @param adart a dart of the facet to triangulate. * @param update_attributes a boolean to update the enabled attributes @@ -4213,7 +4453,7 @@ namespace CGAL { if ( od==null_handle ) return false; // of and *it must belong to the same vertex of the same volume - if ( !belong_to_same_cell(*this, od, *it) ) + if ( !belong_to_same_cell<0, 2>(od, *it) ) return false; } prec = *it; @@ -4223,7 +4463,7 @@ namespace CGAL { od = other_extremity(prec); if ( od==null_handle ) return false; - if (!belong_to_same_cell(*this, od, *afirst)) + if (!belong_to_same_cell<0, 2>(od, *afirst)) return false; return true; @@ -4437,24 +4677,33 @@ namespace CGAL { Combinatorial_map(const Self & amap) : Base(amap) {} - template < class CMap > - Combinatorial_map(const CMap & amap) : Base(amap) + template + Combinatorial_map(const Combinatorial_map_base& + amap) : Base(amap) {} - template < class CMap, typename Converters > - Combinatorial_map(const CMap & amap, const Converters& converters) : + template + Combinatorial_map(const Combinatorial_map_base& + amap, const Converters& converters) : Base(amap, converters) {} - template < class CMap, typename Converters, typename DartInfoConverter > - Combinatorial_map(const CMap & amap, const Converters& converters, + template + Combinatorial_map(const Combinatorial_map_base& + amap, const Converters& converters, const DartInfoConverter& dartinfoconverter) : Base(amap, converters, dartinfoconverter) {} - template < class CMap, typename Converters, typename DartInfoConverter, - typename PointConverter > - Combinatorial_map(const CMap & amap, const Converters& converters, + template + Combinatorial_map(const Combinatorial_map_base& + amap, const Converters& converters, const DartInfoConverter& dartinfoconverter, const PointConverter& pointconverter) : Base(amap, converters, dartinfoconverter, pointconverter) diff --git a/Filtered_kernel/include/CGAL/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h b/Filtered_kernel/include/CGAL/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h index f940f7d815d..1cb46d265da 100644 --- a/Filtered_kernel/include/CGAL/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h +++ b/Filtered_kernel/include/CGAL/internal/Static_filters/Coplanar_side_of_bounded_circle_3.h @@ -126,7 +126,7 @@ public: if (maxz < arz) maxz = arz; if (maxz < atz) maxz = atz; - double d = std::max(maxx, std::max(maxy, maxz)); + double d = (std::max)(maxx, (std::max)(maxy, maxz)); double eps = 3.27418e-11 * d * d * d * d * d * d; if (det > eps) return ON_BOUNDED_SIDE; diff --git a/Heat_method_3/examples/Heat_method_3/heat_method_surface_mesh.cpp b/Heat_method_3/examples/Heat_method_3/heat_method_surface_mesh.cpp index 8395eb6d72e..ca8fa43edc6 100644 --- a/Heat_method_3/examples/Heat_method_3/heat_method_surface_mesh.cpp +++ b/Heat_method_3/examples/Heat_method_3/heat_method_surface_mesh.cpp @@ -38,20 +38,20 @@ int main(int argc, char* argv[]) Point_3 sp = tm.point(source); std::cout << "source: " << sp << " " << source << std::endl; - vertex_descriptor far; + vertex_descriptor vfar; double sdistance = 0; for(vertex_descriptor vd : vertices(tm)){ std::cout << vd << " is at distance " << get(vertex_distance, vd) << " to " << source << std::endl; if(get(vertex_distance, vd) > sdistance){ - far = vd; + vfar = vd; sdistance = get(vertex_distance, vd); } } - std::cout << "far: " << tm.point(far) << " " << far << std::endl; + std::cout << "vfar: " << tm.point(vfar) << " " << vfar << std::endl; - hm.add_source(far); + hm.add_source(vfar); hm.estimate_geodesic_distances(vertex_distance); for(vertex_descriptor vd : vertices(tm)){ diff --git a/Heat_method_3/test/Heat_method_3/heat_method_concept.cpp b/Heat_method_3/test/Heat_method_3/heat_method_concept.cpp index 0767dcc38f7..1486ee4c075 100644 --- a/Heat_method_3/test/Heat_method_3/heat_method_concept.cpp +++ b/Heat_method_3/test/Heat_method_3/heat_method_concept.cpp @@ -42,19 +42,19 @@ int main() //Point_3 sp = sm.point(source); - vertex_descriptor far; + vertex_descriptor vfar; // double sdistance = 0; for(vertex_descriptor vd : vertices(sm)){ std::cout << vd << " is at distance " << get(heat_intensity, vd) << " from " << source << std::endl; /* if(squared_distance(sp,sm.point(vd)) > sdistance){ - far = vd; + vfar = vd; sdistance = squared_distance(sp,sm.point(vd)); } */ } - hm.add_source(far); + hm.add_source(vfar); hm.estimate_geodesic_distances(heat_intensity); for(vertex_descriptor vd : vertices(sm)){ diff --git a/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_direct_test.cpp b/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_direct_test.cpp index 75e09f5b024..1c6ec0d99d2 100644 --- a/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_direct_test.cpp +++ b/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_direct_test.cpp @@ -36,19 +36,19 @@ int main(int argc, char* argv[]) Point_3 sp = sm.point(source); std::cout << "source: " << sp << " " << source << std::endl; - vertex_descriptor far; + vertex_descriptor vfar; double sdistance = 0; for(vertex_descriptor vd : vertices(sm)){ if(get(vertex_distance,vd) > sdistance){ - far = vd; + vfar = vd; sdistance = get(vertex_distance,vd); } } assert(sdistance > 2.9); assert(sdistance < CGAL_PI); - hm.add_source(far); + hm.add_source(vfar); assert(hm.sources().size() == 2); hm.estimate_geodesic_distances(vertex_distance); @@ -62,7 +62,7 @@ int main(int argc, char* argv[]) assert(sdistance > 1.4); assert(sdistance < CGAL_PI/2.0); - hm.remove_source(far); + hm.remove_source(vfar); assert(hm.sources().size() == 1); hm.clear_sources(); @@ -70,7 +70,7 @@ int main(int argc, char* argv[]) // add range of sources std::vector vrange; vrange.push_back(source); - vrange.push_back(far); + vrange.push_back(vfar); hm.add_sources(vrange); assert(hm.sources().size() == 2); hm.estimate_geodesic_distances(vertex_distance); diff --git a/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_test.cpp b/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_test.cpp index 33a0ab4d111..44ef9fa6799 100644 --- a/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_test.cpp +++ b/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_test.cpp @@ -36,19 +36,19 @@ int main(int argc, char* argv[]) Point_3 sp = sm.point(source); std::cout << "source: " << sp << " " << source << std::endl; - vertex_descriptor far; + vertex_descriptor vfar; double sdistance = 0; for(vertex_descriptor vd : vertices(sm)){ if(get(vertex_distance,vd) > sdistance){ - far = vd; + vfar = vd; sdistance = get(vertex_distance,vd); } } assert(sdistance > 2.9); assert(sdistance < CGAL_PI); - hm.add_source(far); + hm.add_source(vfar); assert(hm.sources().size() == 2); hm.estimate_geodesic_distances(vertex_distance); @@ -62,7 +62,7 @@ int main(int argc, char* argv[]) assert(sdistance > 1.4); assert(sdistance < CGAL_PI/2.0); - hm.remove_source(far); + hm.remove_source(vfar); assert(hm.sources().size() == 1); hm.clear_sources(); @@ -70,7 +70,7 @@ int main(int argc, char* argv[]) // add range of sources std::vector vrange; vrange.push_back(source); - vrange.push_back(far); + vrange.push_back(vfar); hm.add_sources(vrange); assert(hm.sources().size() == 2); hm.estimate_geodesic_distances(vertex_distance); diff --git a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/HDT2.cpp b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/HDT2.cpp index 799db234f27..ccfb1d72a8e 100644 --- a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/HDT2.cpp +++ b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/HDT2.cpp @@ -318,7 +318,7 @@ MainWindow::on_actionInsertRandomPoints_triggered() tr("Enter number of random points"), 100, 0, - std::numeric_limits::max(), + (std::numeric_limits::max)(), 1, &ok); diff --git a/Installation/cmake/modules/config/testfiles/CGAL_CFG_NO_LIMITS.cpp b/Installation/cmake/modules/config/testfiles/CGAL_CFG_NO_LIMITS.cpp index f24d6a358f2..ba3f6dfd621 100644 --- a/Installation/cmake/modules/config/testfiles/CGAL_CFG_NO_LIMITS.cpp +++ b/Installation/cmake/modules/config/testfiles/CGAL_CFG_NO_LIMITS.cpp @@ -23,7 +23,7 @@ int main() { double d = std::numeric_limits::denorm_min(); - double e = std::numeric_limits::min(); + double e = (std::numeric_limits::min)(); // Note : denorm_min == min is actually not necessarily a bug. // So a better test should be found. if (d == 0 || d == e) diff --git a/Kernel_23/include/CGAL/Dimension.h b/Kernel_23/include/CGAL/Dimension.h index 1b62f8ca27f..196ed55b569 100644 --- a/Kernel_23/include/CGAL/Dimension.h +++ b/Kernel_23/include/CGAL/Dimension.h @@ -25,7 +25,7 @@ namespace CGAL { #ifdef CGAL_EIGEN3_ENABLED const int UNKNOWN_DIMENSION=Eigen::Dynamic; #else -const int UNKNOWN_DIMENSION=std::numeric_limits::max(); +const int UNKNOWN_DIMENSION=(std::numeric_limits::max)(); #endif // Check that dimension d1 is fine for a kernel of dimension d2. diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/IO_off.cpp b/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/IO_off.cpp index 1b228aad772..8ca7be25469 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/IO_off.cpp +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/IO_off.cpp @@ -58,7 +58,7 @@ bool read_off_ascii(Surface_mesh& mesh, // #Vertice, #Faces, #Edges items = fscanf(in, "%d %d %d\n", (int*)&nV, (int*)&nF, (int*)&nE); mesh.clear(); - mesh.reserve(nV, std::max(3*nV, nE), nF); + mesh.reserve(nV, (std::max)(3*nV, nE), nF); // read vertices: pos [normal] [color] [texcoord] @@ -173,7 +173,7 @@ bool read_off_binary(Surface_mesh& mesh, read(in, nF); read(in, nE); mesh.clear(); - mesh.reserve(nV, std::max(3*nV, nE), nF); + mesh.reserve(nV, (std::max)(3*nV, nE), nF); // read vertices: pos [normal] [color] [texcoord] diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/Vector.h b/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/Vector.h index 7274501b5f4..8f9487c28cc 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/Vector.h +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_2/surface_mesh/Vector.h @@ -210,7 +210,7 @@ public: Vector& normalize() { Scalar n = norm(*this); - if (n > std::numeric_limits::min()) + if (n > (std::numeric_limits::min)()) *this *= 1.0/n; return *this; } @@ -500,7 +500,7 @@ public: Vector& normalize() { Scalar n = norm(*this); - n = (n > std::numeric_limits::min()) ? 1.0/n : 0.0; + n = (n > (std::numeric_limits::min)()) ? 1.0/n : 0.0; x *= n; y *= n; z *= n; diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_3/cgogn_performance_3.h b/Linear_cell_complex/benchmark/Linear_cell_complex_3/cgogn_performance_3.h index b780ccd231d..fd91d3dde0a 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_3/cgogn_performance_3.h +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_3/cgogn_performance_3.h @@ -63,7 +63,7 @@ private: Dart getShortestEdge() { - double weight = std::numeric_limits::max(); + double weight = (std::numeric_limits::max)(); Dart dart = NIL; bool boundary=false; diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_3/lcc_performance_3.h b/Linear_cell_complex/benchmark/Linear_cell_complex_3/lcc_performance_3.h index 1a901d1d34e..f16d3dd6243 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_3/lcc_performance_3.h +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_3/lcc_performance_3.h @@ -319,7 +319,7 @@ private: Dart_handle getShortestEdge() { - double weight = std::numeric_limits::max(); + double weight = (std::numeric_limits::max)(); Dart_handle dart = lcc.null_dart_handle; int m=lcc.get_new_mark(); diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_3/openvolumemesh_performance.h b/Linear_cell_complex/benchmark/Linear_cell_complex_3/openvolumemesh_performance.h index 929d9ff8313..f9a30b83476 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_3/openvolumemesh_performance.h +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_3/openvolumemesh_performance.h @@ -129,7 +129,7 @@ private: // Find the mesh's shortest edge EdgeHandle getShortestEdge() { - double max_weight = std::numeric_limits::max(); + double max_weight = (std::numeric_limits::max)(); EdgeHandle eh = Mesh::InvalidEdgeHandle; bool boundary=false; diff --git a/Mesh_3/archive/applications/CGAL/min_dihedral_angle.h b/Mesh_3/archive/applications/CGAL/min_dihedral_angle.h index b3594e4837b..2bbae4319dc 100644 --- a/Mesh_3/archive/applications/CGAL/min_dihedral_angle.h +++ b/Mesh_3/archive/applications/CGAL/min_dihedral_angle.h @@ -32,15 +32,15 @@ class Compute_min_angle operator()(const Cell_handle ch) const { double min_quotient = compute_quotient(ch, 0, 1, 2, 3); - min_quotient = std::min(min_quotient, + min_quotient = (std::min)(min_quotient, compute_quotient(ch, 0, 2, 1, 3)); - min_quotient = std::min(min_quotient, + min_quotient = (std::min)(min_quotient, compute_quotient(ch, 0, 3, 1, 2)); - min_quotient = std::min(min_quotient, + min_quotient = (std::min)(min_quotient, compute_quotient(ch, 1, 2, 0, 3)); - min_quotient = std::min(min_quotient, + min_quotient = (std::min)(min_quotient, compute_quotient(ch, 1, 3, 0, 2)); - min_quotient = std::min(min_quotient, + min_quotient = (std::min)(min_quotient, compute_quotient(ch, 2, 3, 0, 1)); const double volume = CGAL::to_double(tr.tetrahedron(ch).volume()); @@ -119,19 +119,19 @@ namespace CGAL { min_dihedral_angle_aux_compute_quotient(p0, p1, p2, p3, k); min_quotient = - std::min(min_quotient, + (std::min)(min_quotient, min_dihedral_angle_aux_compute_quotient(p0, p2, p1, p3, k)); min_quotient = - std::min(min_quotient, + (std::min)(min_quotient, min_dihedral_angle_aux_compute_quotient(p0, p3, p1, p2, k)); min_quotient = - std::min(min_quotient, + (std::min)(min_quotient, min_dihedral_angle_aux_compute_quotient(p1, p2, p0, p3, k)); min_quotient = - std::min(min_quotient, + (std::min)(min_quotient, min_dihedral_angle_aux_compute_quotient(p1, p3, p0, p2, k)); min_quotient = - std::min(min_quotient, + (std::min)(min_quotient, min_dihedral_angle_aux_compute_quotient(p2, p3, p0, p1, k)); // std::cerr << CGAL::sqrt(min_quotient) << " - " diff --git a/Mesh_3/include/CGAL/Mesh_3/Sizing_grid.h b/Mesh_3/include/CGAL/Mesh_3/Sizing_grid.h index 8969c9caf5f..9fe82752715 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Sizing_grid.h +++ b/Mesh_3/include/CGAL/Mesh_3/Sizing_grid.h @@ -443,7 +443,7 @@ private: pNode->ref_node(candidate.ref_node()); pNode->size() = candidate.size(); pNode->done() = true; - m_max_size = std::max(m_max_size,pNode->size()); + m_max_size = (std::max)(m_max_size,pNode->size()); // explore neighbors for(unsigned int index_neighbor = 0; diff --git a/Nef_3/archive/Visual_hull/Nef_3/visual_hull_creator.h b/Nef_3/archive/Visual_hull/Nef_3/visual_hull_creator.h index 244da5108ae..857c5af1736 100644 --- a/Nef_3/archive/Visual_hull/Nef_3/visual_hull_creator.h +++ b/Nef_3/archive/Visual_hull/Nef_3/visual_hull_creator.h @@ -87,9 +87,9 @@ class visual_hull_creator : public CGAL::Modifier_base { public: - visual_hull_creator(Point_3 min, Point_3 max, Point_3 position, + visual_hull_creator(Point_3 pmin, Point_3 pmax, Point_3 position, std::list > p) : - room_min(min), room_max(max), c_pos(position), polygon_list(p) { } + room_min(pmin), room_max(pmax), c_pos(position), polygon_list(p) { } /* void recompute_scene() { diff --git a/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h b/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h index 586527a21c5..75f7f378dac 100644 --- a/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h +++ b/Nef_3/include/CGAL/Nef_3/Infimaximal_box.h @@ -375,24 +375,24 @@ class Infimaximal_box { C.create_vertices_of_box_with_plane(h, b); } - static void compute_min_max(const Plane_3& h, NT orth_coords[3], int& min, int& max) { + static void compute_min_max(const Plane_3& h, NT orth_coords[3], int& cmin, int& cmax) { Vector_3 orth = h.orthogonal_vector(); orth_coords[0] = CGAL_NTS abs(orth.hx()[0]); orth_coords[1] = CGAL_NTS abs(orth.hy()[0]); orth_coords[2] = CGAL_NTS abs(orth.hz()[0]); - max = 0; + cmax = 0; if(orth_coords[1] > orth_coords[0]) - max = 1; - if(orth_coords[2] > orth_coords[max]) - max = 2; + cmax = 1; + if(orth_coords[2] > orth_coords[cmax]) + cmax = 2; - min = 0; + cmin = 0; if(orth_coords[1] < orth_coords[0]) - min = 1; - if(orth_coords[2] < orth_coords[min]) - min = 2; + cmin = 1; + if(orth_coords[2] < orth_coords[cmin]) + cmin = 2; } template diff --git a/Number_types/include/CGAL/Quotient.h b/Number_types/include/CGAL/Quotient.h index 5c91f07d2cf..38e5f834768 100644 --- a/Number_types/include/CGAL/Quotient.h +++ b/Number_types/include/CGAL/Quotient.h @@ -142,7 +142,7 @@ class Quotient } #ifdef CGAL_ROOT_OF_2_ENABLE_HISTOGRAM_OF_NUMBER_OF_DIGIT_ON_THE_COMPLEX_CONSTRUCTOR - int tam() const { return std::max(num.tam(), den.tam()); } + int tam() const { return (std::max)(num.tam(), den.tam()); } #endif public: diff --git a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/IO/File_medit.h b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/IO/File_medit.h index 3900a07a3af..7c07c643eda 100644 --- a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/IO/File_medit.h +++ b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/IO/File_medit.h @@ -43,9 +43,9 @@ canonicalize_triangle(const typename Triangulation::Periodic_triangle& pt) Offset o0 = pt[0].second; Offset o1 = pt[1].second; Offset o2 = pt[2].second; - int diffx = std::min(o0.x(), std::min(o1.x(), o2.x())); - int diffy = std::min(o0.y(), std::min(o1.y(), o2.y())); - int diffz = std::min(o0.z(), std::min(o1.z(), o2.z())); + int diffx = (std::min)(o0.x(), (std::min)(o1.x(), o2.x())); + int diffy = (std::min)(o0.y(), (std::min)(o1.y(), o2.y())); + int diffz = (std::min)(o0.z(), (std::min)(o1.z(), o2.z())); Offset diff_off(diffx, diffy, diffz); return CGAL::make_array(std::make_pair(pt[0].first, o0 - diff_off), @@ -64,9 +64,9 @@ canonicalize_tetrahedron(const typename Triangulation::Periodic_tetrahedron& pt) Offset o2 = pt[2].second; Offset o3 = pt[3].second; - int diffx = std::min(std::min(o0.x(), o1.x()), std::min(o2.x(), o3.x())); - int diffy = std::min(std::min(o0.y(), o1.y()), std::min(o2.y(), o3.y())); - int diffz = std::min(std::min(o0.z(), o1.z()), std::min(o2.z(), o3.z())); + int diffx = (std::min)((std::min)(o0.x(), o1.x()), (std::min)(o2.x(), o3.x())); + int diffy = (std::min)((std::min)(o0.y(), o1.y()), (std::min)(o2.y(), o3.y())); + int diffz = (std::min)((std::min)(o0.z(), o1.z()), (std::min)(o2.z(), o3.z())); Offset diff_off(diffx, diffy, diffz); return CGAL::make_array(std::make_pair(pt[0].first, o0 - diff_off), diff --git a/Periodic_3_mesh_3/test/Periodic_3_mesh_3/test_triply_periodic_minimal_surfaces.cpp b/Periodic_3_mesh_3/test/Periodic_3_mesh_3/test_triply_periodic_minimal_surfaces.cpp index e7ff3beeacb..812fde428ba 100644 --- a/Periodic_3_mesh_3/test/Periodic_3_mesh_3/test_triply_periodic_minimal_surfaces.cpp +++ b/Periodic_3_mesh_3/test/Periodic_3_mesh_3/test_triply_periodic_minimal_surfaces.cpp @@ -184,18 +184,18 @@ struct Segments_function Segments_function() : segments(), nb_evals(0) { - const FT min = 1, max = 3; - const FT mid = 0.5 * (min + max); + const FT vmin = 1, vmax = 3; + const FT mid = 0.5 * (vmin + vmax); const Point pmid(mid, mid, mid); - segments.push_back(Segment(Point(min, mid, min), pmid)); - segments.push_back(Segment(Point(max, mid, min), pmid)); - segments.push_back(Segment(Point(min, mid, max), pmid)); - segments.push_back(Segment(Point(max, mid, max), pmid)); - segments.push_back(Segment(Point(mid, min, min), pmid)); - segments.push_back(Segment(Point(mid, max, min), pmid)); - segments.push_back(Segment(Point(mid, min, max), pmid)); - segments.push_back(Segment(Point(mid, max, max), pmid)); + segments.push_back(Segment(Point(vmin, mid, vmin), pmid)); + segments.push_back(Segment(Point(vmax, mid, vmin), pmid)); + segments.push_back(Segment(Point(vmin, mid, vmax), pmid)); + segments.push_back(Segment(Point(vmax, mid, vmax), pmid)); + segments.push_back(Segment(Point(mid, vmin, vmin), pmid)); + segments.push_back(Segment(Point(mid, vmax, vmin), pmid)); + segments.push_back(Segment(Point(mid, vmin, vmax), pmid)); + segments.push_back(Segment(Point(mid, vmax, vmax), pmid)); } FT operator()(const Point& p) @@ -204,7 +204,7 @@ struct Segments_function FT min_distance = 1000000; for (Segments::const_iterator si = segments.begin(); si != segments.end(); ++si) - min_distance = std::min(CGAL::squared_distance(p, *si), min_distance); + min_distance = (std::min)(CGAL::squared_distance(p, *si), min_distance); return min_distance - 0.01; // Change the squared beam radius here } diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_periodic_3_static_filters.h b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_periodic_3_static_filters.h index f2e86a52bb6..777e1a8b4c1 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_periodic_3_static_filters.h +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_periodic_3_static_filters.h @@ -61,17 +61,17 @@ Point my_rand_p3() } // Random int in [0;256). -int my_rand_int(int min, int max) +int my_rand_int(int imin, int imax) { - return r->get_int(min, max+1); + return r->get_int(imin, imax+1); } // Random offset -Offset my_rand_o3(int min, int max) +Offset my_rand_o3(int imin, int imax) { - int x = my_rand_int(min,max); - int y = my_rand_int(min,max); - int z = my_rand_int(min,max); + int x = my_rand_int(imin,imax); + int y = my_rand_int(imin,imax); + int z = my_rand_int(imin,imax); return Offset(x, y, z); } diff --git a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/P4HDT2.cpp b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/P4HDT2.cpp index ffaf11c3eff..9df877ad6e0 100644 --- a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/P4HDT2.cpp +++ b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/P4HDT2.cpp @@ -351,7 +351,7 @@ MainWindow::on_actionInsertRandomPoints_triggered() tr("Enter number of random points"), 100, 0, - std::numeric_limits::max(), + (std::numeric_limits::max)(), 1, &ok); diff --git a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2.h b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2.h index cb76b7b56a7..a6e6d7aceeb 100644 --- a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2.h +++ b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2.h @@ -608,15 +608,15 @@ protected: } // Now we know that all vertices lie in different regions. - Hyperbolic_translation min(7, 2, 5); + Hyperbolic_translation vmin(7, 2, 5); Hyperbolic_translation trans; for(int i=0; i<3; ++i) { int j = (i + 1) % 3; // the index of the 'next' vertex Hyperbolic_translation tmp = fh->translation(i).inverse() * fh->translation(j); - if(tmp < min) + if(tmp < vmin) { - min = tmp; + vmin = tmp; trans = fh->translation(i).inverse(); } } 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 30377ebaf9c..36d585d4e0f 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 @@ -52,9 +52,9 @@ class Traversal_traits_with_transformation_helper AK::Aff_transformation_3 a_at = c2f(at); - AK::FT xtrm[6] = { c2f(bbox.min(0)), c2f(bbox.max(0)), - c2f(bbox.min(1)), c2f(bbox.max(1)), - c2f(bbox.min(2)), c2f(bbox.max(2)) }; + AK::FT xtrm[6] = { c2f((bbox.min)(0)), c2f((bbox.max)(0)), + c2f((bbox.min)(1)), c2f((bbox.max)(1)), + c2f((bbox.min)(2)), c2f((bbox.max)(2)) }; typename AK::Point_3 ps[8]; ps[0] = a_at( AK::Point_3(xtrm[0], xtrm[2], xtrm[4]) ); @@ -84,9 +84,9 @@ class Traversal_traits_with_transformation_helper AK::Aff_transformation_3 a_at = c2f(at); - AK::FT xtrm[6] = { c2f(bbox.min(0)), c2f(bbox.max(0)), - c2f(bbox.min(1)), c2f(bbox.max(1)), - c2f(bbox.min(2)), c2f(bbox.max(2)) }; + AK::FT xtrm[6] = { c2f((bbox.min)(0)), c2f((bbox.max)(0)), + c2f((bbox.min)(1)), c2f((bbox.max)(1)), + c2f((bbox.min)(2)), c2f((bbox.max)(2)) }; typename AK::Point_3 ps[2]; ps[0] = a_at( AK::Point_3(xtrm[0], xtrm[2], xtrm[4]) ); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h index 02a0422d5d6..31a2d22a974 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h @@ -1044,7 +1044,7 @@ std::size_t snap_border_vertices_non_conforming(TriangleMesh& pm1, border_halfedges(pm2, std::back_inserter(border_vertices2)); Tolerance_map tol_pmap = get(Vertex_property_tag(), pm1); - const FT tol_mx(std::numeric_limits::max()); + const FT tol_mx((std::numeric_limits::max)()); internal::assign_tolerance_with_local_edge_length_bound(border_vertices1, tol_pmap, tol_mx, pm1); return snap_vertex_range_onto_vertex_range_non_conforming(border_vertices1, pm1, diff --git a/Polygonal_surface_reconstruction/include/CGAL/internal/hypothesis.h b/Polygonal_surface_reconstruction/include/CGAL/internal/hypothesis.h index 7ffe0f5b6ee..af6a1cac0e5 100644 --- a/Polygonal_surface_reconstruction/include/CGAL/internal/hypothesis.h +++ b/Polygonal_surface_reconstruction/include/CGAL/internal/hypothesis.h @@ -374,12 +374,12 @@ namespace CGAL { Planar_segment* s = segments[i]; const Plane* plane = s->fit_supporting_plane(); // user may provide invalid plane fitting (we always fit) - FT max_dist = -std::numeric_limits::max(); + FT max_dist = -(std::numeric_limits::max)(); for (std::size_t j = 0; j < s->size(); ++j) { std::size_t idx = s->at(j); const Point& p = points[idx]; FT sdist = CGAL::squared_distance(*plane, p); - max_dist = std::max(max_dist, std::sqrt(sdist)); + max_dist = (std::max)(max_dist, std::sqrt(sdist)); } avg_max_dist += max_dist; diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 3318df58cae..bbb4aacfad1 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -991,7 +991,7 @@ void MainWindow::updateViewersBboxes(bool recenter) } -void MainWindow::computeViewerBBox(CGAL::qglviewer::Vec& min, CGAL::qglviewer::Vec& max) +void MainWindow::computeViewerBBox(CGAL::qglviewer::Vec& vmin, CGAL::qglviewer::Vec& vmax) { const Scene::Bbox bbox = scene->bbox(); const double xmin = bbox.xmin(); @@ -1003,8 +1003,8 @@ void MainWindow::computeViewerBBox(CGAL::qglviewer::Vec& min, CGAL::qglviewer::V - min = CGAL::qglviewer::Vec(xmin, ymin, zmin); - max= CGAL::qglviewer::Vec(xmax, ymax, zmax); + vmin = CGAL::qglviewer::Vec(xmin, ymin, zmin); + vmax= CGAL::qglviewer::Vec(xmax, ymax, zmax); CGAL::qglviewer::Vec bbox_center((xmin+xmax)/2, (ymin+ymax)/2, (zmin+zmax)/2); diff --git a/Polyhedron/demo/Polyhedron/MainWindow.h b/Polyhedron/demo/Polyhedron/MainWindow.h index b2d2495b263..f2a9efcd8f6 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.h +++ b/Polyhedron/demo/Polyhedron/MainWindow.h @@ -95,7 +95,7 @@ public: CGAL::Three::Polyhedron_demo_io_plugin_interface*, bool& ok, bool add_to_scene=true); - void computeViewerBBox(CGAL::qglviewer::Vec &min, CGAL::qglviewer::Vec &max); + void computeViewerBBox(CGAL::qglviewer::Vec &vmin, CGAL::qglviewer::Vec &vmax); void updateViewerBbox(Viewer* vi, bool recenter, CGAL::qglviewer::Vec min, CGAL::qglviewer::Vec max); Q_SIGNALS: diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp index ea39176633a..d88b40eced4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp @@ -527,7 +527,7 @@ void Cluster_classification::change_color (int index, float* vmin, float* vmax) int cid = m_cluster_id[*it]; if (cid != -1) { - float v = std::max (0.f, std::min(1.f, m_label_probabilities[corrected_index][cid])); + float v = std::max (0.f, (std::min)(1.f, m_label_probabilities[corrected_index][cid])); m_points->point_set()->set_color(*it, ramp.r(v) * 255, ramp.g(v) * 255, ramp.b(v) * 255); } else @@ -546,8 +546,8 @@ void Cluster_classification::change_color (int index, float* vmin, float* vmax) Feature_handle feature = m_features[corrected_index]; - float min = std::numeric_limits::max(); - float max = -std::numeric_limits::max(); + float min = (std::numeric_limits::max)(); + float max = -(std::numeric_limits::max)(); if (vmin != NULL && vmax != NULL && *vmin != std::numeric_limits::infinity() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp index a3e502c0adf..1b2c6142a6e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp @@ -429,7 +429,7 @@ void Point_set_item_classification::change_color (int index, float* vmin, float* for (Point_set::const_iterator it = m_points->point_set()->begin(); it != m_points->point_set()->first_selected(); ++ it) { - float v = std::max (0.f, std::min(1.f, m_label_probabilities[corrected_index][*it])); + float v = std::max (0.f, (std::min)(1.f, m_label_probabilities[corrected_index][*it])); m_points->point_set()->set_color(*it, ramp.r(v) * 255, ramp.g(v) * 255, ramp.b(v) * 255); } } @@ -444,8 +444,8 @@ void Point_set_item_classification::change_color (int index, float* vmin, float* } Feature_handle feature = m_features[corrected_index]; - float min = std::numeric_limits::max(); - float max = -std::numeric_limits::max(); + float min = (std::numeric_limits::max)(); + float max = -(std::numeric_limits::max)(); if (vmin != NULL && vmax != NULL && *vmin != std::numeric_limits::infinity() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.h b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.h index 80a2788cc9c..49e4b6f1eac 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.h @@ -124,8 +124,8 @@ class Point_set_item_classification : public Item_classification_base for (std::size_t i = 0; i < m_features.size(); ++ i) { - float vmin = std::numeric_limits::max(); - float vmax = -std::numeric_limits::max(); + float vmin = (std::numeric_limits::max)(); + float vmax = -(std::numeric_limits::max)(); float vmean = 0.f; std::size_t nb = 0; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp index 216f55c586e..f957d826214 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp @@ -151,7 +151,7 @@ void Surface_mesh_item_classification::change_color (int index, float* vmin, flo { for(face_descriptor fd : faces(*(m_mesh->polyhedron()))) { - float v = std::max (0.f, std::min(1.f, m_label_probabilities[corrected_index][fd])); + float v = std::max (0.f, (std::min)(1.f, m_label_probabilities[corrected_index][fd])); m_color[fd] = CGAL::Color((unsigned char)(ramp.r(v) * 255), (unsigned char)(ramp.g(v) * 255), (unsigned char)(ramp.b(v) * 255)); @@ -169,8 +169,8 @@ void Surface_mesh_item_classification::change_color (int index, float* vmin, flo Feature_handle feature = m_features[corrected_index]; - float min = std::numeric_limits::max(); - float max = -std::numeric_limits::max(); + float min = (std::numeric_limits::max)(); + float max = -(std::numeric_limits::max)(); if (vmin != NULL && vmax != NULL && *vmin != std::numeric_limits::infinity() diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp index 57b23a66f33..13bf84315e3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp @@ -116,9 +116,9 @@ bool Create_bbox_mesh_plugin::bbox(bool extended) bbox.zmax() + delta_z); } - if(bbox.min(0) > bbox.max(0) || - bbox.min(1) > bbox.max(1) || - bbox.min(2) > bbox.max(2)) + if((bbox.min)(0) > (bbox.max)(0) || + (bbox.min)(1) > (bbox.max)(1) || + (bbox.min)(2) > (bbox.max)(2)) { return false; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp index c81ee8e029e..cada4c95506 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp @@ -392,16 +392,16 @@ void Scene_edit_box_item::compute_bbox() const const CGAL::qglviewer::Vec offset = static_cast(CGAL::QGLViewer::QGLViewerPool().first())->offset(); - QVector3D min(d->pool[0], d->pool[1], d->pool[2]); - QVector3D max(d->pool[3], d->pool[4], d->pool[5]); + QVector3D vmin(d->pool[0], d->pool[1], d->pool[2]); + QVector3D vmax(d->pool[3], d->pool[4], d->pool[5]); for(int i=0; i< 3; ++i) { - min[i] += d->frame->translation()[i]-d->center_[i]-offset[i]; - max[i] += d->frame->translation()[i]-d->center_[i]-offset[i]; + vmin[i] += d->frame->translation()[i]-d->center_[i]-offset[i]; + vmax[i] += d->frame->translation()[i]-d->center_[i]-offset[i]; } - setBbox(Scene_item::Bbox(min.x(),min.y(),min.z(),max.x(),max.y(),max.z())); + setBbox(Scene_item::Bbox(vmin.x(),vmin.y(),vmin.z(),vmax.x(),vmax.y(),vmax.z())); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index 0633e2939b8..45aa320bb73 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -490,10 +490,10 @@ public Q_SLOTS: } std::cout << "Parameterized with ARAP (SM) computed." << std::endl; - xmin = std::numeric_limits::max(); - xmax = std::numeric_limits::min(); - ymin = std::numeric_limits::max(); - ymax = std::numeric_limits::min(); + xmin = (std::numeric_limits::max)(); + xmax = (std::numeric_limits::min)(); + ymin = (std::numeric_limits::max)(); + ymax = (std::numeric_limits::min)(); uv_map_3 = sm->add_property_map("v:uv3").first; for(SMesh::Vertex_index v : sm->vertices()) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp index 1b2dbcbddb8..32305afc13b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp @@ -306,7 +306,7 @@ void Polyhedron_demo_mesh_segmentation_plugin::apply_Partition_button_clicked(Fa faces(*pair->first->face_graph())) { if(sdf_pmap[f] != -1 - && sdf_pmap[f] != std::numeric_limits::max()) + && sdf_pmap[f] != (std::numeric_limits::max)()) { has_sdf_values = true; break; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp index 4fbef08e1cc..94b2278a79a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp @@ -150,7 +150,7 @@ void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered() : 0), (ui.m_use_edge_length->isChecked() ? ui.m_edge_length->value() - : std::numeric_limits::max())); + : (std::numeric_limits::max)())); if (selection_item) { diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp index 182b3056499..24ce42878eb 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp @@ -438,9 +438,9 @@ void Polyhedron_demo_offset_meshing_plugin::offset_meshing() } else if(soup_item == 0) return; - double X=box.max(0)-box.min(0), - Y = box.max(1)-box.min(1), - Z = box.max(2)-box.min(2); + double X=(box.max)(0)-(box.min)(0), + Y = (box.max)(1)-(box.min)(1), + Z = (box.max)(2)-(box.min)(2); diag = CGAL::sqrt(X*X+Y*Y+Z*Z); double offset_value = QInputDialog::getDouble(mw, QString("Choose Offset Value"), diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp index 94ce8d2c0cb..82edf798ddb 100644 --- a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp @@ -395,10 +395,10 @@ struct Scene_c3t3_item_priv { void invalidate_stats() { - min_edges_length = std::numeric_limits::max(); + min_edges_length = (std::numeric_limits::max)(); max_edges_length = 0; mean_edges_length = 0; - min_dihedral_angle = std::numeric_limits::max(); + min_dihedral_angle = (std::numeric_limits::max)(); max_dihedral_angle = 0; mean_dihedral_angle = 0; nb_subdomains = 0; @@ -406,8 +406,8 @@ struct Scene_c3t3_item_priv { nb_cnc = 0; nb_vertices = 0; nb_tets = 0; - smallest_radius_radius = std::numeric_limits::max(); - smallest_edge_radius = std::numeric_limits::max(); + smallest_radius_radius = (std::numeric_limits::max)(); + smallest_edge_radius = (std::numeric_limits::max)(); biggest_v_sma_cube = 0; computed_stats = false; } diff --git a/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp index e9bebd70d6c..b605055b44d 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp @@ -39,7 +39,7 @@ struct Scene_polylines_item_private { { nb_vertices = 0; nb_edges = 0; - min_length = std::numeric_limits::max(); + min_length = (std::numeric_limits::max)(); max_length = 0; mean_length = 0; computed_stats = false; diff --git a/Polynomial/include/CGAL/Polynomial/bezout_matrix.h b/Polynomial/include/CGAL/Polynomial/bezout_matrix.h index a4e06d7145b..3b8f3447ec0 100644 --- a/Polynomial/include/CGAL/Polynomial/bezout_matrix.h +++ b/Polynomial/include/CGAL/Polynomial/bezout_matrix.h @@ -109,8 +109,8 @@ hybrid_bezout_matrix(typename Polynomial_traits_d::Polynomial_d f, B[i-sub-1][j-1] = s; } } - for (i = std::max(m+1, 1+sub); i <= n; i++) { - for (j = i-m; j <= std::min(i, n-sub); j++) { + for (i = (std::max)(m+1, 1+sub); i <= n; i++) { + for (j = i-m; j <= (std::min)(i, n-sub); j++) { B[i-sub-1][j-1] = coeff(g,i-j); } } diff --git a/Shape_detection/test/Shape_detection/include/test_efficient_RANSAC_generators.h b/Shape_detection/test/Shape_detection/include/test_efficient_RANSAC_generators.h index 3cb8d771b5d..fc9d7c9cd99 100644 --- a/Shape_detection/test/Shape_detection/include/test_efficient_RANSAC_generators.h +++ b/Shape_detection/test/Shape_detection/include/test_efficient_RANSAC_generators.h @@ -22,8 +22,8 @@ #include template -fl_t random_float(fl_t min, fl_t max) { - return fl_t(CGAL::get_default_random().get_double(min, max)); +fl_t random_float(fl_t fmin, fl_t fmax) { + return fl_t(CGAL::get_default_random().get_double(fmin, fmax)); } template diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/test.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/test.h index e7d6f9e43d7..c8e7479aad5 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/test.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/test.h @@ -137,8 +137,8 @@ inline bool is_time_clearly_not_within_possibly_inexact_bisector_time_interval( { FT lSrcT = aBisector->opposite()->vertex()->time() ; FT lTgtT = aBisector->vertex()->time() ; - FT lLoT = std::min(lSrcT,lTgtT); - FT lHiT = std::max(lSrcT,lTgtT); + FT lLoT = (std::min)(lSrcT,lTgtT); + FT lHiT = (std::max)(lSrcT,lTgtT); return ( aT < lLoT || aT > lHiT ) && is_possibly_inexact_time_clearly_not_equal_to(aT,lLoT) @@ -150,8 +150,8 @@ inline bool is_time_clearly_within_possibly_inexact_bisector_time_interval( FT c { FT lSrcT = aBisector->opposite()->vertex()->time() ; FT lTgtT = aBisector->vertex()->time() ; - FT lLoT = std::min(lSrcT,lTgtT); - FT lHiT = std::max(lSrcT,lTgtT); + FT lLoT = (std::min)(lSrcT,lTgtT); + FT lHiT = (std::max)(lSrcT,lTgtT); return ( lLoT < aT && aT < lHiT ) && is_possibly_inexact_time_clearly_not_equal_to(aT,lLoT) diff --git a/Stream_support/test/Stream_support/test_read_WKT.cpp b/Stream_support/test/Stream_support/test_read_WKT.cpp index e1324a0abe5..94bcc1f9234 100644 --- a/Stream_support/test/Stream_support/test_read_WKT.cpp +++ b/Stream_support/test/Stream_support/test_read_WKT.cpp @@ -18,10 +18,10 @@ int main() { typedef CGAL::Point_2 Point; typedef std::vector Linestring; - typedef CGAL::Polygon_with_holes_2 Polygon; + typedef CGAL::Polygon_with_holes_2 Cgal_polygon; typedef std::vector MultiPoint; typedef std::vector MultiLinestring; - typedef std::vector MultiPolygon; + typedef std::vector MultiPolygon; Point p; { @@ -38,7 +38,7 @@ int main() CGAL_assertion(ls.size() == 3); } { - Polygon poly; + Cgal_polygon poly; std::ifstream in("data/polygon.wkt"); CGAL::read_polygon_WKT(in, poly); in.close(); diff --git a/Stream_support/test/Stream_support/test_write_WKT.cpp b/Stream_support/test/Stream_support/test_write_WKT.cpp index 5fdfb77557c..abe5b34f098 100644 --- a/Stream_support/test/Stream_support/test_write_WKT.cpp +++ b/Stream_support/test/Stream_support/test_write_WKT.cpp @@ -16,10 +16,10 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Point_2 Point; typedef std::vector Linestring; -typedef CGAL::Polygon_with_holes_2 Polygon; +typedef CGAL::Polygon_with_holes_2 Cgal_polygon; typedef std::vector MultiPoint; typedef std::vector MultiLinestring; -typedef std::vector MultiPolygon; +typedef std::vector MultiPolygon; double fRand(double fMin, double fMax) { @@ -42,7 +42,7 @@ Linestring generate_linestring() ls.push_back(generate_point(0,15,0,15)); return ls; } -Polygon generate_polygon() +Cgal_polygon generate_polygon() { Point bl,br, t; bl = generate_point(-10,-5, -10, -5); @@ -56,22 +56,22 @@ Polygon generate_polygon() xt(t.x()), ymin(bl.y()), ymid((ymax+ymin)/4.0); - Polygon::Polygon_2 border; + Cgal_polygon::Polygon_2 border; border.push_back(bl); border.push_back(t); border.push_back(br); - Polygon::Polygon_2 hole1; + Cgal_polygon::Polygon_2 hole1; hole1.push_back(Point((xt+xmax)/2, (ymin+ymid)/2)); hole1.push_back(Point(((xt+xmax)/2), ymid)); hole1.push_back(Point(xt+(xmax-xt)/4, (ymin+ymid)/2)); - Polygon::Polygon_2 hole2; + Cgal_polygon::Polygon_2 hole2; hole2.push_back(Point((xt+xmin)/2, (ymin+ymid)/2)); hole2.push_back(Point(((xt+xmin)/2), ymid)); hole2.push_back(Point(xmin+(xt-xmin)/4, (ymin+ymid)/2)); - Polygon::Holes_container holes; + Cgal_polygon::Holes_container holes; holes.push_back(hole1); holes.push_back(hole2); - return Polygon(border, holes.begin(), holes.end()); + return Cgal_polygon(border, holes.begin(), holes.end()); } MultiPoint generate_multipoint() { @@ -91,7 +91,7 @@ MultiLinestring generate_multilinestring() } MultiPolygon generate_multipolygon() { - Polygon p1=generate_polygon(), + Cgal_polygon p1=generate_polygon(), p2=generate_polygon(); MultiPolygon polies; polies.push_back(p1); @@ -134,14 +134,14 @@ int main() CGAL_assertion(ls == test_ls); - Polygon poly = generate_polygon(); + Cgal_polygon poly = generate_polygon(); { std::ofstream os("test.wkt"); os.precision(17); CGAL::write_polygon_WKT(os, poly); os.close(); } - Polygon test_poly; + Cgal_polygon test_poly; { std::ifstream is("test.wkt"); CGAL::read_polygon_WKT(is, test_poly); diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Properties.h b/Surface_mesh/include/CGAL/Surface_mesh/Properties.h index da202c8136f..72321a4c5a7 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Properties.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Properties.h @@ -440,7 +440,7 @@ public: { for (std::size_t i=0; ireserve(n); - capacity_ = std::max(n, capacity_); + capacity_ = (std::max)(n, capacity_); } // resize all arrays to size n @@ -465,7 +465,7 @@ public: for (std::size_t i=0; ipush_back(); ++size_; - capacity_ = (std::max(size_, capacity_)); + capacity_ = ((std::max)(size_, capacity_)); } // reset element to its default property values diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index 7a532a9c1e0..94910a80d59 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -64,17 +64,17 @@ namespace CGAL { typedef boost::uint32_t size_type; /// Constructor. %Default construction creates an invalid index. /// We write -1, which is - /// std::numeric_limits::max() + /// (std::numeric_limits::max)() /// as `size_type` is an unsigned type. explicit SM_Index(size_type _idx=(std::numeric_limits::max)()) : idx_(_idx) {} /// Get the underlying index of this index operator size_type() const { return idx_; } - /// reset index to be invalid (index=std::numeric_limits::max()) + /// reset index to be invalid (index=(std::numeric_limits::max)()) void reset() { idx_=(std::numeric_limits::max)(); } - /// return whether the index is valid, i.e., the index is not equal to `%std::numeric_limits::max()`. + /// return whether the index is valid, i.e., the index is not equal to `%(std::numeric_limits::max)()`. bool is_valid() const { size_type inf = (std::numeric_limits::max)(); return idx_ != inf; @@ -212,10 +212,10 @@ namespace CGAL { // compatibility with OpenMesh handles size_type idx() const { return (size_type)halfedge_ / 2; } - // resets index to be invalid (index=std::numeric_limits::max()) + // resets index to be invalid (index=(std::numeric_limits::max)()) void reset() { halfedge_.reset(); } - // returns whether the index is valid, i.e., the index is not equal to std::numeric_limits::max(). + // returns whether the index is valid, i.e., the index is not equal to (std::numeric_limits::max)(). bool is_valid() const { return halfedge_.is_valid(); } // Are two indices equal? diff --git a/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h b/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h index 1547b8b7625..bd229b3fa06 100644 --- a/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h +++ b/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h @@ -54,7 +54,7 @@ #include #endif -#define CGAL_VSA_INVALID_TAG std::numeric_limits::max() +#define CGAL_VSA_INVALID_TAG (std::numeric_limits::max)() namespace CGAL { diff --git a/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp b/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp index 00465148257..412d7ed844f 100644 --- a/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp +++ b/Surface_mesh_shortest_path/benchmark/Surface_mesh_shortest_path/benchmark_shortest_paths.cpp @@ -99,8 +99,8 @@ public: } else { - m_minimum = std::min(m_minimum, sample); - m_maximum = std::max(m_maximum, sample); + m_minimum = (std::min)(m_minimum, sample); + m_maximum = (std::max)(m_maximum, sample); } m_sum += sample; ++m_numSamples; @@ -227,7 +227,7 @@ void run_benchmarks(CGAL::Random& rand, size_t numTrials, size_t numSources, siz outData.constructionTime.add_sample(elapsed.wall); #if !defined(NDEBUG) - outData.peakMemoryUsage.add_sample(std::max(shortestPaths.peak_memory_usage(), shortestPaths.current_memory_usage())); + outData.peakMemoryUsage.add_sample((std::max)(shortestPaths.peak_memory_usage(), shortestPaths.current_memory_usage())); #endif for (size_t j = 0; j < numQueries; ++j) @@ -333,4 +333,4 @@ int main(int argc, char* argv[]) } return EXIT_SUCCESS; -} \ No newline at end of file +} diff --git a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h index 7836a0c9cf5..5834bd7922e 100644 --- a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h +++ b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h @@ -413,7 +413,7 @@ public: + (sizeof(Cone_expansion_event) + (sizeof(Cone_expansion_event*)) * m_peakQueueSize) + (sizeof(Cone_tree_node) * m_nodesAtPeakQueue); - return std::max(peakNodeUsage, peakQueueUsage); + return (std::max)(peakNodeUsage, peakQueueUsage); } /// \endcond diff --git a/Surface_mesher/archive/include/CGAL/enriched_polyhedron.h b/Surface_mesher/archive/include/CGAL/enriched_polyhedron.h index a3511e99a60..f29d2bd4399 100644 --- a/Surface_mesher/archive/include/CGAL/enriched_polyhedron.h +++ b/Surface_mesher/archive/include/CGAL/enriched_polyhedron.h @@ -323,13 +323,13 @@ public : { const Point& p = pVertex->point(); - xmin = std::min(xmin,p.x()); - ymin = std::min(ymin,p.y()); - zmin = std::min(zmin,p.z()); + xmin = (std::min)(xmin,p.x()); + ymin = (std::min)(ymin,p.y()); + zmin = (std::min)(zmin,p.z()); - xmax = std::max(xmax,p.x()); - ymax = std::max(ymax,p.y()); - zmax = std::max(zmax,p.z()); + xmax = (std::max)(xmax,p.x()); + ymax = (std::max)(ymax,p.y()); + zmax = (std::max)(zmax,p.z()); } m_bbox = Iso_cuboid(xmin,ymin,zmin, xmax,ymax,zmax); diff --git a/Surface_mesher/include/CGAL/vtkSurfaceMesherContourFilter.h b/Surface_mesher/include/CGAL/vtkSurfaceMesherContourFilter.h index d578e2120db..2ed27b9df3a 100644 --- a/Surface_mesher/include/CGAL/vtkSurfaceMesherContourFilter.h +++ b/Surface_mesher/include/CGAL/vtkSurfaceMesherContourFilter.h @@ -130,8 +130,8 @@ int vtkCGALSurfaceMesherContourFilter::RequestData( return 0; Gray_level_image gray_level_image(image, Value); - GT::FT radius = std::max(image.xdim() * image.vx(), - std::max(image.ydim() * image.vy(), + GT::FT radius = (std::max)(image.xdim() * image.vx(), + (std::max)(image.ydim() * image.vy(), image.zdim() * image.vz()) ); GT::Sphere_3 bounding_sphere(GT::Point_3(image.xdim() * image.vx()/2., diff --git a/Triangulation/include/CGAL/internal/Combination_enumerator.h b/Triangulation/include/CGAL/internal/Combination_enumerator.h index 32899566b08..7ffee52ff62 100644 --- a/Triangulation/include/CGAL/internal/Combination_enumerator.h +++ b/Triangulation/include/CGAL/internal/Combination_enumerator.h @@ -37,11 +37,11 @@ public: // For generating all the combinations of |k| distinct elements in the // interval [min, max] (both included) - Combination_enumerator(const int k, const int min, const int max) - : combi_(k), k_(k), min_(min), max_(max), max_at_pos_0_(max + 1 - k) + Combination_enumerator(const int k, const int imin, const int imax) + : combi_(k), k_(k), min_(imin), max_(imax), max_at_pos_0_(imax + 1 - k) { - CGAL_assertion_msg( min <= max, "min is larger than max"); - CGAL_assertion_msg( 1 <= k && k <= ( max - min + 1 ), "wrong value of k"); + CGAL_assertion_msg( imin <= imax, "min is larger than max"); + CGAL_assertion_msg( 1 <= k && k <= ( imax - imin + 1 ), "wrong value of k"); init(); } From d091c6368b0d708d13739e329d1bd5a5f2d7a4ce Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 21 Apr 2020 17:23:29 +0200 Subject: [PATCH 3/8] Fix selection..h --- BGL/include/CGAL/boost/graph/selection.h | 485 +---------------------- 1 file changed, 1 insertion(+), 484 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/selection.h b/BGL/include/CGAL/boost/graph/selection.h index 37f566098c1..eab43458238 100644 --- a/BGL/include/CGAL/boost/graph/selection.h +++ b/BGL/include/CGAL/boost/graph/selection.h @@ -26,12 +26,6 @@ #include #include -#include -#include -#include - -#include -#include namespace CGAL { @@ -72,225 +66,6 @@ extract_selection_boundary( } return out; } - -template -struct Regularization_graph -{ - typedef boost::graph_traits GT; - typedef typename GT::face_descriptor fg_face_descriptor; - typedef typename GT::face_iterator fg_face_iterator; - typedef typename GT::halfedge_descriptor fg_halfedge_descriptor; - typedef typename GT::edge_descriptor fg_edge_descriptor; - typedef typename GT::edge_iterator fg_edge_iterator; - typedef typename GT::vertex_descriptor fg_vertex_descriptor; - - typedef fg_face_descriptor vertex_descriptor; - typedef fg_face_iterator vertex_iterator; - typedef fg_edge_descriptor edge_descriptor; - typedef boost::undirected_tag directed_category; - typedef boost::disallow_parallel_edge_tag edge_parallel_category; - typedef boost::edge_list_graph_tag traversal_category; - - struct Filter_border_edges - { - FaceGraph* fg; - Filter_border_edges (FaceGraph& fg) : fg (&fg) { } - bool operator() (const fg_edge_descriptor ed) const - { - return !is_border (ed, *fg); - } - }; - - typedef boost::filter_iterator edge_iterator; - - struct Vertex_label_map - { - typedef vertex_descriptor key_type; - typedef std::size_t value_type; - typedef std::size_t& reference; - typedef boost::lvalue_property_map_tag category; - - Regularization_graph* rg; - - Vertex_label_map (Regularization_graph* rg) - : rg (rg) { } - - friend reference get (const Vertex_label_map& map, key_type k) - { - return (map.rg->labels)[get(map.rg->face_index_map,k)]; - } - friend void put (const Vertex_label_map& map, key_type k, const value_type& v) - { - (map.rg->labels)[get(map.rg->face_index_map,k)] = v; - } - }; - - struct Vertex_label_probability_map - { - typedef vertex_descriptor key_type; - typedef std::vector value_type; - typedef value_type reference; - typedef boost::readable_property_map_tag category; - - const Regularization_graph* rg; - - Vertex_label_probability_map (const Regularization_graph* rg) - : rg (rg) - { } - - friend reference get (const Vertex_label_probability_map& pmap, key_type fd) - { - double value = (1. - pmap.rg->weight) * pmap.rg->area (fd) / pmap.rg->total_area; - - std::vector out(2); - if (get(pmap.rg->is_selected_map, fd)) - { - if (pmap.rg->prevent_unselection) - out[0] = (std::numeric_limits::max)(); - else - out[0] = value; - out[1] = 0.; - } - else - { - out[0] = 0.; - out[1] = value; - } - - return out; - } - }; - - struct Edge_cost_map - { - typedef edge_descriptor key_type; - typedef double value_type; - typedef value_type reference; - typedef boost::readable_property_map_tag category; - - const Regularization_graph* rg; - - Edge_cost_map (const Regularization_graph* rg) - : rg (rg) { } - - friend reference get (const Edge_cost_map& pmap, key_type ed) - { - fg_vertex_descriptor esource = source(ed, pmap.rg->fg); - fg_vertex_descriptor etarget = target(ed, pmap.rg->fg); - - // Cost - double edge_length = std::sqrt(CGAL::squared_distance (get (pmap.rg->vertex_point_map, esource), - get (pmap.rg->vertex_point_map, etarget))); - return pmap.rg->weight * edge_length / pmap.rg->total_length; - } - }; - - FaceGraph& fg; - IsSelectedMap is_selected_map; - FaceIndexMap face_index_map; - VertexPointMap vertex_point_map; - double total_length; - double total_area; - double weight; - bool prevent_unselection; - std::vector labels; - - Regularization_graph (FaceGraph& fg, - IsSelectedMap is_selected_map, - FaceIndexMap face_index_map, - VertexPointMap vertex_point_map, - double weight, - bool prevent_unselection) - : fg (fg), - is_selected_map (is_selected_map), - face_index_map (face_index_map), - vertex_point_map (vertex_point_map), - total_length(0), - total_area(0), - weight (weight), - prevent_unselection (prevent_unselection) - { - labels.reserve(num_faces(fg)); - std::size_t nb_selected = 0; - for (fg_face_descriptor fd : faces(fg)) - { - if (get(is_selected_map,fd)) - { - labels.push_back(1); - ++ nb_selected; - } - else - labels.push_back(0); - } - - // Compute normalization factors - for (fg_edge_descriptor ed : edges(fg)) - total_length += length (ed); - for (fg_face_descriptor fd : faces(fg)) - total_area += area (fd); - } - - double length (fg_edge_descriptor ed) const - { - fg_vertex_descriptor esource = source(ed, fg); - fg_vertex_descriptor etarget = target(ed, fg); - return approximate_sqrt (typename GeomTraits::Compute_squared_distance_3() - (get (vertex_point_map, esource), - get (vertex_point_map, etarget))); - } - - double area (fg_face_descriptor fd) const - { - fg_halfedge_descriptor hd = halfedge (fd, fg); - fg_halfedge_descriptor nhd = next (hd, fg); - - return approximate_sqrt (typename GeomTraits::Compute_squared_area_3() - (get (vertex_point_map, source (hd, fg)), - get (vertex_point_map, target (hd, fg)), - get (vertex_point_map, target (nhd, fg)))); - } - - friend CGAL::Iterator_range - vertices (const Regularization_graph& graph) - { - return faces (graph.fg); - } - - friend std::size_t num_vertices (const Regularization_graph& graph) { return num_faces(graph.fg); } - - friend CGAL::Iterator_range - edges (const Regularization_graph& graph) - { - return CGAL::make_range (boost::make_filter_iterator - (Filter_border_edges(graph.fg), - begin(edges(graph.fg)), end(edges(graph.fg))), - boost::make_filter_iterator - (Filter_border_edges(graph.fg), - end(edges(graph.fg)), end(edges(graph.fg)))); - } - - friend vertex_descriptor source (edge_descriptor ed, const Regularization_graph& graph) - { - return face (halfedge (ed, graph.fg), graph.fg); - } - - friend vertex_descriptor target (edge_descriptor ed, const Regularization_graph& graph) - { - return face (opposite(halfedge (ed, graph.fg), graph.fg), graph.fg); - } - - Vertex_label_map vertex_label_map() { return Vertex_label_map(this); } - Vertex_label_probability_map vertex_label_probability_map() const - { return Vertex_label_probability_map(this); } - Edge_cost_map edge_cost_map() const - { return Edge_cost_map(this); } -}; - - } //end of namespace internal @@ -438,265 +213,6 @@ reduce_face_selection( return out; } -/*! - \ingroup PkgBGLSelectionFct - - regularizes a selection in order to minimize the length of the - border of the selection. - - The alpha expansion algorithm is used (see - `CGAL::alpha_expansion_graphcut()`) using the length of the edge - between two faces as the edge cost and the initial - selected/unselected property of a face as the face cost. - - If `prevent_unselection` is set to `true`, the cost of unselecting a - face is set to infinity, which forces the regularization to only - select new faces and ensures that the regularization keeps all - selected faces. - - \tparam TriangleMesh a model of `FaceGraph` - - \tparam IsSelectedMap a model of `ReadWritePropertyMap` with - `boost::graph_traits::%face_descriptor` as key type and - `bool` as value type - - \tparam NamedParameters a sequence of named parameters - - \param mesh the mesh containing the selected faces. - - \param is_selected indicates if a face is part of the selection. It - is updated by the function to accommodate faces added or removed - from the selection. - - \param weight sets the tradeoff between data fidelity and - regularity, ranging from 0 (no regularization at all, selection is - left unaltered) to 1 (maximum regularization, usually selects or - unselects everything so that the length of the border of the - selection is 0) - - \param np optional sequence of named parameters among the ones listed below - - \cgalNamedParamsBegin - \cgalParamBegin{face_index_map} - the property map with the indices associated to the faces of `mesh` - \cgalParamEnd - \cgalParamBegin{vertex_point_map} - the property map with the points associated to the vertices of `mesh` - \cgalParamEnd - \cgalParamBegin{prevent_unselection} - if `true` only new faces can be selected, if `false` (default) some - faces can be unselected - \cgalParamEnd - \cgalParamBegin{geom_traits} an instance of a geometric traits class, model of `Kernel`\cgalParamEnd - \cgalNamedParamsEnd -*/ -template -void -regularize_face_selection_borders( - TriangleMesh& mesh, - IsSelectedMap is_selected, - double weight, - const NamedParameters& np) -{ - using parameters::choose_parameter; - using parameters::get_parameter; - - CGAL_precondition (0.0 <= weight && weight < 1.0); - - typedef boost::graph_traits GT; - typedef typename GT::face_descriptor mesh_face_descriptor; - - typedef typename GetInitializedFaceIndexMap::type FaceIndexMap; - FaceIndexMap face_index_map = CGAL::get_initialized_face_index_map(mesh, np); - - typedef typename GetVertexPointMap::const_type VertexPointMap; - VertexPointMap vertex_point_map - = choose_parameter(get_parameter(np, internal_np::vertex_point), - get_const_property_map(vertex_point, mesh)); - - typedef typename GetGeomTraits::type Kernel; - - bool prevent_unselection = choose_parameter(get_parameter(np, internal_np::prevent_unselection), - false); - - internal::Regularization_graph - graph (mesh, is_selected, - face_index_map, - vertex_point_map, - weight, - prevent_unselection); - - alpha_expansion_graphcut (graph, - graph.edge_cost_map(), - graph.vertex_label_probability_map(), - graph.vertex_label_map(), - CGAL::parameters::vertex_index_map - (face_index_map)); - - for (mesh_face_descriptor fd : faces(mesh)) - put(is_selected, fd, graph.labels[get(face_index_map,fd)]); -} - -/// \cond SKIP_IN_MANUAL -// variant with default np -template -void -regularize_face_selection_borders( - TriangleMesh& fg, - IsSelectedMap is_selected, - double weight) -{ - regularize_face_selection_borders (fg, is_selected, weight, - CGAL::parameters::all_default()); -} -/// \endcond - -/// \cond SKIP_IN_MANUAL -// TODO: improve and document if useful -// -// Variant of regularization without graphcut but with brut-force -// local expansions. Can be interesting in some cases but too -// experimental/messy so far to be officially integrated. -template -void -regularize_face_selection_borders( - FaceGraph& fg, - IsSelectedMap is_selected, - VertexPointMap vertex_point_map) -{ - typedef boost::graph_traits GT; - typedef typename GT::face_descriptor fg_face_descriptor; - typedef typename GT::halfedge_descriptor fg_halfedge_descriptor; - typedef typename GT::edge_descriptor fg_edge_descriptor; - typedef typename GT::vertex_descriptor fg_vertex_descriptor; - - // TODO: this is a quick and dirty version, the complexity is - // crazy and it should be easy to do better (with priority queues, - // for example) - - auto border_length = - [&]() -> double - { - double out = 0.; - for(fg_edge_descriptor ed : edges(fg)) - { - fg_face_descriptor f0 = face (halfedge (ed, fg), fg); - fg_face_descriptor f1 = face (opposite(halfedge (ed, fg), fg), fg); - if (get(is_selected,f0) == get(is_selected,f1)) - continue; - - fg_vertex_descriptor esource = source(ed, fg); - fg_vertex_descriptor etarget = target(ed, fg); - - out += std::sqrt(CGAL::squared_distance (get (vertex_point_map, esource), - get (vertex_point_map, etarget))); - } - return out; - }; - - // First: try edges - while (true) - { - fg_edge_descriptor chosen; - double length_before = border_length(); - double shortest_length = length_before; - - for (fg_edge_descriptor ed : edges(fg)) - { - fg_face_descriptor selected = face (halfedge (ed, fg), fg); - fg_face_descriptor unselected = face (opposite(halfedge (ed, fg), fg), fg); - if (get(is_selected,selected) == get(is_selected,unselected)) - continue; - - if (get(is_selected, unselected)) - std::swap (selected, unselected); - - put(is_selected, unselected, true); - double length_after = border_length(); - - if (length_after < shortest_length) - { - chosen = ed; - shortest_length = length_after; - } - - // Cancel - put(is_selected, unselected, false); - } - - if (shortest_length == length_before) - break; - - fg_face_descriptor selected = face (halfedge (chosen, fg), fg); - fg_face_descriptor unselected = face (opposite(halfedge (chosen, fg), fg), fg); - if (get(is_selected,selected) == get(is_selected,unselected)) - continue; - - if (get(is_selected, unselected)) - std::swap (selected, unselected); - - put(is_selected, unselected, true); - } - - // Second: try 1-ring of vertices - while (true) - { - fg_vertex_descriptor chosen; - double length_before = border_length(); - double shortest_length = length_before; - - for (fg_vertex_descriptor vd : vertices(fg)) - { - fg_halfedge_descriptor hd = halfedge(vd, fg); - bool adjacent_to_selected = false, adjacent_to_nonselected = false; - for (fg_face_descriptor fd : faces_around_target (hd, fg)) - { - if (get(is_selected, fd)) - adjacent_to_selected = true; - else - adjacent_to_nonselected = true; - - if (adjacent_to_selected && adjacent_to_nonselected) - break; - } - - if (!(adjacent_to_selected && adjacent_to_nonselected)) - continue; - - std::vector newly_selected; - for (fg_face_descriptor fd : faces_around_target (hd, fg)) - { - if (!get(is_selected, fd)) - { - newly_selected.push_back (fd); - put(is_selected, fd, true); - } - } - double length_after = border_length(); - - if (length_after < shortest_length) - { - chosen = vd; - shortest_length = length_after; - } - - // Cancel - for (fg_face_descriptor fd : newly_selected) - put(is_selected, fd, false); - } - - if (shortest_length == length_before) - break; - - fg_halfedge_descriptor hd = halfedge (chosen, fg); - - for (fg_face_descriptor fd : faces_around_target (hd, fg)) - put(is_selected, fd, true); - } -} -/// \endcond - /*! \ingroup PkgBGLSelectionFct @@ -1146,3 +662,4 @@ bool is_selection_a_topological_disk(const FaceRange& face_selection, } //end of namespace CGAL #endif //CGAL_BOOST_GRAPH_SELECTION_H + From ec96bb3395f97cd7077a9c7351b48310be93b5f1 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 21 Apr 2020 17:26:48 +0200 Subject: [PATCH 4/8] Fix cmap --- .../include/CGAL/Combinatorial_map.h | 409 ++++-------------- 1 file changed, 80 insertions(+), 329 deletions(-) diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index 829296e124f..6a4c44af749 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -41,9 +41,6 @@ #include #include #include -#include -#include - #include #if defined( __INTEL_COMPILER ) @@ -58,16 +55,6 @@ _Pragma("GCC diagnostic ignored \"-Warray-bounds\"") #endif namespace CGAL { - // functions to allow the call to next/opposite by ADL - template - auto CM_ADL_next(Desc&& d, G&& g) { - return next(std::forward(d), std::forward(g)); - } - - template - auto CM_ADL_opposite(Desc&& d, G&& g) { - return opposite(std::forward(d), std::forward(g)); - } /** @file Combinatorial_map.h * Definition of generic dD Combinatorial map. @@ -212,27 +199,18 @@ namespace CGAL { CGAL_assertion(number_of_darts()==0); } - /** Copy the given combinatorial map 'amap' into *this. + /** Copy the given combinatorial map into *this. * Note that both CMap can have different dimensions and/or non void attributes. * @param amap the combinatorial map to copy. * @post *this is valid. */ - template - void copy(const Combinatorial_map_base& amap, - const Converters& converters, + void copy(const CMap2& amap, const Converters& converters, const DartInfoConverter& dartinfoconverter, const PointConverter& pointconverter, - boost::unordered_map - :: - Dart_const_handle, Dart_handle>* origin_to_copy=NULL, - boost::unordered_map - ::Dart_const_handle>* copy_to_origin=NULL) + boost::unordered_map* dart_mapping=nullptr) { - typedef Combinatorial_map_base CMap2; this->clear(); this->mnb_used_marks = amap.mnb_used_marks; @@ -254,113 +232,81 @@ namespace CGAL { // Create an mapping between darts of the two maps (originals->copies). // (here we cannot use CGAL::Unique_hash_map because it does not provide // iterators... - boost::unordered_map - local_dartmap; - if (origin_to_copy==NULL) // Used local_dartmap if user does not provides its own unordered_map - { origin_to_copy=&local_dartmap; } + boost::unordered_map local_dartmap; + if (dart_mapping==nullptr) + { dart_mapping=&local_dartmap; } - Dart_handle new_dart; for (typename CMap2::Dart_const_range::const_iterator it=amap.darts().begin(), itend=amap.darts().end(); it!=itend; ++it) { - new_dart=mdarts.emplace(); - init_dart(new_dart, amap.get_marks(it)); - - (*origin_to_copy)[it]=new_dart; - if (copy_to_origin!=NULL) { (*copy_to_origin)[new_dart]=it; } - - internal::Copy_dart_info_functor::run - (static_cast(amap), static_cast(*this), - it, new_dart, dartinfoconverter); + (*dart_mapping)[it]=mdarts.emplace(); + init_dart((*dart_mapping)[it], amap.get_marks(it)); + internal::Copy_dart_info_functor::run + (amap, static_cast(*this), it, (*dart_mapping)[it], + dartinfoconverter); } unsigned int min_dim=(dimension - ::iterator dartmap_iter, dartmap_iter_end=origin_to_copy->end(); - for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end; + ::iterator dartmap_iter, dartmap_iter_end=dart_mapping->end(); + for (dartmap_iter=dart_mapping->begin(); dartmap_iter!=dartmap_iter_end; ++dartmap_iter) { for (unsigned int i=0; i<=min_dim; i++) { if (!amap.is_free(dartmap_iter->first,i) && - is_free(dartmap_iter->second,i)) + (dartmap_iter->first)<(amap.beta(dartmap_iter->first,i))) { basic_link_beta(dartmap_iter->second, - (*origin_to_copy)[amap.beta(dartmap_iter->first,i)], i); + (*dart_mapping)[amap.beta(dartmap_iter->first,i)], i); } } } /** Copy attributes */ - for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end; + for (dartmap_iter=dart_mapping->begin(); dartmap_iter!=dartmap_iter_end; ++dartmap_iter) { Helper::template Foreach_enabled_attributes - < internal::Copy_attributes_functor >:: - run(static_cast(amap), static_cast(*this), + run(amap, static_cast(*this), dartmap_iter->first, dartmap_iter->second, converters, pointconverter); } - CGAL_assertion (is_valid()); + CGAL_assertion (is_valid () == 1); } - template - void copy(const Combinatorial_map_base& amap, - boost::unordered_map - ::Dart_const_handle, Dart_handle>* origin_to_copy=NULL, - boost::unordered_map - ::Dart_const_handle>* copy_to_origin=NULL) + template + void copy(const CMap2& amap, + boost::unordered_map* dart_mapping=nullptr) { - CGAL::cpp11::tuple<> converters; - Default_converter_dart_info dartinfoconverter; - Default_converter_cmap_0attributes_with_point pointconverter; - copy(amap, converters, dartinfoconverter, pointconverter, - origin_to_copy, copy_to_origin); + std::tuple<> converters; + Default_converter_dart_info dartinfoconverter; + Default_converter_cmap_0attributes_with_point pointconverter; + copy(amap, converters, dartinfoconverter, pointconverter, dart_mapping); } - template - void copy(const Combinatorial_map_base& amap, - const Converters& converters, - boost::unordered_map - ::Dart_const_handle, Dart_handle>* origin_to_copy=NULL, - boost::unordered_map - ::Dart_const_handle>* copy_to_origin=NULL) + template + void copy(const CMap2& amap, const Converters& converters, + boost::unordered_map* dart_mapping=nullptr) { - Default_converter_cmap_0attributes_with_point pointconverter; - Default_converter_dart_info dartinfoconverter; - copy(amap, converters, dartinfoconverter, pointconverter, - origin_to_copy, copy_to_origin); + Default_converter_cmap_0attributes_with_point pointconverter; + Default_converter_dart_info dartinfoconverter; + copy(amap, converters, dartinfoconverter, pointconverter, dart_mapping); } - template - void copy(const Combinatorial_map_base& amap, - const Converters& converters, + template + void copy(const CMap2& amap, const Converters& converters, const DartInfoConverter& dartinfoconverter, - boost::unordered_map - ::Dart_const_handle, Dart_handle>* origin_to_copy=NULL, - boost::unordered_map - ::Dart_const_handle>* copy_to_origin=NULL) + boost::unordered_map* dart_mapping=nullptr) { - Default_converter_cmap_0attributes_with_point pointconverter; - copy(amap, converters, dartinfoconverter, pointconverter, - origin_to_copy, copy_to_origin); + Default_converter_cmap_0attributes_with_point pointconverter; + copy(amap, converters, dartinfoconverter, pointconverter, dart_mapping); } // Copy constructor from a map having exactly the same type. @@ -368,37 +314,25 @@ namespace CGAL { { copy(amap); } // "Copy constructor" from a map having different type. - template - Combinatorial_map_base(const Combinatorial_map_base& amap) + template + Combinatorial_map_base(const CMap2& amap) { copy(amap); } // "Copy constructor" from a map having different type. - template - Combinatorial_map_base(const Combinatorial_map_base& amap, - const Converters& converters) + template + Combinatorial_map_base(const CMap2& amap, Converters& converters) { copy(amap, converters); } // "Copy constructor" from a map having different type. - template - Combinatorial_map_base(const Combinatorial_map_base& amap, - const Converters& converters, + template + Combinatorial_map_base(const CMap2& amap, Converters& converters, const DartInfoConverter& dartinfoconverter) { copy(amap, converters, dartinfoconverter); } // "Copy constructor" from a map having different type. - template - Combinatorial_map_base(const Combinatorial_map_base& amap, - const Converters& converters, + template + Combinatorial_map_base(const CMap2& amap, Converters& converters, const DartInfoConverter& dartinfoconverter, const PointConverter& pointconverter) { copy(amap, converters, dartinfoconverter, pointconverter); } @@ -451,62 +385,6 @@ namespace CGAL { } } - /** Import the given hds which should be a model of an halfedge graph. */ - template - void import_from_halfedge_graph(const HEG& heg, - boost::unordered_map - ::halfedge_descriptor, - Dart_handle>* origin_to_copy=NULL, - boost::unordered_map - ::halfedge_descriptor>* - copy_to_origin=NULL) - - { - // Create an mapping between darts of the two maps (originals->copies). - // (here we cannot use CGAL::Unique_hash_map because it does not provide - // iterators... - boost::unordered_map - ::halfedge_descriptor, - Dart_handle> local_dartmap; - if (origin_to_copy==NULL) // Used local_dartmap if user does not provides its own unordered_map - { origin_to_copy=&local_dartmap; } - - Dart_handle new_dart; - for (typename boost::graph_traits::halfedge_iterator - it=halfedges(heg).begin(), itend=halfedges(heg).end(); - it!=itend; ++it) - { - if (!CGAL::is_border(*it, heg)) - { - new_dart=mdarts.emplace(); - (*origin_to_copy)[*it]=new_dart; - if (copy_to_origin!=NULL) { (*copy_to_origin)[new_dart]=*it; } - } - } - - typename boost::unordered_map - ::halfedge_descriptor, - Dart_handle>::iterator dartmap_iter, dartmap_iter_end=origin_to_copy->end(); - for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end; - ++dartmap_iter) - { - basic_link_beta(dartmap_iter->second, - (*origin_to_copy)[CM_ADL_next(dartmap_iter->first, heg)], - 1); - - if (!CGAL::is_border(CM_ADL_opposite(dartmap_iter->first, heg), heg) && - (dartmap_iter->first)first, heg)) - { - basic_link_beta(dartmap_iter->second, - (*origin_to_copy) - [CM_ADL_opposite(dartmap_iter->first, heg)], 2); - } - } - - CGAL_assertion (is_valid()); - } - /** Clear the combinatorial map. Remove all darts and all attributes. * Note that reserved marks are not free. */ @@ -620,16 +498,6 @@ namespace CGAL { { return mdarts.iterator_to(adart); } Dart_const_handle dart_handle(const Dart& adart) const { return mdarts.iterator_to(adart); } - Dart_handle dart_handle(size_type i) - { - CGAL_assertion(darts().is_used(i)); - return mdarts.iterator_to(darts()[i]); - } - Dart_const_handle dart_handle(size_type i) const - { - CGAL_assertion(darts().is_used(i)); - return mdarts.iterator_to(darts()[i]); - } /** Return the highest dimension for which dh is not free. * @param dh a dart handle @@ -805,11 +673,6 @@ namespace CGAL { Dart_const_handle next(Dart_const_handle ADart) const { return this->template beta<1>(ADart); } - Dart_handle opposite2(Dart_handle ADart) - { return this->template beta<2>(ADart); } - Dart_const_handle opposite2(Dart_const_handle ADart) const - { return this->template beta<2>(ADart); } - template Dart_handle opposite(Dart_handle ADart) { return this->template beta(ADart); } @@ -1087,27 +950,6 @@ namespace CGAL { mnb_times_reserved_marks[amark]=0; } - template - bool belong_to_same_cell(Dart_const_handle adart1, - Dart_const_handle adart2) const - { return CGAL::belong_to_same_cell(*this, adart1, adart2); } - - template - bool is_whole_cell_unmarked(Dart_const_handle adart, size_type amark) const - { return CGAL::is_whole_cell_unmarked(*this, adart, amark); } - - template - bool is_whole_cell_marked(Dart_const_handle adart, size_type amark) const - { return CGAL::is_whole_cell_marked(*this, adart, amark); } - - template - size_type mark_cell(Dart_const_handle adart, size_type amark) const - { return CGAL::mark_cell(*this, adart, amark); } - - template - size_type unmark_cell(Dart_const_handle adart, size_type amark) const - { return CGAL::unmark_cell(*this, adart, amark); } - /** Test if this map is without boundary for a given dimension. * @param i the dimension. * @return true iff all the darts are not i-free. @@ -2458,30 +2300,6 @@ namespace CGAL { run(*this, adart, amark); } - /// Keep the biggest connected component. - /// @return the size (in number of darts) of the biggest cc. - std::size_t keep_biggest_connected_component() - { - std::map ccs; - - size_type treated=get_new_mark(); - for (auto it=darts().begin(), itend=darts().end(); it!=itend; ++it) - { - if (!is_marked(it, treated)) - { ccs[mark_cell(it, treated)]=it; } - } - - if (ccs.size()>1) - { // Here all darts are marked - this->template unmark_cell(ccs.rbegin()->second, treated); // Unmark the biggest cc - erase_marked_darts(treated); - } - - free_mark(treated); - - return ccs.rbegin()->first; - } - /** Count the marked cells (at least one marked dart). * @param amark the mark to consider. * @param avector containing the dimensions of the cells to count. @@ -2615,64 +2433,6 @@ namespace CGAL { } public: - - /// @return the positive turn between the two given darts. - // @pre beta1(d1) and d2 must belong to the same vertex. - std::size_t positive_turn(Dart_const_handle d1, Dart_const_handle d2) const - { - CGAL_assertion((!this->template is_free<1>(d1))); - /* CGAL_assertion((belong_to_same_cell<0>(this->template beta<1>(d1), - d2))); */ - - if (d2==beta<2>(d1)) { return 0; } - - Dart_const_handle dd1=d1; - std::size_t res=1; - while (beta<1>(dd1)!=d2) - { - if (this->template is_free<2>(beta<1>(dd1))) - { return (std::numeric_limits::max)(); } - - ++res; - dd1=beta<1, 2>(dd1); - - CGAL_assertion(!this->template is_free<1>(dd1)); - CGAL_assertion(beta<1>(dd1)==d2 || dd1!=d1); - } - return res; - } - - /// @return the negative turn between the two given darts. - // @pre beta1(d1) and d2 must belong to the same vertex. - std::size_t negative_turn(Dart_const_handle d1, Dart_const_handle d2) const - { - CGAL_assertion((!this->template is_free<1>(d1))); - /* CGAL_assertion((belong_to_same_cell<0>(this->template beta<1>(d1), - d2))); */ - - if (d2==beta<2>(d1)) { return 0; } - - if (this->template is_free<2>(d1) || this->template is_free<2>(d2)) - { return (std::numeric_limits::max)(); } - - d1=beta<2>(d1); - d2=beta<2>(d2); - Dart_const_handle dd1=d1; - std::size_t res=1; - while (beta<0>(dd1)!=d2) - { - if (this->template is_free<2>(beta<0>(dd1))) - { return (std::numeric_limits::max)(); } - - ++res; - dd1=beta<0, 2>(dd1); - - CGAL_assertion(!this->template is_free<0>(dd1)); - CGAL_assertion(beta<0>(dd1)==d2 || dd1!=d1); - } - return res; - } - /** Erase marked darts from the map. * Marked darts are unlinked before to be removed, thus surviving darts * are correctly linked, but the map is not necessarily valid depending @@ -3753,12 +3513,12 @@ namespace CGAL { !is_face_combinatorial_polygon(d4, 3) ) return false; // TODO do better with marks (?). - if ( belong_to_same_cell<2,1>(d1, d2) || - belong_to_same_cell<2,1>(d1, d3) || - belong_to_same_cell<2,1>(d1, d4) || - belong_to_same_cell<2,1>(d2, d3) || - belong_to_same_cell<2,1>(d2, d4) || - belong_to_same_cell<2,1>(d3, d4) ) return false; + if ( belong_to_same_cell(*this, d1, d2) || + belong_to_same_cell(*this, d1, d3) || + belong_to_same_cell(*this, d1, d4) || + belong_to_same_cell(*this, d2, d3) || + belong_to_same_cell(*this, d2, d4) || + belong_to_same_cell(*this, d3, d4) ) return false; if ( beta(d1,1,2)!=beta(d3,0) || beta(d4,0,2)!=beta(d3,1) || @@ -3851,21 +3611,21 @@ namespace CGAL { !is_face_combinatorial_polygon(d6, 4) ) return false; // TODO do better with marks. - if ( belong_to_same_cell<2,1>(d1, d2) || - belong_to_same_cell<2,1>(d1, d3) || - belong_to_same_cell<2,1>(d1, d4) || - belong_to_same_cell<2,1>(d1, d5) || - belong_to_same_cell<2,1>(d1, d6) || - belong_to_same_cell<2,1>(d2, d3) || - belong_to_same_cell<2,1>(d2, d4) || - belong_to_same_cell<2,1>(d2, d5) || - belong_to_same_cell<2,1>(d2, d6) || - belong_to_same_cell<2,1>(d3, d4) || - belong_to_same_cell<2,1>(d3, d5) || - belong_to_same_cell<2,1>(d3, d6) || - belong_to_same_cell<2,1>(d4, d5) || - belong_to_same_cell<2,1>(d4, d6) || - belong_to_same_cell<2,1>(d5, d6) ) + if ( belong_to_same_cell(*this, d1, d2) || + belong_to_same_cell(*this, d1, d3) || + belong_to_same_cell(*this, d1, d4) || + belong_to_same_cell(*this, d1, d5) || + belong_to_same_cell(*this, d1, d6) || + belong_to_same_cell(*this, d2, d3) || + belong_to_same_cell(*this, d2, d4) || + belong_to_same_cell(*this, d2, d5) || + belong_to_same_cell(*this, d2, d6) || + belong_to_same_cell(*this, d3, d4) || + belong_to_same_cell(*this, d3, d5) || + belong_to_same_cell(*this, d3, d6) || + belong_to_same_cell(*this, d4, d5) || + belong_to_same_cell(*this, d4, d6) || + belong_to_same_cell(*this, d5, d6) ) return false; if ( beta(d1,2) !=beta(d4,1,1) || @@ -4021,7 +3781,7 @@ namespace CGAL { return this->template beta<1>(adart); } - /** Insert a vertex in the given 2-cell which is split in triangles, + /** Insert a vertex in the given 2-cell which is splitted in triangles, * once for each inital edge of the facet. * @param adart a dart of the facet to triangulate. * @param update_attributes a boolean to update the enabled attributes @@ -4453,7 +4213,7 @@ namespace CGAL { if ( od==null_handle ) return false; // of and *it must belong to the same vertex of the same volume - if ( !belong_to_same_cell<0, 2>(od, *it) ) + if ( !belong_to_same_cell(*this, od, *it) ) return false; } prec = *it; @@ -4463,7 +4223,7 @@ namespace CGAL { od = other_extremity(prec); if ( od==null_handle ) return false; - if (!belong_to_same_cell<0, 2>(od, *afirst)) + if (!belong_to_same_cell(*this, od, *afirst)) return false; return true; @@ -4677,33 +4437,24 @@ namespace CGAL { Combinatorial_map(const Self & amap) : Base(amap) {} - template - Combinatorial_map(const Combinatorial_map_base& - amap) : Base(amap) + template < class CMap > + Combinatorial_map(const CMap & amap) : Base(amap) {} - template - Combinatorial_map(const Combinatorial_map_base& - amap, const Converters& converters) : + template < class CMap, typename Converters > + Combinatorial_map(const CMap & amap, const Converters& converters) : Base(amap, converters) {} - template - Combinatorial_map(const Combinatorial_map_base& - amap, const Converters& converters, + template < class CMap, typename Converters, typename DartInfoConverter > + Combinatorial_map(const CMap & amap, const Converters& converters, const DartInfoConverter& dartinfoconverter) : Base(amap, converters, dartinfoconverter) {} - template - Combinatorial_map(const Combinatorial_map_base& - amap, const Converters& converters, + template < class CMap, typename Converters, typename DartInfoConverter, + typename PointConverter > + Combinatorial_map(const CMap & amap, const Converters& converters, const DartInfoConverter& dartinfoconverter, const PointConverter& pointconverter) : Base(amap, converters, dartinfoconverter, pointconverter) From 6a51a30828c4e18b63bd5ffc2df50590df47b215 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 22 Apr 2020 11:02:16 +0200 Subject: [PATCH 5/8] more fixes --- CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp | 4 ++-- CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp | 4 ++-- CGAL_ipelets/demo/CGAL_ipelets/minkowski.cpp | 2 +- CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp | 4 ++-- CGAL_ipelets/demo/CGAL_ipelets/svdlinf.cpp | 4 ++-- CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h | 4 ++-- Kernel_23/include/CGAL/Kernel/hash_functions.h | 8 ++++---- Kernel_d/test/Kernel_d/Iso_box_d_with_Cartesian.cpp | 4 ++-- .../test/Kernel_d/Iso_box_d_with_homogeneous.cpp | 4 ++-- .../Polygon_mesh_processing/polygon_mesh_slicer.cpp | 6 +++--- .../Plugins/AABB_tree/Do_trees_intersect_plugin.cpp | 6 +++--- .../Plugins/PCA/Affine_transform_plugin.cpp | 12 ++++++------ 12 files changed, 31 insertions(+), 31 deletions(-) diff --git a/CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp b/CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp index b0edf574baa..643bc96f2c7 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp @@ -135,8 +135,8 @@ void diagrammeIpelet::protected_run(int fn) Kernel::FT incr_len=(fn<2)?50:75; //slightly increase the size of the Bbox - bbox=Iso_rectangle_2(bbox.min()+Kernel::Vector_2(-incr_len,-incr_len), - bbox.max()+Kernel::Vector_2(incr_len,incr_len)); + bbox=Iso_rectangle_2((bbox.min)()+Kernel::Vector_2(-incr_len,-incr_len), + (bbox.max)()+Kernel::Vector_2(incr_len,incr_len)); diff --git a/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp b/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp index 2bc329c15df..a450cac2c7e 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp @@ -90,8 +90,8 @@ void IpeletMesh2::protected_run(int fn) double alpha=0; - int x=static_cast( floor(bbox.max().x()-bbox.min().x()) ); - int y=static_cast( floor(bbox.max().y()-bbox.min().y()) ); + int x=static_cast( floor((bbox.max)().x()-(bbox.min)().x()) ); + int y=static_cast( floor((bbox.max)().y()-(bbox.min)().y()) ); int ret_val; boost::tie(ret_val,alpha)=request_value_from_user((boost::format("Max edge length (BBox %1%x%2%)") % x % y).str() ); diff --git a/CGAL_ipelets/demo/CGAL_ipelets/minkowski.cpp b/CGAL_ipelets/demo/CGAL_ipelets/minkowski.cpp index 92cd9c40b34..03877ef424e 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/minkowski.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/minkowski.cpp @@ -76,7 +76,7 @@ void SubSelectIpelet::protected_run(int fn) for (std::list::iterator it=cir_list.begin();it!=cir_list.end();++it) r_offsets.push_back(sqrt(CGAL::to_double(it->squared_radius()))); - IpeMatrix tfm (1,0,0,1,-CGAL::to_double(bbox.min().x()),-CGAL::to_double(bbox.min().y())); + IpeMatrix tfm (1,0,0,1,-CGAL::to_double((bbox.min)().x()),-CGAL::to_double((bbox.min)().y())); for (std::list::iterator it=pol_list.begin();it!=pol_list.end();++it) if(!it->is_simple()){ diff --git a/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp b/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp index 42b85c79dd1..3727c487040 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp @@ -95,8 +95,8 @@ void MregularIpelet::protected_run(int fn) draw_in_ipe(rt); else{//Draw kth Power diagram double incr_len=75; - bbox=Iso_rectangle_2(bbox.min()+Kernel::Vector_2(-incr_len,-incr_len), - bbox.max()+Kernel::Vector_2(incr_len,incr_len)); + bbox=Iso_rectangle_2((bbox.min)()+Kernel::Vector_2(-incr_len,-incr_len), + (bbox.max)()+Kernel::Vector_2(incr_len,incr_len)); draw_dual_in_ipe(rt,bbox); //draw Voronoi Diagram } } diff --git a/CGAL_ipelets/demo/CGAL_ipelets/svdlinf.cpp b/CGAL_ipelets/demo/CGAL_ipelets/svdlinf.cpp index 9bef1fbe29c..392fffb7aa0 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/svdlinf.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/svdlinf.cpp @@ -96,8 +96,8 @@ namespace CGAL_svdlinf { Kernel::FT incr_len = 75; // slightly increase the size of the bbox bbox = Iso_rectangle_2( - bbox.min()+Kernel::Vector_2(-incr_len,-incr_len), - bbox.max()+Kernel::Vector_2(incr_len,incr_len)); + (bbox.min)()+Kernel::Vector_2(-incr_len,-incr_len), + (bbox.max)()+Kernel::Vector_2(incr_len,incr_len)); for (std::list::iterator sit = sg_list.begin(); diff --git a/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h b/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h index 1fb9f94d78d..de68972f1fb 100644 --- a/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h +++ b/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h @@ -256,8 +256,8 @@ public: _page->DeselectAll(); Iso_rectangle_2 bbox_cgal( - static_cast(bbox_ipe.Min().iX),static_cast(bbox_ipe.Min().iY), - static_cast(bbox_ipe.Max().iX),static_cast(bbox_ipe.Max().iY) + static_cast((bbox_ipe.Min)().iX),static_cast((bbox_ipe.Min)().iY), + static_cast((bbox_ipe.Max)().iX),static_cast((bbox_ipe.Max)().iY) ); return bbox_cgal; diff --git a/Kernel_23/include/CGAL/Kernel/hash_functions.h b/Kernel_23/include/CGAL/Kernel/hash_functions.h index 145d58bd38c..a68197941d8 100644 --- a/Kernel_23/include/CGAL/Kernel/hash_functions.h +++ b/Kernel_23/include/CGAL/Kernel/hash_functions.h @@ -57,8 +57,8 @@ template inline std::enable_if_t::value, std::size_t> hash_value (const Iso_rectangle_2& iso_rectangle) { - std::size_t result = hash_value(iso_rectangle.min()); - boost::hash_combine(result, hash_value(iso_rectangle.max())); + std::size_t result = hash_value((iso_rectangle.min)()); + boost::hash_combine(result, hash_value((iso_rectangle.max)())); return result; } @@ -126,8 +126,8 @@ template inline std::enable_if_t::value, std::size_t> hash_value (const Iso_cuboid_3& iso_cuboid) { - std::size_t result = hash_value(iso_cuboid.min()); - boost::hash_combine(result, hash_value(iso_cuboid.max())); + std::size_t result = hash_value((iso_cuboid.min)()); + boost::hash_combine(result, hash_value((iso_cuboid.max)())); return result; } diff --git a/Kernel_d/test/Kernel_d/Iso_box_d_with_Cartesian.cpp b/Kernel_d/test/Kernel_d/Iso_box_d_with_Cartesian.cpp index 0ea94fb0992..38b9ec62d7d 100644 --- a/Kernel_d/test/Kernel_d/Iso_box_d_with_Cartesian.cpp +++ b/Kernel_d/test/Kernel_d/Iso_box_d_with_Cartesian.cpp @@ -91,8 +91,8 @@ int main() { assert(b1.bounded_side(qq1)==CGAL::ON_BOUNDARY); assert(b1.bounded_side(qq4)==CGAL::ON_UNBOUNDED_SIDE); assert(b1.bounded_side(mm1)==CGAL::ON_BOUNDED_SIDE); - // std::cout << "b1.min()=" << b1.min() << std::endl; - // std::cout << "b1.max()=" << b1.max() << std::endl; + // std::cout << "(b1.min)()=" << (b1.min)() << std::endl; + // std::cout << "(b1.max)()=" << (b1.max)() << std::endl; std::cout << "volume of b1=" << b1.volume() << std::endl; std::cout << "volume of b4=" << b4.volume() << std::endl; std::cout << "volume of b5=" << b5.volume() << std::endl; diff --git a/Kernel_d/test/Kernel_d/Iso_box_d_with_homogeneous.cpp b/Kernel_d/test/Kernel_d/Iso_box_d_with_homogeneous.cpp index 8af8cbc3fad..8db8c7ddc7b 100644 --- a/Kernel_d/test/Kernel_d/Iso_box_d_with_homogeneous.cpp +++ b/Kernel_d/test/Kernel_d/Iso_box_d_with_homogeneous.cpp @@ -94,8 +94,8 @@ int main() { assert(b1.bounded_side(qq1)==CGAL::ON_BOUNDARY); assert(b1.bounded_side(qq4)==CGAL::ON_UNBOUNDED_SIDE); assert(b1.bounded_side(mm1)==CGAL::ON_BOUNDED_SIDE); - // std::cout << "b1.min()=" << b1.min() << std::endl; - // std::cout << "b1.max()=" << b1.max() << std::endl; + // std::cout << "(b1.min)()=" << (b1.min)() << std::endl; + // std::cout << "(b1.max)()=" << (b1.max)() << std::endl; std::cout << "volume of b1=" << b1.volume() << std::endl; std::cout << "volume of b4=" << b4.volume() << std::endl; std::cout << "volume of b5=" << b5.volume() << std::endl; diff --git a/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/polygon_mesh_slicer.cpp b/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/polygon_mesh_slicer.cpp index 03d0337f915..86c308e45ea 100644 --- a/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/polygon_mesh_slicer.cpp +++ b/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/polygon_mesh_slicer.cpp @@ -106,9 +106,9 @@ int main(int argc, char* argv[]) t.start(); std::cerr << "bbox"<< std::endl; Iso_cuboid_3 ic = CGAL::bounding_box(points(m).begin(), points(m).end()); - Point_3 p = midpoint(ic.min(), ic.max()); - double zmin = ic.min().z(); - double zmax = ic.max().z(); + Point_3 p = midpoint((ic.min)(), (ic.max)()); + double zmin = (ic.min)().z(); + double zmax = (ic.max)().z(); double delta = (zmax - zmin)/N; std::cerr << "slicer"<< std::endl; diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp index dfa516c1333..08a8ef803e4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp @@ -102,9 +102,9 @@ private Q_SLOTS: connect(item, &Scene_surface_mesh_item::aboutToBeDestroyed, this, &DoTreesIntersectplugin::cleanup); - CGAL::qglviewer::Vec pos((item->bbox().min(0) + item->bbox().max(0))/2.0, - (item->bbox().min(1) + item->bbox().max(1))/2.0, - (item->bbox().min(2) + item->bbox().max(2))/2.0); + CGAL::qglviewer::Vec pos(((item->bbox().min)(0) + (item->bbox().max)(0))/2.0, + ((item->bbox().min)(1) + (item->bbox().max)(1))/2.0, + ((item->bbox().min)(2) + (item->bbox().max)(2))/2.0); Scene_movable_sm_item* mov_item = new Scene_movable_sm_item(pos,item->face_graph(),""); connect(mov_item->manipulatedFrame(), &CGAL::qglviewer::ManipulatedFrame::modified, diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp index 57700e79d13..0eebfb574ab 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp @@ -417,12 +417,12 @@ void Polyhedron_demo_affine_transform_plugin::grid() Scene_item::Bbox b = item->bbox(); - double x_t(CGAL::sqrt(CGAL::squared_distance(Kernel::Point_3(b.min(0), b.min(1), b.min(2)), - Kernel::Point_3(b.max(0), b.min(1), b.min(2))))), - y_t(CGAL::sqrt(CGAL::squared_distance(Kernel::Point_3(b.min(0), b.min(1), b.min(2)), - Kernel::Point_3(b.min(0), b.max(1), b.min(2))))), - z_t(CGAL::sqrt(CGAL::squared_distance(Kernel::Point_3(b.min(0), b.min(1), b.min(2)), - Kernel::Point_3(b.min(0), b.min(1), b.max(2))))); + double x_t(CGAL::sqrt(CGAL::squared_distance(Kernel::Point_3((b.min)(0), (b.min)(1), (b.min)(2)), + Kernel::Point_3((b.max)(0), (b.min)(1), (b.min)(2))))), + y_t(CGAL::sqrt(CGAL::squared_distance(Kernel::Point_3((b.min)(0), (b.min)(1), (b.min)(2)), + Kernel::Point_3((b.min)(0), (b.max)(1), (b.min)(2))))), + z_t(CGAL::sqrt(CGAL::squared_distance(Kernel::Point_3((b.min)(0), (b.min)(1), (b.min)(2)), + Kernel::Point_3((b.min)(0), (b.min)(1), (b.max)(2))))); GridDialog dialog(mw); dialog.x_space_doubleSpinBox->setValue(x_t); From 97d2eaebd9113c85ea2d1411e8b316ed27fd73f8 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 22 Apr 2020 11:02:16 +0200 Subject: [PATCH 6/8] more fixes --- CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp | 4 ++-- CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp | 4 ++-- CGAL_ipelets/demo/CGAL_ipelets/minkowski.cpp | 2 +- CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp | 4 ++-- CGAL_ipelets/demo/CGAL_ipelets/svdlinf.cpp | 4 ++-- CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h | 4 ++-- Kernel_d/test/Kernel_d/Iso_box_d_with_Cartesian.cpp | 4 ++-- .../test/Kernel_d/Iso_box_d_with_homogeneous.cpp | 4 ++-- .../Polygon_mesh_processing/polygon_mesh_slicer.cpp | 6 +++--- .../Plugins/AABB_tree/Do_trees_intersect_plugin.cpp | 6 +++--- .../Plugins/PCA/Affine_transform_plugin.cpp | 12 ++++++------ 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp b/CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp index 00c27acb5d3..71359b23149 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp @@ -144,8 +144,8 @@ void diagrammeIpelet::protected_run(int fn) Kernel::FT incr_len=(fn<2)?50:75; //slightly increase the size of the Bbox - bbox=Iso_rectangle_2(bbox.min()+Kernel::Vector_2(-incr_len,-incr_len), - bbox.max()+Kernel::Vector_2(incr_len,incr_len)); + bbox=Iso_rectangle_2((bbox.min)()+Kernel::Vector_2(-incr_len,-incr_len), + (bbox.max)()+Kernel::Vector_2(incr_len,incr_len)); diff --git a/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp b/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp index c2ff8f5ed43..f6a0be55aff 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/mesh_2.cpp @@ -99,8 +99,8 @@ void IpeletMesh2::protected_run(int fn) double alpha=0; - int x=static_cast( floor(bbox.max().x()-bbox.min().x()) ); - int y=static_cast( floor(bbox.max().y()-bbox.min().y()) ); + int x=static_cast( floor((bbox.max)().x()-(bbox.min)().x()) ); + int y=static_cast( floor((bbox.max)().y()-(bbox.min)().y()) ); int ret_val; boost::tie(ret_val,alpha)=request_value_from_user((boost::format("Max edge length (BBox %1%x%2%)") % x % y).str() ); diff --git a/CGAL_ipelets/demo/CGAL_ipelets/minkowski.cpp b/CGAL_ipelets/demo/CGAL_ipelets/minkowski.cpp index 00275d343ea..9aba996ff5d 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/minkowski.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/minkowski.cpp @@ -85,7 +85,7 @@ void SubSelectIpelet::protected_run(int fn) for (std::list::iterator it=cir_list.begin();it!=cir_list.end();++it) r_offsets.push_back(sqrt(CGAL::to_double(it->squared_radius()))); - IpeMatrix tfm (1,0,0,1,-CGAL::to_double(bbox.min().x()),-CGAL::to_double(bbox.min().y())); + IpeMatrix tfm (1,0,0,1,-CGAL::to_double((bbox.min)().x()),-CGAL::to_double((bbox.min)().y())); for (std::list::iterator it=pol_list.begin();it!=pol_list.end();++it) if(!it->is_simple()){ diff --git a/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp b/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp index e01c92b5230..834bb5c3d92 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/multi_regular.cpp @@ -104,8 +104,8 @@ void MregularIpelet::protected_run(int fn) draw_in_ipe(rt); else{//Draw kth Power diagram double incr_len=75; - bbox=Iso_rectangle_2(bbox.min()+Kernel::Vector_2(-incr_len,-incr_len), - bbox.max()+Kernel::Vector_2(incr_len,incr_len)); + bbox=Iso_rectangle_2((bbox.min)()+Kernel::Vector_2(-incr_len,-incr_len), + (bbox.max)()+Kernel::Vector_2(incr_len,incr_len)); draw_dual_in_ipe(rt,bbox); //draw Voronoi Diagram } } diff --git a/CGAL_ipelets/demo/CGAL_ipelets/svdlinf.cpp b/CGAL_ipelets/demo/CGAL_ipelets/svdlinf.cpp index 9bef1fbe29c..392fffb7aa0 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/svdlinf.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/svdlinf.cpp @@ -96,8 +96,8 @@ namespace CGAL_svdlinf { Kernel::FT incr_len = 75; // slightly increase the size of the bbox bbox = Iso_rectangle_2( - bbox.min()+Kernel::Vector_2(-incr_len,-incr_len), - bbox.max()+Kernel::Vector_2(incr_len,incr_len)); + (bbox.min)()+Kernel::Vector_2(-incr_len,-incr_len), + (bbox.max)()+Kernel::Vector_2(incr_len,incr_len)); for (std::list::iterator sit = sg_list.begin(); diff --git a/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h b/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h index edf08338541..19e8049ec48 100644 --- a/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h +++ b/CGAL_ipelets/include/CGAL/CGAL_Ipelet_base_v6.h @@ -265,8 +265,8 @@ public: _page->DeselectAll(); Iso_rectangle_2 bbox_cgal( - static_cast(bbox_ipe.Min().iX),static_cast(bbox_ipe.Min().iY), - static_cast(bbox_ipe.Max().iX),static_cast(bbox_ipe.Max().iY) + static_cast((bbox_ipe.Min)().iX),static_cast((bbox_ipe.Min)().iY), + static_cast((bbox_ipe.Max)().iX),static_cast((bbox_ipe.Max)().iY) ); return bbox_cgal; diff --git a/Kernel_d/test/Kernel_d/Iso_box_d_with_Cartesian.cpp b/Kernel_d/test/Kernel_d/Iso_box_d_with_Cartesian.cpp index 0ea94fb0992..38b9ec62d7d 100644 --- a/Kernel_d/test/Kernel_d/Iso_box_d_with_Cartesian.cpp +++ b/Kernel_d/test/Kernel_d/Iso_box_d_with_Cartesian.cpp @@ -91,8 +91,8 @@ int main() { assert(b1.bounded_side(qq1)==CGAL::ON_BOUNDARY); assert(b1.bounded_side(qq4)==CGAL::ON_UNBOUNDED_SIDE); assert(b1.bounded_side(mm1)==CGAL::ON_BOUNDED_SIDE); - // std::cout << "b1.min()=" << b1.min() << std::endl; - // std::cout << "b1.max()=" << b1.max() << std::endl; + // std::cout << "(b1.min)()=" << (b1.min)() << std::endl; + // std::cout << "(b1.max)()=" << (b1.max)() << std::endl; std::cout << "volume of b1=" << b1.volume() << std::endl; std::cout << "volume of b4=" << b4.volume() << std::endl; std::cout << "volume of b5=" << b5.volume() << std::endl; diff --git a/Kernel_d/test/Kernel_d/Iso_box_d_with_homogeneous.cpp b/Kernel_d/test/Kernel_d/Iso_box_d_with_homogeneous.cpp index 8af8cbc3fad..8db8c7ddc7b 100644 --- a/Kernel_d/test/Kernel_d/Iso_box_d_with_homogeneous.cpp +++ b/Kernel_d/test/Kernel_d/Iso_box_d_with_homogeneous.cpp @@ -94,8 +94,8 @@ int main() { assert(b1.bounded_side(qq1)==CGAL::ON_BOUNDARY); assert(b1.bounded_side(qq4)==CGAL::ON_UNBOUNDED_SIDE); assert(b1.bounded_side(mm1)==CGAL::ON_BOUNDED_SIDE); - // std::cout << "b1.min()=" << b1.min() << std::endl; - // std::cout << "b1.max()=" << b1.max() << std::endl; + // std::cout << "(b1.min)()=" << (b1.min)() << std::endl; + // std::cout << "(b1.max)()=" << (b1.max)() << std::endl; std::cout << "volume of b1=" << b1.volume() << std::endl; std::cout << "volume of b4=" << b4.volume() << std::endl; std::cout << "volume of b5=" << b5.volume() << std::endl; diff --git a/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/polygon_mesh_slicer.cpp b/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/polygon_mesh_slicer.cpp index 5a1f7298352..1815bce393c 100644 --- a/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/polygon_mesh_slicer.cpp +++ b/Polygon_mesh_processing/benchmark/Polygon_mesh_processing/polygon_mesh_slicer.cpp @@ -107,9 +107,9 @@ int main(int argc, char* argv[]) t.start(); std::cerr << "bbox"<< std::endl; Iso_cuboid_3 ic = CGAL::bounding_box(points(m).begin(), points(m).end()); - Point_3 p = midpoint(ic.min(), ic.max()); - double zmin = ic.min().z(); - double zmax = ic.max().z(); + Point_3 p = midpoint((ic.min)(), (ic.max)()); + double zmin = (ic.min)().z(); + double zmax = (ic.max)().z(); double delta = (zmax - zmin)/N; std::cerr << "slicer"<< std::endl; diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp index b1b325c12e4..59ce040ba4e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp @@ -103,9 +103,9 @@ private Q_SLOTS: connect(item, &Scene_surface_mesh_item::aboutToBeDestroyed, this, &DoTreesIntersectplugin::cleanup); - CGAL::qglviewer::Vec pos((item->bbox().min(0) + item->bbox().max(0))/2.0, - (item->bbox().min(1) + item->bbox().max(1))/2.0, - (item->bbox().min(2) + item->bbox().max(2))/2.0); + CGAL::qglviewer::Vec pos(((item->bbox().min)(0) + (item->bbox().max)(0))/2.0, + ((item->bbox().min)(1) + (item->bbox().max)(1))/2.0, + ((item->bbox().min)(2) + (item->bbox().max)(2))/2.0); Scene_movable_sm_item* mov_item = new Scene_movable_sm_item(pos,item->face_graph(),""); connect(mov_item->manipulatedFrame(), &CGAL::qglviewer::ManipulatedFrame::modified, diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp index 9c8e074aebf..d65db7c9dd9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp @@ -407,12 +407,12 @@ void Polyhedron_demo_affine_transform_plugin::grid() Scene_item::Bbox b = item->bbox(); - double x_t(CGAL::sqrt(CGAL::squared_distance(Kernel::Point_3(b.min(0), b.min(1), b.min(2)), - Kernel::Point_3(b.max(0), b.min(1), b.min(2))))), - y_t(CGAL::sqrt(CGAL::squared_distance(Kernel::Point_3(b.min(0), b.min(1), b.min(2)), - Kernel::Point_3(b.min(0), b.max(1), b.min(2))))), - z_t(CGAL::sqrt(CGAL::squared_distance(Kernel::Point_3(b.min(0), b.min(1), b.min(2)), - Kernel::Point_3(b.min(0), b.min(1), b.max(2))))); + double x_t(CGAL::sqrt(CGAL::squared_distance(Kernel::Point_3((b.min)(0), (b.min)(1), (b.min)(2)), + Kernel::Point_3((b.max)(0), (b.min)(1), (b.min)(2))))), + y_t(CGAL::sqrt(CGAL::squared_distance(Kernel::Point_3((b.min)(0), (b.min)(1), (b.min)(2)), + Kernel::Point_3((b.min)(0), (b.max)(1), (b.min)(2))))), + z_t(CGAL::sqrt(CGAL::squared_distance(Kernel::Point_3((b.min)(0), (b.min)(1), (b.min)(2)), + Kernel::Point_3((b.min)(0), (b.min)(1), (b.max)(2))))); GridDialog dialog(mw); dialog.x_space_doubleSpinBox->setValue(x_t); From 8da84d4748867b508ac453074cde6ccb3b29e436 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 23 Apr 2020 09:27:26 +0200 Subject: [PATCH 7/8] More errors and warnigns --- .../box_d_do_intersect_polylines.cpp | 24 ++++++------ .../test_repair_polygon_soup.cpp | 38 +++++++++---------- .../Point_set_item_classification.cpp | 2 +- .../PCA/Scene_facegraph_transform_item.cpp | 8 ++-- .../Surface_mesh/Parameterization_plugin.cpp | 20 +++++----- 5 files changed, 46 insertions(+), 46 deletions(-) diff --git a/Box_intersection_d/examples/Box_intersection_d/box_d_do_intersect_polylines.cpp b/Box_intersection_d/examples/Box_intersection_d/box_d_do_intersect_polylines.cpp index c5558b246f8..f026b909d3e 100644 --- a/Box_intersection_d/examples/Box_intersection_d/box_d_do_intersect_polylines.cpp +++ b/Box_intersection_d/examples/Box_intersection_d/box_d_do_intersect_polylines.cpp @@ -4,15 +4,15 @@ #include -template +template class Polylines_do_intersect { - typedef typename Polyline::const_iterator Iterator; + typedef typename Poly::const_iterator Iterator; typedef typename std::iterator_traits::value_type Point_2; typedef typename CGAL::Kernel_traits::Kernel::Segment_2 Segment_2; typedef CGAL::Bbox_2 Bbox_2; - const Polyline& pA, &pB; + const Poly& pA, &pB; struct Box : public CGAL::Box_intersection_d::Box_with_handle_d { @@ -31,9 +31,9 @@ class Polylines_do_intersect class Overlap { - const Polyline& pA, &pB; + const Poly& pA, &pB; public: - Overlap(const Polyline& pA, const Polyline& pB) + Overlap(const Poly& pA, const Poly& pB) : pA(pA), pB(pB) {} @@ -49,7 +49,7 @@ class Polylines_do_intersect public: - Polylines_do_intersect(const Polyline& pA, const Polyline& pB) + Polylines_do_intersect(const Poly& pA, const Poly& pB) : pA(pA), pB(pB) {} @@ -83,22 +83,22 @@ public: }; -template -bool polylines_do_intersect(const Polyline& pA,const Polyline& pB) +template +bool polylines_do_intersect(const Poly& pA,const Poly& pB) { - Polylines_do_intersect pdi(pA,pB); + Polylines_do_intersect pdi(pA,pB); return pdi(); } typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef K::Point_2 Point_2; -typedef std::vector Polyline; +typedef std::vector CGAL_polyline; int main() { - Polyline pA = { Point_2(0,0), Point_2(1,0) }; - Polyline pB = { Point_2(0,0), Point_2(0,1), Point_2(2,1) , Point_2(1,0)}; + CGAL_polyline pA = { Point_2(0,0), Point_2(1,0) }; + CGAL_polyline pB = { Point_2(0,0), Point_2(0,1), Point_2(2,1) , Point_2(1,0)}; if(polylines_do_intersect(pA,pB)){ std::cout << "intersection" << std::endl; diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_repair_polygon_soup.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_repair_polygon_soup.cpp index eec039ec43e..dd1ac38d01a 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_repair_polygon_soup.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_repair_polygon_soup.cpp @@ -19,7 +19,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef K::Point_3 Point_3; typedef CGAL::Surface_mesh Mesh; -typedef std::vector Polygon; +typedef std::vector CGAL_polygon; void test_polygon_canonicalization(const bool verbose = false) { @@ -34,8 +34,8 @@ void test_polygon_canonicalization(const bool verbose = false) points.push_back(Point_3(1,1,-2)); // #5 // empty - Polygon polygon; - Polygon canonical_polygon = PMP::internal::construct_canonical_polygon(points, polygon, K()); + CGAL_polygon polygon; + CGAL_polygon canonical_polygon = PMP::internal::construct_canonical_polygon(points, polygon, K()); assert(canonical_polygon.empty()); // 1 point @@ -76,7 +76,7 @@ void test_polygon_canonicalization(const bool verbose = false) // all cyclic permutations for(std::size_t i=0, end=polygon.size(); i points; - std::vector polygons; + std::vector polygons; // empty std::size_t res = PMP::merge_duplicate_points_in_polygon_soup(points, polygons); @@ -126,7 +126,7 @@ void test_merge_duplicate_points(const bool /*verbose*/ = false) points.push_back(Point_3(1,1,0)); // #5 // identical to #2 points.push_back(Point_3(0,0,0)); // #6 // idental to #0 - Polygon polygon; + CGAL_polygon polygon; polygon.push_back(0); polygon.push_back(1); polygon.push_back(2); polygons.push_back(polygon); @@ -146,7 +146,7 @@ void test_merge_duplicate_points(const bool /*verbose*/ = false) for(std::size_t i=0, psn=polygons.size(); i points; - std::vector polygons; + std::vector polygons; points.push_back(Point_3(0,0,0)); // #0 points.push_back(Point_3(1,0,0)); // #1 @@ -180,7 +180,7 @@ void test_merge_duplicate_polygons(const bool /*verbose*/ = false) // ------------------------------------------------------- // 1 polygon - Polygon polygon; + CGAL_polygon polygon; polygon.push_back(0); polygon.push_back(1); polygon.push_back(2); polygons.push_back(polygon); @@ -257,7 +257,7 @@ void test_merge_duplicate_polygons(const bool /*verbose*/ = false) assert(all_duplicate_polygons[0].size() == 2 && all_duplicate_polygons[1].size() == 3); // Keep one for each duplicate - std::vector polygons_copy(polygons); + std::vector polygons_copy(polygons); res = PMP::merge_duplicate_polygons_in_polygon_soup(points, polygons_copy, params::all_default()); assert(res == 3 && polygons_copy.size() == 3); @@ -281,7 +281,7 @@ void test_simplify_polygons(const bool /*verbose*/ = false) std::cout << "test simplify_polygons... " << std::endl; std::vector points; - std::vector polygons; + std::vector polygons; points.push_back(Point_3(0,0,0)); // #0 points.push_back(Point_3(1,2,0)); // #1 @@ -292,7 +292,7 @@ void test_simplify_polygons(const bool /*verbose*/ = false) points.push_back(Point_3(0,0,0)); // #6 // ------ - Polygon polygon; + CGAL_polygon polygon; polygon.push_back(0); polygon.push_back(2); polygon.push_back(4); polygons.push_back(polygon); @@ -355,13 +355,13 @@ void test_remove_invalid_polygons(const bool /*verbose*/ = false) // points are not actually needed since only the size of the polygons is considered std::vector points; - std::vector polygons; + std::vector polygons; std::size_t res = PMP::internal::remove_invalid_polygons_in_polygon_soup(points, polygons); assert(res == 0 && polygons.size() == 0); // non-trivial polygon - Polygon polygon; + CGAL_polygon polygon; polygon.push_back(0); polygon.push_back(2); polygon.push_back(4); polygons.push_back(polygon); @@ -431,7 +431,7 @@ void test_remove_isolated_points(const bool verbose = false) std::cout << "test remove_isolated_points... " << std::endl; std::vector points; - std::vector polygons; + std::vector polygons; // everything empty std::size_t res = test_remove_isolated_points_data_set(points, polygons, verbose); @@ -449,7 +449,7 @@ void test_remove_isolated_points(const bool verbose = false) res = test_remove_isolated_points_data_set(points_copy, polygons, verbose); assert(res == 6 && points_copy.empty() && polygons.empty()); - Polygon polygon; + CGAL_polygon polygon; polygon.push_back(0); polygon.push_back(2); polygon.push_back(4); polygons.push_back(polygon); @@ -467,7 +467,7 @@ void test_slit_pinched_polygons(const bool /*verbose*/ = false) std::cout << "test split_pinched_polygons... " << std::endl; std::vector points; - std::vector polygons; + std::vector polygons; // everything empty std::size_t res = PMP::internal::split_pinched_polygons_in_polygon_soup(points, polygons); @@ -481,7 +481,7 @@ void test_slit_pinched_polygons(const bool /*verbose*/ = false) points.push_back(Point_3(1,1,0)); // #5 // no pinch - Polygon polygon; + CGAL_polygon polygon; polygon.push_back(0); polygon.push_back(2); polygon.push_back(4); polygons.push_back(polygon); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp index 1b2c6142a6e..22cd2cdfcb1 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp @@ -429,7 +429,7 @@ void Point_set_item_classification::change_color (int index, float* vmin, float* for (Point_set::const_iterator it = m_points->point_set()->begin(); it != m_points->point_set()->first_selected(); ++ it) { - float v = std::max (0.f, (std::min)(1.f, m_label_probabilities[corrected_index][*it])); + float v = (std::max)(0.f, (std::min)(1.f, m_label_probabilities[corrected_index][*it])); m_points->point_set()->set_color(*it, ramp.r(v) * 255, ramp.g(v) * 255, ramp.b(v) * 255); } } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_facegraph_transform_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_facegraph_transform_item.cpp index 83348567eec..71cc00c5933 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_facegraph_transform_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_facegraph_transform_item.cpp @@ -123,10 +123,10 @@ Scene_facegraph_transform_item::compute_bbox() const { ++it) { bbox = bbox + get(vpmap, *it).bbox(); } - CGAL::qglviewer::Vec min(bbox.xmin(),bbox.ymin(),bbox.zmin()); - CGAL::qglviewer::Vec max(bbox.xmax(),bbox.ymax(),bbox.zmax()); - setBbox(Bbox(min.x,min.y,min.z, - max.x,max.y,max.z)); + CGAL::qglviewer::Vec vmin(bbox.xmin(),bbox.ymin(),bbox.zmin()); + CGAL::qglviewer::Vec vmax(bbox.xmax(),bbox.ymax(),bbox.zmax()); + setBbox(Bbox(vmin.x,vmin.y,vmin.z, + vmax.x,vmax.y,vmax.z)); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp index 8a945f71d76..ba2a234e0fa 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp @@ -907,7 +907,7 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio } //end for each component QApplication::restoreOverrideCursor(); - QPointF min(FLT_MAX, FLT_MAX), max(-FLT_MAX, -FLT_MAX); + QPointF pmin(FLT_MAX, FLT_MAX), pmax(-FLT_MAX, -FLT_MAX); SMesh::Property_map umap; SMesh::Property_map vmap; @@ -926,14 +926,14 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio FT v = uv_pm[target(hd, sMesh)].y(); put(umap, *it, static_cast(u)); put(vmap, *it, static_cast(v)); - if(umax.x()) - max.setX(u); - if(vmax.y()) - max.setY(v); + if(upmax.x()) + pmax.setX(u); + if(vpmax.y()) + pmax.setY(v); } Components* components = new Components(0); @@ -948,7 +948,7 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio } Scene_textured_facegraph_item* new_item = new Scene_textured_facegraph_item(tMesh); - UVItem *projection = new UVItem(components,new_item->textured_face_graph(), uv_borders, QRectF(min, max)); + UVItem *projection = new UVItem(components,new_item->textured_face_graph(), uv_borders, QRectF(pmin, pmax)); projection->set_item_name(new_item_name); new_item->setName(new_item_name); From d7a18b913d6da65b0022611dbcc303df50787c9a Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 23 Apr 2020 09:27:26 +0200 Subject: [PATCH 8/8] More errors and warnigns --- .../test_repair_polygon_soup.cpp | 38 +++++++++---------- .../Point_set_item_classification.cpp | 2 +- .../PCA/Scene_facegraph_transform_item.cpp | 8 ++-- .../Surface_mesh/Parameterization_plugin.cpp | 20 +++++----- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_repair_polygon_soup.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_repair_polygon_soup.cpp index eec039ec43e..dd1ac38d01a 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_repair_polygon_soup.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_repair_polygon_soup.cpp @@ -19,7 +19,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef K::Point_3 Point_3; typedef CGAL::Surface_mesh Mesh; -typedef std::vector Polygon; +typedef std::vector CGAL_polygon; void test_polygon_canonicalization(const bool verbose = false) { @@ -34,8 +34,8 @@ void test_polygon_canonicalization(const bool verbose = false) points.push_back(Point_3(1,1,-2)); // #5 // empty - Polygon polygon; - Polygon canonical_polygon = PMP::internal::construct_canonical_polygon(points, polygon, K()); + CGAL_polygon polygon; + CGAL_polygon canonical_polygon = PMP::internal::construct_canonical_polygon(points, polygon, K()); assert(canonical_polygon.empty()); // 1 point @@ -76,7 +76,7 @@ void test_polygon_canonicalization(const bool verbose = false) // all cyclic permutations for(std::size_t i=0, end=polygon.size(); i points; - std::vector polygons; + std::vector polygons; // empty std::size_t res = PMP::merge_duplicate_points_in_polygon_soup(points, polygons); @@ -126,7 +126,7 @@ void test_merge_duplicate_points(const bool /*verbose*/ = false) points.push_back(Point_3(1,1,0)); // #5 // identical to #2 points.push_back(Point_3(0,0,0)); // #6 // idental to #0 - Polygon polygon; + CGAL_polygon polygon; polygon.push_back(0); polygon.push_back(1); polygon.push_back(2); polygons.push_back(polygon); @@ -146,7 +146,7 @@ void test_merge_duplicate_points(const bool /*verbose*/ = false) for(std::size_t i=0, psn=polygons.size(); i points; - std::vector polygons; + std::vector polygons; points.push_back(Point_3(0,0,0)); // #0 points.push_back(Point_3(1,0,0)); // #1 @@ -180,7 +180,7 @@ void test_merge_duplicate_polygons(const bool /*verbose*/ = false) // ------------------------------------------------------- // 1 polygon - Polygon polygon; + CGAL_polygon polygon; polygon.push_back(0); polygon.push_back(1); polygon.push_back(2); polygons.push_back(polygon); @@ -257,7 +257,7 @@ void test_merge_duplicate_polygons(const bool /*verbose*/ = false) assert(all_duplicate_polygons[0].size() == 2 && all_duplicate_polygons[1].size() == 3); // Keep one for each duplicate - std::vector polygons_copy(polygons); + std::vector polygons_copy(polygons); res = PMP::merge_duplicate_polygons_in_polygon_soup(points, polygons_copy, params::all_default()); assert(res == 3 && polygons_copy.size() == 3); @@ -281,7 +281,7 @@ void test_simplify_polygons(const bool /*verbose*/ = false) std::cout << "test simplify_polygons... " << std::endl; std::vector points; - std::vector polygons; + std::vector polygons; points.push_back(Point_3(0,0,0)); // #0 points.push_back(Point_3(1,2,0)); // #1 @@ -292,7 +292,7 @@ void test_simplify_polygons(const bool /*verbose*/ = false) points.push_back(Point_3(0,0,0)); // #6 // ------ - Polygon polygon; + CGAL_polygon polygon; polygon.push_back(0); polygon.push_back(2); polygon.push_back(4); polygons.push_back(polygon); @@ -355,13 +355,13 @@ void test_remove_invalid_polygons(const bool /*verbose*/ = false) // points are not actually needed since only the size of the polygons is considered std::vector points; - std::vector polygons; + std::vector polygons; std::size_t res = PMP::internal::remove_invalid_polygons_in_polygon_soup(points, polygons); assert(res == 0 && polygons.size() == 0); // non-trivial polygon - Polygon polygon; + CGAL_polygon polygon; polygon.push_back(0); polygon.push_back(2); polygon.push_back(4); polygons.push_back(polygon); @@ -431,7 +431,7 @@ void test_remove_isolated_points(const bool verbose = false) std::cout << "test remove_isolated_points... " << std::endl; std::vector points; - std::vector polygons; + std::vector polygons; // everything empty std::size_t res = test_remove_isolated_points_data_set(points, polygons, verbose); @@ -449,7 +449,7 @@ void test_remove_isolated_points(const bool verbose = false) res = test_remove_isolated_points_data_set(points_copy, polygons, verbose); assert(res == 6 && points_copy.empty() && polygons.empty()); - Polygon polygon; + CGAL_polygon polygon; polygon.push_back(0); polygon.push_back(2); polygon.push_back(4); polygons.push_back(polygon); @@ -467,7 +467,7 @@ void test_slit_pinched_polygons(const bool /*verbose*/ = false) std::cout << "test split_pinched_polygons... " << std::endl; std::vector points; - std::vector polygons; + std::vector polygons; // everything empty std::size_t res = PMP::internal::split_pinched_polygons_in_polygon_soup(points, polygons); @@ -481,7 +481,7 @@ void test_slit_pinched_polygons(const bool /*verbose*/ = false) points.push_back(Point_3(1,1,0)); // #5 // no pinch - Polygon polygon; + CGAL_polygon polygon; polygon.push_back(0); polygon.push_back(2); polygon.push_back(4); polygons.push_back(polygon); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp index 08e253b9729..fb9f5d9e75f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp @@ -429,7 +429,7 @@ void Point_set_item_classification::change_color (int index, float* vmin, float* for (Point_set::const_iterator it = m_points->point_set()->begin(); it != m_points->point_set()->first_selected(); ++ it) { - float v = std::max (0.f, (std::min)(1.f, m_label_probabilities[corrected_index][*it])); + float v = (std::max)(0.f, (std::min)(1.f, m_label_probabilities[corrected_index][*it])); m_points->point_set()->set_color(*it, ramp.r(v) * 255, ramp.g(v) * 255, ramp.b(v) * 255); } } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_facegraph_transform_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_facegraph_transform_item.cpp index 8c29c867b57..13a253bfa1a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_facegraph_transform_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_facegraph_transform_item.cpp @@ -150,10 +150,10 @@ Scene_facegraph_transform_item::compute_bbox() const { ++it) { bbox = bbox + get(vpmap, *it).bbox(); } - CGAL::qglviewer::Vec min(bbox.xmin(),bbox.ymin(),bbox.zmin()); - CGAL::qglviewer::Vec max(bbox.xmax(),bbox.ymax(),bbox.zmax()); - _bbox = Bbox(min.x,min.y,min.z, - max.x,max.y,max.z); + CGAL::qglviewer::Vec vmin(bbox.xmin(),bbox.ymin(),bbox.zmin()); + CGAL::qglviewer::Vec vmax(bbox.xmax(),bbox.ymax(),bbox.zmax()); + _bbox = Bbox(vmin.x,vmin.y,vmin.z, + vmax.x,vmax.y,vmax.z); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp index d565ed23cd3..edb9cbca364 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp @@ -899,7 +899,7 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio } //end for each component QApplication::restoreOverrideCursor(); - QPointF min(FLT_MAX, FLT_MAX), max(-FLT_MAX, -FLT_MAX); + QPointF pmin(FLT_MAX, FLT_MAX), pmax(-FLT_MAX, -FLT_MAX); SMesh::Property_map > uv; uv = tMesh.add_property_map >("h:uv",std::make_pair(0.0f,0.0f)).first; @@ -912,14 +912,14 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio FT u = uv_pm[target(hd, sMesh)].x(); FT v = uv_pm[target(hd, sMesh)].y(); put(uv, *it, std::make_pair(static_cast(u),static_cast(v))); - if(umax.x()) - max.setX(u); - if(vmax.y()) - max.setY(v); + if(upmax.x()) + pmax.setX(u); + if(vpmax.y()) + pmax.setY(v); } Components* components = new Components(0); @@ -934,7 +934,7 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio } Scene_textured_facegraph_item* new_item = new Scene_textured_facegraph_item(tMesh); - UVItem *projection = new UVItem(components,new_item->textured_face_graph(), uv_borders, QRectF(min, max)); + UVItem *projection = new UVItem(components,new_item->textured_face_graph(), uv_borders, QRectF(pmin, pmax)); projection->set_item_name(new_item_name); new_item->setName(new_item_name);