File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Generator/include/CGAL/internal Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 2121#ifndef CGAL_INTERNAL_GENERIC_RANDOM_POINT_GENERATOR_H
2222#define CGAL_INTERNAL_GENERIC_RANDOM_POINT_GENERATOR_H
2323
24+ #include < CGAL/assertions.h>
25+ #include < CGAL/Iterator_range.h>
2426#include < CGAL/generators.h>
2527#include < CGAL/Random.h>
2628#include < CGAL/property_map.h>
27- # include < vector >
29+
2830#include < boost/foreach.hpp>
29- #include < CGAL/Iterator_range.h>
31+
32+ #include < vector>
3033
3134namespace CGAL {
3235
@@ -56,6 +59,8 @@ class Generic_random_point_generator : public Random_generator_base<P>
5659 , random(rnd)
5760 {
5861 std::size_t input_size = input.size ();
62+ CGAL_precondition (input_size > 0 );
63+
5964 ids.reserve (input_size);
6065 weights.reserve (input_size);
6166
@@ -70,9 +75,11 @@ class Generic_random_point_generator : public Random_generator_base<P>
7075 total_weight += to_double ( compute_weight (object) );
7176 weights.push_back (total_weight);
7277 }
78+
7379 // generate the first point
7480 generate_point ();
7581 }
82+
7683 This& operator ++()
7784 {
7885 generate_point ();
@@ -84,6 +91,7 @@ class Generic_random_point_generator : public Random_generator_base<P>
8491 ++(*this );
8592 return tmp;
8693 }
94+
8795 double sum_of_weights () const
8896 {
8997 if (weights.empty ())
You can’t perform that action at this time.
0 commit comments