Skip to content

Commit

Permalink
Merge branch 'Env_3-fixes-efif' of github.com:efifogel/cgal into Env_…
Browse files Browse the repository at this point in the history
…3-fixes-efif
  • Loading branch information
efifogel committed Nov 15, 2023
2 parents 3b8e203 + 058c3d7 commit d7c7d6e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
36 changes: 20 additions & 16 deletions Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,38 +247,42 @@ class Arr_curve_data_traits_2 : public Traits_ {
private:
const Base_traits_2& m_base;

/*! Generate a helper class template to find out whether the base geometry
* traits has a nested type named Are_mergeable_2.
*/
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_are_mergeable_2,
Are_mergeable_2, false)
template <typename T>
bool are_mergeable_data(const T& cv1, const T& cv2, long) const {
CGAL_error_msg("Equality operator is not supported.");
return false;
}

template <typename T>
auto are_mergeable_data(const T& cv1, const T& cv2, int) const ->
decltype(cv1.data() == cv2.data())
{ return cv1.data() == cv2.data(); }

/*! Implementation of the predicate in case the base geometry traits class
* has a nested type named Are_mergeable_2.
*/
template <typename GeomeTraits_2>
std::enable_if_t<has_are_mergeable_2<GeomeTraits_2>::value,bool>
are_mergeable(const X_monotone_curve_2& cv1,
const X_monotone_curve_2& cv2) const
{
auto are_mergeable(const X_monotone_curve_2& cv1,
const X_monotone_curve_2& cv2,
const GeomeTraits_2& traits, int) const ->
decltype(traits.are_mergeable_2_object(), bool()) {
// In case the two base curves are not mergeable, the extended curves
// are not mergeable as well.
if (! (m_base.are_mergeable_2_object()(cv1, cv2))) return false;
if (! (traits.are_mergeable_2_object()(cv1, cv2))) return false;

// In case the two base curves are mergeable, check that they have the
// same data fields.
return (cv1.data() == cv2.data());
return are_mergeable_data(cv1, cv2, 0);
}

/*! Implementation of the predicate in case the base geometry traits class
* does not have a nested type named Are_mergeable_2.
* This function should never be called!
*/
template <typename GeomeTraits_2>
std::enable_if_t<!has_are_mergeable_2<GeomeTraits_2>::value,bool>
are_mergeable(const X_monotone_curve_2& /* cv1 */,
const X_monotone_curve_2& /* cv2 */) const
{
bool are_mergeable(const X_monotone_curve_2& /* cv1 */,
const X_monotone_curve_2& /* cv2 */,
const GeomeTraits_2& /* traits */, long) const {
CGAL_error_msg("Are mergeable is not supported.");
return false;
}
Expand All @@ -294,7 +298,7 @@ class Arr_curve_data_traits_2 : public Traits_ {
*/
bool operator()(const X_monotone_curve_2& cv1,
const X_monotone_curve_2& cv2) const
{ return are_mergeable<Base_traits_2>(cv1, cv2); }
{ return are_mergeable<Base_traits_2>(cv1, cv2, m_base, 0); }
};

/*! Obtain an Are_mergeable_2 functor object. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class Envelope_divide_and_conquer_3 {

if (begin == end) {
// only one surface is in the collection. insert it the result
Xy_monotone_surface_3& surf = *first;
const Xy_monotone_surface_3& surf = *first;

deal_with_one_surface(surf, result);
return;
Expand Down Expand Up @@ -260,7 +260,7 @@ class Envelope_divide_and_conquer_3 {
CGAL_assertion(is_envelope_valid(result));
}

void deal_with_one_surface(Xy_monotone_surface_3& surf,
void deal_with_one_surface(const Xy_monotone_surface_3& surf,
Minimization_diagram_2& result) {
using Boundary_xcurve = std::pair<X_monotone_curve_2, Oriented_side>;
using Boundary_list = std::list<std::variant<Boundary_xcurve,Point_2>>;
Expand Down

0 comments on commit d7c7d6e

Please sign in to comment.