diff --git a/Straight_skeleton_extrusion_2/include/CGAL/extrude_skeleton.h b/Straight_skeleton_extrusion_2/include/CGAL/extrude_skeleton.h index b0b5c2a283b..35f132bbf9b 100644 --- a/Straight_skeleton_extrusion_2/include/CGAL/extrude_skeleton.h +++ b/Straight_skeleton_extrusion_2/include/CGAL/extrude_skeleton.h @@ -81,6 +81,9 @@ enum class Slope VERTICAL }; +template +const FT default_extrusion_height = { (std::numeric_limits::max)() }; + // @todo Maybe this postprocessing is not really necessary? Do users really care if the point // is not perfectly above the input contour edge (it generally cannot be anyway if the kernel is not exact except for some // specific cases)? @@ -318,9 +321,6 @@ class Extrusion_builder private: Geom_traits m_gt; -public: - static constexpr FT default_height = FT((std::numeric_limits::max)()); - public: Extrusion_builder(const Geom_traits& gt) : m_gt(gt) { } @@ -500,7 +500,7 @@ public: const bool ignore_frame_faces = false, const bool invert_faces = false) { - CGAL_precondition(height != default_height); + CGAL_precondition(height != default_extrusion_height); const bool extrude_upwards = is_positive(height); const FT abs_height = CGAL::abs(height); @@ -624,7 +624,7 @@ public: // @partial_wsls_pwh interior SLS of weighted polygons with holes can have skeleton faces with holes // The current postprocessing is in the function EnforceSimpleConnectedness, but it has not yet // been made compatible with partial skeletons. - if(height == default_height || pwh.number_of_holes() != 0) + if(height == default_extrusion_height || pwh.number_of_holes() != 0) { ss_ptr = CGAL::create_interior_weighted_straight_skeleton_2( CGAL_SS_i::vertices_begin(pwh.outer_boundary()), @@ -657,7 +657,7 @@ public: CGAL::draw(*ss_ptr); #endif - if(height == default_height) + if(height == default_extrusion_height) { #ifdef CGAL_SLS_SNAP_TO_VERTICAL_SLABS construct_lateral_faces(*ss_ptr, points, faces, vertical_weight, snapped_positions); @@ -665,7 +665,7 @@ public: construct_lateral_faces(*ss_ptr, points, faces); #endif } - else // height != default_height + else // height != default_extrusion_height { #ifdef CGAL_SLS_SNAP_TO_VERTICAL_SLABS Visitor visitor(*ss_ptr, offset_points, vertical_weight, snapped_positions); @@ -710,7 +710,7 @@ public: FaceRange& faces) { CGAL_precondition(!is_zero(height)); - CGAL_precondition(height != default_height); // was checked before, this is just a reminder + CGAL_precondition(height != default_extrusion_height); // was checked before, this is just a reminder const FT abs_height = abs(height); @@ -976,8 +976,7 @@ bool extrude_skeleton(const PolygonWithHoles& pwh, const bool verbose = choose_parameter(get_parameter(np, internal_np::verbose), false); Geom_traits gt = choose_parameter(get_parameter(np, CGAL::internal_np::geom_traits)); - const FT height = choose_parameter(get_parameter(np, internal_np::maximum_height), - Extrusion_builder::default_height); + const FT height = choose_parameter(get_parameter(np, internal_np::maximum_height), default_extrusion_height); Slope slope; bool valid_input; @@ -1004,9 +1003,7 @@ bool extrude_skeleton(const PolygonWithHoles& pwh, // End of preprocessing, start the actual skeleton computation - Extrusion_builder builder(gt); - - if(slope != Slope::INWARD && height == builder.default_height) + if(slope != Slope::INWARD && height == default_extrusion_height) { if(verbose) std::cerr << "Error: height must be specified when using an outward (or vertical) slope" << std::endl; @@ -1019,6 +1016,7 @@ bool extrude_skeleton(const PolygonWithHoles& pwh, points.reserve(2 * pwh.outer_boundary().size()); // just a reasonnable guess faces.reserve(2 * pwh.outer_boundary().size() + 2*pwh.number_of_holes()); + Extrusion_builder builder(gt); bool res; if(slope != Slope::OUTWARD) // INWARD or VERTICAL res = builder.inward_construction(pwh, weights, vertical_weight, height, points, faces);