mirror of https://github.com/CGAL/cgal
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:
commit
fed810284e
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue