From cfae913d77ec5e346aed9e5d3c90e3d591dea4ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 29 Sep 2023 11:13:31 +0200 Subject: [PATCH] Complete the sort functor in AW3's main queue --- .../internal/gate_priority_queue.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/gate_priority_queue.h b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/gate_priority_queue.h index 5e14a4d08ea..a9bdd7e0491 100644 --- a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/gate_priority_queue.h +++ b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/gate_priority_queue.h @@ -68,6 +68,24 @@ struct Less_gate template bool operator()(const Gate& a, const Gate& b) const { + // If one is artificial and the other is not, give priority to the artificial facet + // + // The artificial facet are given highest priority because they need to be treated + // regardless of their circumradius. Treating them first allow the part that depends + // on alpha to be treated uniformly in a way: whatever the alpha, we'll do the same + // first treatmen + if(a.is_artificial_facet() != b.is_artificial_facet()) + return a.is_artificial_facet(); + + if(a.priority() == b.priority()) + { + // arbitrary, the sole purpose is to make it a total order for determinism + if(a.facet().first->time_stamp() == b.facet().first->time_stamp()) + return a.facet().second < b.facet().second; + + return a.facet().first->time_stamp() < b.facet().first->time_stamp(); + } + return a.priority() > b.priority(); } };