diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/Cartesian_grid_3.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/Cartesian_grid_3.h index 8878dffb737..b0a63c65de8 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/Cartesian_grid_3.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/Cartesian_grid_3.h @@ -107,7 +107,7 @@ struct Cartesian_grid_location for(std::size_t k=0; k diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/implicit_shapes_helper.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/implicit_shapes_helper.h index 24c918a6d7f..dd613d93fc8 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/implicit_shapes_helper.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/implicit_shapes_helper.h @@ -153,28 +153,28 @@ template typename K::FT shape_union(const S1& s1, const S2& s2, const typename K::Point_3& q) { - return std::min(s1(q), s2(q)); + return (std::min)(s1(q), s2(q)); } template typename K::FT shape_difference(const S1& s1, const S2& s2, const typename K::Point_3& q) { - return std::max(s1(q), -s2(q)); + return (std::max)(s1(q), -s2(q)); } template typename K::FT shape_intersection(const S1& s1, const S2& s2, const typename K::Point_3& q) { - return std::max(s1(q), s2(q)); + return (std::max)(s1(q), s2(q)); } template typename K::FT shape_symmetric_difference(const S1& s1, const S2& s2, const typename K::Point_3& q) { - return std::max(-std::min(s1(q), s2(q)), std::max(s1(q), s2(q))); + return (std::max)(-(std::min)(s1(q), s2(q)), (std::max)(s1(q), s2(q))); } diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/topologically_correct_marching_cubes_functors.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/topologically_correct_marching_cubes_functors.h index 154ac232962..2fc215c6a2f 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/topologically_correct_marching_cubes_functors.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/topologically_correct_marching_cubes_functors.h @@ -313,17 +313,14 @@ private: d = b * b - FT(4) * a * c; } - void calc_coordinates(const std::array& values, const std::size_t idx, const FT i0, const FT a, const FT b, const FT c, const FT d, const std::vector &f_flag, unsigned char &q_sol, FT ui[2], FT vi[2], FT wi[2]) { + bool calc_coordinates(const std::array& values, const std::size_t idx, const FT i0, const FT a, const FT b, const FT c, const FT d, const std::vector &f_flag, unsigned char &q_sol, FT ui[2], FT vi[2], FT wi[2]) { const int* remap = internal::Cube_table::asymptotic_remap[idx]; - if (values[remap[0]] == values[remap[2]] && values[remap[1]] == values[remap[3]]) { - ui[0] = FT(1) / FT(0); - return; - } - if (values[remap[0]] == values[remap[4]] && values[remap[1]] == values[remap[5]]) { - ui[0] = FT(1) / FT(0); - return; - } + if (values[remap[0]] == values[remap[2]] && values[remap[1]] == values[remap[3]]) + return false; + + if (values[remap[0]] == values[remap[4]] && values[remap[1]] == values[remap[5]]) + return false; FT d2 = sqrt(CGAL::to_double(d)); @@ -460,6 +457,8 @@ private: if (0 < wi[1] && wi[1] < 1) q_sol |= 32; + + return true; } bool p_slice(const cell_descriptor& cell, @@ -872,7 +871,8 @@ private: if (a == 0 || d < 0) continue; - calc_coordinates(values, idx, i0, a, b, c, d, f_flag, q_sol, ui, vi, wi); + if (!calc_coordinates(values, idx, i0, a, b, c, d, f_flag, q_sol, ui, vi, wi)) + continue; if (!std::isfinite(CGAL::to_double(ui[0])) || !std::isfinite(CGAL::to_double(ui[1]))) continue; diff --git a/Isosurfacing_3/test/Isosurfacing_3/test_topology.cpp b/Isosurfacing_3/test/Isosurfacing_3/test_topology.cpp index 3d0605becca..a2f951ca842 100644 --- a/Isosurfacing_3/test/Isosurfacing_3/test_topology.cpp +++ b/Isosurfacing_3/test/Isosurfacing_3/test_topology.cpp @@ -24,7 +24,7 @@ #include #include -#define CGAL_TESTUISTE_ISOSURFACING_OUTPUT +#define CGAL_TESTSUITE_ISOSURFACING_OUTPUT namespace IS = CGAL::Isosurfacing; @@ -68,9 +68,9 @@ bool check_closed_not_empty(const Grid& grid, const IS::Interpolated_discrete_va for(std::size_t y=0; y::max(); + FT min = (std::numeric_limits::max)(); FT max = std::numeric_limits::lowest(); for (const FT v : center_values) { - min = std::min(min, v); - max = std::max(max, v); + min = (std::min)(min, v); + max = (std::max)(max, v); } max += 1e-3; @@ -495,7 +495,7 @@ void compare_tmc_mc_trilinear(const std::array& case_val Triangle_range triangles_high_res; IS::marching_cubes(domain_high_res, iso, points_high_res, triangles_high_res, CGAL::parameters::use_topologically_correct_marching_cubes(true)); - #ifdef CGAL_TESTUISTE_ISOSURFACING_OUTPUT + #ifdef CGAL_TESTSUITE_ISOSURFACING_OUTPUT CGAL::IO::write_polygon_soup("trilinear.off", points_high_res, triangles_high_res); #endif @@ -513,7 +513,7 @@ void compare_tmc_mc_trilinear(const std::array& case_val Triangle_range triangles_mc; IS::marching_cubes(domain, iso, points_mc, triangles_mc, CGAL::parameters::use_topologically_correct_marching_cubes(false)); - #ifdef CGAL_TESTUISTE_ISOSURFACING_OUTPUT + #ifdef CGAL_TESTSUITE_ISOSURFACING_OUTPUT CGAL::IO::write_polygon_soup("mc.off", points_mc, triangles_mc); #endif } @@ -522,7 +522,7 @@ void compare_tmc_mc_trilinear(const std::array& case_val Triangle_range triangles; IS::marching_cubes(domain, iso, points, triangles, CGAL::parameters::use_topologically_correct_marching_cubes(true)); - #ifdef CGAL_TESTUISTE_ISOSURFACING_OUTPUT + #ifdef CGAL_TESTSUITE_ISOSURFACING_OUTPUT CGAL::IO::write_polygon_soup("tmc.off", points, triangles); #endif }