CH3: Make convex_hull_3 deterministic (order of vertices and indices) (#9160)

## Summary of Changes

Adding timestamp to convex_hull_3 vertex

The reason why it makes it deterministic is because during the creation
of the hull some border edges are collected here:
[`find_visible_set(tds, farthest_pt, f_handle, visible_set, border,
traits);`](https://github.com/CGAL/cgal/blob/main/Convex_hull_3/include/CGAL/convex_hull_3.h#L659C6-L659C80)

with `border` being [`typedef std::map<typename TDS_2::Vertex_handle,
typename TDS_2::Edge>
Border_edges;`](https://github.com/CGAL/cgal/blob/main/Convex_hull_3/include/CGAL/convex_hull_3.h#L643).

Then another container `edges` is filled using `border.begin()`
[here](https://github.com/CGAL/cgal/blob/main/Convex_hull_3/include/CGAL/convex_hull_3.h#L678C1-L692C7).

The call to [`Vertex_handle vh = tds.star_hole(edges.begin(),
edges.end(), visible_set.begin(),
visible_set.end());`](https://github.com/CGAL/cgal/blob/main/Convex_hull_3/include/CGAL/convex_hull_3.h#L707)
then induced that the order of faces in the TDS depends on the order of
edges in `edges`. The timestamp makes that the first vertex is always
the same in `border_edges`.

## Release Management

* Affected package(s): Convex_hull_3
This commit is contained in:
Sebastien Loriot 2025-12-12 17:48:19 +01:00 committed by GitHub
commit fed810284e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

View File

@ -56,7 +56,7 @@ public:
Vertex_handle v2,
Face_handle n0,
Face_handle n1,
Face_handle n2 )
Face_handle n2)
: Fb(v0, v1, v2, n0, n1, n2), _info(0) {}
const int& info() const { return _info; }

View File

@ -19,6 +19,8 @@
#include <CGAL/Triangulation_ds_vertex_base_2.h>
#include <CGAL/IO/io.h>
#include <CGAL/Has_timestamp.h>
#include <CGAL/Time_stamper.h>
#include <iostream>
@ -38,6 +40,7 @@ public:
private:
int _info = 0;
Point _p;
std::size_t time_stamp_ = std::size_t(-2);
public:
template < typename TDS2 >
@ -65,6 +68,18 @@ public:
const int& info() const { return _info; }
int& info() { return _info; }
/// For the determinism of Compact_container iterators
///@{
typedef Tag_true Has_timestamp;
std::size_t time_stamp() const {
return time_stamp_;
}
void set_time_stamp(const std::size_t& ts) {
time_stamp_ = ts;
}
///@}
};
template <typename GT, typename Vb>