From fd39972166e018dfc90954ccc17a69f06f28478c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 15 Jul 2016 09:51:27 +0200 Subject: [PATCH] add method to access the sum of weights --- .../include/CGAL/internal/Generic_random_point_generator.h | 6 ++++++ Generator/include/CGAL/point_generators_3.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/Generator/include/CGAL/internal/Generic_random_point_generator.h b/Generator/include/CGAL/internal/Generic_random_point_generator.h index 5bf29cd15d9..fb16bde5dc1 100644 --- a/Generator/include/CGAL/internal/Generic_random_point_generator.h +++ b/Generator/include/CGAL/internal/Generic_random_point_generator.h @@ -84,6 +84,12 @@ public: ++(*this); return tmp; } + double sum_of_weights() const + { + if (weights.empty()) + return 0; + return weights.back(); + } }; template < typename Id, class ObjectFromIdMap, class GeneratorOnObject, class P > diff --git a/Generator/include/CGAL/point_generators_3.h b/Generator/include/CGAL/point_generators_3.h index bf5b523dd4b..586f3a6b46b 100644 --- a/Generator/include/CGAL/point_generators_3.h +++ b/Generator/include/CGAL/point_generators_3.h @@ -347,6 +347,10 @@ public: ++(*this); return tmp; } + double mesh_area() const + { + this->sum_of_weights(); + } }; namespace internal