From fc67bf6a60ad94f61382886847e899899b1cd7ef Mon Sep 17 00:00:00 2001 From: Deepak Rangarajan Date: Tue, 20 Jul 2021 10:17:20 -0400 Subject: [PATCH] Use a fixed seed when generating hull --- src/csg/cgal_helper_polyhedron.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/csg/cgal_helper_polyhedron.cpp b/src/csg/cgal_helper_polyhedron.cpp index 1fa87b3..ea2735b 100644 --- a/src/csg/cgal_helper_polyhedron.cpp +++ b/src/csg/cgal_helper_polyhedron.cpp @@ -10,6 +10,7 @@ #include #include #include +#include namespace { @@ -110,11 +111,14 @@ create_polyhedron_from_hull(const std::tuple &cube_size, auto p = std::make_shared(); + // Use a fixed seed random function to ensure reproducibility + auto rand = CGAL::Random(0); + std::list points; - CGAL::Random_points_on_sphere_3 s(sphere_radius); + CGAL::Random_points_on_sphere_3 s(sphere_radius, rand); std::copy_n(s, NUM_SAMPLING_PTS, std::back_inserter(points)); - CGAL::Random_points_in_cube_3 c(1.0); + CGAL::Random_points_in_cube_3 c(1.0, rand); std::list points_c; std::copy_n(c, NUM_SAMPLING_PTS, std::back_inserter(points_c)); -- GitLab