replace CGAL::Random& by mutable CGAL::Random for member variable type

and make use of const everywhere else
This commit is contained in:
Jane Tournois 2014-03-25 11:39:12 +01:00
parent 1916ecf872
commit 1c1b65ae39
5 changed files with 17 additions and 20 deletions

View File

@ -67,7 +67,7 @@ public:
*/ */
Implicit_mesh_domain_3(const Function& f, Implicit_mesh_domain_3(const Function& f,
const Sphere_3& bounding_sphere, const Sphere_3& bounding_sphere,
CGAL::Random& rng = CGAL::Random(0), const CGAL::Random& rng = CGAL::Random(0),
const FT& error_bound = FT(1e-3)) const FT& error_bound = FT(1e-3))
: Base(Wrapper(f), bounding_sphere, rng, error_bound) {} : Base(Wrapper(f), bounding_sphere, rng, error_bound) {}

View File

@ -56,7 +56,7 @@ public:
/// Constructor /// Constructor
Labeled_image_mesh_domain_3(const Image& image, Labeled_image_mesh_domain_3(const Image& image,
CGAL::Random& rng = CGAL::Random(0), const CGAL::Random& rng = CGAL::Random(0),
const FT& error_bound = FT(1e-3)) const FT& error_bound = FT(1e-3))
: Base(Wrapper(image), : Base(Wrapper(image),
compute_bounding_box(image), compute_bounding_box(image),

View File

@ -96,12 +96,12 @@ public:
*/ */
Labeled_mesh_domain_3(const Function& f, Labeled_mesh_domain_3(const Function& f,
const Sphere_3& bounding_sphere, const Sphere_3& bounding_sphere,
CGAL::Random& rng = CGAL::Random(0), const CGAL::Random& rng = CGAL::Random(0),
const FT& error_bound = FT(1e-3)); const FT& error_bound = FT(1e-3));
Labeled_mesh_domain_3(const Function& f, Labeled_mesh_domain_3(const Function& f,
const Bbox_3& bbox, const Bbox_3& bbox,
CGAL::Random& rng = CGAL::Random(0), const CGAL::Random& rng = CGAL::Random(0),
const FT& error_bound = FT(1e-3)); const FT& error_bound = FT(1e-3));
/// Destructor /// Destructor
@ -466,7 +466,7 @@ private:
/// The bounding box /// The bounding box
const Iso_cuboid_3 bbox_; const Iso_cuboid_3 bbox_;
/// The random number generator used by Construct_initial_points /// The random number generator used by Construct_initial_points
CGAL::Random& rng_; mutable CGAL::Random rng_;
/// Error bound relative to sphere radius /// Error bound relative to sphere radius
FT squared_error_bound_; FT squared_error_bound_;
@ -489,7 +489,7 @@ template<class F, class BGT>
Labeled_mesh_domain_3<F,BGT>::Labeled_mesh_domain_3( Labeled_mesh_domain_3<F,BGT>::Labeled_mesh_domain_3(
const F& f, const F& f,
const Sphere_3& bounding_sphere, const Sphere_3& bounding_sphere,
CGAL::Random& rng, const CGAL::Random& rng,
const FT& error_bound ) const FT& error_bound )
: function_(f) : function_(f)
, bbox_(iso_cuboid(bounding_sphere.bbox())) , bbox_(iso_cuboid(bounding_sphere.bbox()))
@ -503,7 +503,7 @@ template<class F, class BGT>
Labeled_mesh_domain_3<F,BGT>::Labeled_mesh_domain_3( Labeled_mesh_domain_3<F,BGT>::Labeled_mesh_domain_3(
const F& f, const F& f,
const Bbox_3& bbox, const Bbox_3& bbox,
CGAL::Random& rng, const CGAL::Random& rng,
const FT& error_bound ) const FT& error_bound )
: function_(f) : function_(f)
, bbox_(iso_cuboid(bbox)) , bbox_(iso_cuboid(bbox))

View File

@ -215,7 +215,7 @@ public:
* @param polyhedron the polyhedron describing the polyhedral surface * @param polyhedron the polyhedron describing the polyhedral surface
*/ */
Polyhedral_mesh_domain_3(const Polyhedron& p, Polyhedral_mesh_domain_3(const Polyhedron& p,
CGAL::Random& rng = CGAL::Random(0)) const CGAL::Random& rng = CGAL::Random(0))
: tree_(TriangleAccessor().triangles_begin(p), : tree_(TriangleAccessor().triangles_begin(p),
TriangleAccessor().triangles_end(p)), TriangleAccessor().triangles_end(p)),
bounding_tree_(&tree_) // the bounding tree is tree_ bounding_tree_(&tree_) // the bounding tree is tree_
@ -230,7 +230,7 @@ public:
Polyhedral_mesh_domain_3(const Polyhedron& p, Polyhedral_mesh_domain_3(const Polyhedron& p,
const Polyhedron& bounding_polyhedron, const Polyhedron& bounding_polyhedron,
CGAL::Random& rng = CGAL::Random(0)) const CGAL::Random& rng = CGAL::Random(0))
: tree_(TriangleAccessor().triangles_begin(p), : tree_(TriangleAccessor().triangles_begin(p),
TriangleAccessor().triangles_end(p)) TriangleAccessor().triangles_end(p))
, bounding_tree_(new AABB_tree_(TriangleAccessor().triangles_begin(bounding_polyhedron), , bounding_tree_(new AABB_tree_(TriangleAccessor().triangles_begin(bounding_polyhedron),
@ -259,7 +259,7 @@ public:
Polyhedral_mesh_domain_3(InputPolyhedraPtrIterator begin, Polyhedral_mesh_domain_3(InputPolyhedraPtrIterator begin,
InputPolyhedraPtrIterator end, InputPolyhedraPtrIterator end,
const Polyhedron& bounding_polyhedron, const Polyhedron& bounding_polyhedron,
CGAL::Random& rng = CGAL::Random(0)) const CGAL::Random& rng = CGAL::Random(0))
: has_cache(false) : has_cache(false)
, rng_(rng) , rng_(rng)
{ {
@ -296,7 +296,7 @@ public:
template <typename InputPolyhedraPtrIterator> template <typename InputPolyhedraPtrIterator>
Polyhedral_mesh_domain_3(InputPolyhedraPtrIterator begin, Polyhedral_mesh_domain_3(InputPolyhedraPtrIterator begin,
InputPolyhedraPtrIterator end, InputPolyhedraPtrIterator end,
CGAL::Random& rng = CGAL::Random(0)) const CGAL::Random& rng = CGAL::Random(0))
: has_cache(false) : has_cache(false)
, rng_(rng) , rng_(rng)
{ {
@ -609,7 +609,7 @@ private:
mutable AABB_primitive_id cached_primitive_id; mutable AABB_primitive_id cached_primitive_id;
//random number generator for Construct_initial_points //random number generator for Construct_initial_points
CGAL::Random& rng_; mutable CGAL::Random rng_;
public: public:
@ -627,7 +627,7 @@ public:
return has_cache && (cached_query == Cached_query(q)); return has_cache && (cached_query == Cached_query(q));
} }
void set_random_generator(CGAL::Random& rng) void set_random_generator(const CGAL::Random& rng)
{ {
rng_ = rng; rng_ = rng;
} }

View File

@ -95,13 +95,10 @@ public:
/// Constructors /// Constructors
Polyhedral_mesh_domain_with_features_3(const Polyhedron& p, Polyhedral_mesh_domain_with_features_3(const Polyhedron& p,
CGAL::Random& rng = CGAL::Random(0)); const CGAL::Random& rng = CGAL::Random(0));
Polyhedral_mesh_domain_with_features_3(const std::string& filename, Polyhedral_mesh_domain_with_features_3(const std::string& filename,
CGAL::Random& rng = CGAL::Random(0)); const CGAL::Random& rng = CGAL::Random(0));
template <typename T1, typename T2>
Polyhedral_mesh_domain_with_features_3(const T1& a, const T2& b)
: Base(a, b) {}
template <typename T1, typename T2, typename T3> template <typename T1, typename T2, typename T3>
Polyhedral_mesh_domain_with_features_3(const T1& a, const T2& b, const T3& c) Polyhedral_mesh_domain_with_features_3(const T1& a, const T2& b, const T3& c)
@ -132,7 +129,7 @@ template < typename GT_, typename P_, typename TA_,
typename Tag_, typename E_tag_> typename Tag_, typename E_tag_>
Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>:: Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>::
Polyhedral_mesh_domain_with_features_3(const Polyhedron& p, Polyhedral_mesh_domain_with_features_3(const Polyhedron& p,
CGAL::Random& rng) const CGAL::Random& rng)
: Base() : Base()
, polyhedron_(p) , polyhedron_(p)
{ {
@ -144,7 +141,7 @@ template < typename GT_, typename P_, typename TA_,
typename Tag_, typename E_tag_> typename Tag_, typename E_tag_>
Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>:: Polyhedral_mesh_domain_with_features_3<GT_,P_,TA_,Tag_,E_tag_>::
Polyhedral_mesh_domain_with_features_3(const std::string& filename, Polyhedral_mesh_domain_with_features_3(const std::string& filename,
CGAL::Random& rng) const CGAL::Random& rng)
: Base() : Base()
, polyhedron_() , polyhedron_()
{ {