mirror of https://github.com/CGAL/cgal
Merge from trunk:
| ------------------------------------------------------------------------ | r53846 | afabri | 2010-01-27 17:44:13 +0100 (Wed, 27 Jan 2010) | 1 line | Changed paths: | M /trunk/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_hierarchy_2.h | | Change rng and use rng in random_shuffle | ------------------------------------------------------------------------ | r53859 | afabri | 2010-01-28 08:48:26 +0100 (Thu, 28 Jan 2010) | 1 line | Changed paths: | M /trunk/Spatial_sorting/include/CGAL/hilbert_sort.h | M /trunk/Spatial_sorting/include/CGAL/spatial_sort.h | | Default constructor of boost::rand48 is good enough | ------------------------------------------------------------------------ | r53860 | afabri | 2010-01-28 08:50:26 +0100 (Thu, 28 Jan 2010) | 1 line | Changed paths: | M /trunk/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h | | Switch to boost::rand48 | ------------------------------------------------------------------------ | r53861 | afabri | 2010-01-28 09:29:45 +0100 (Thu, 28 Jan 2010) | 1 line | Changed paths: | M /trunk/Point_set_processing_3/doc_tex/Point_set_processing_3_ref/grid_simplify_point_set.tex | M /trunk/Point_set_processing_3/doc_tex/Point_set_processing_3_ref/random_simplify_point_set.tex | | Remove repeated words | ------------------------------------------------------------------------ | r53864 | afabri | 2010-01-28 10:48:59 +0100 (Thu, 28 Jan 2010) | 1 line | Changed paths: | M /trunk/Interval_skip_list/include/CGAL/Interval_skip_list.h | | switch to boost::rand48 | ------------------------------------------------------------------------ |
This commit is contained in:
parent
c6a21267a4
commit
d85a3fc17f
|
|
@ -24,7 +24,10 @@
|
|||
#include <CGAL/basic.h>
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <CGAL/Random.h>
|
||||
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/geometric_distribution.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
|
||||
|
||||
//#define CGAL_ISL_USE_CCC
|
||||
|
|
@ -126,7 +129,7 @@ class Interval_for_container : public Interval_
|
|||
private:
|
||||
typedef Interval_ Interval;
|
||||
typedef typename Interval::Value Value;
|
||||
Random rand;
|
||||
boost::rand48 random;
|
||||
|
||||
#ifdef CGAL_ISL_USE_LIST
|
||||
std::list<Interval> container;
|
||||
|
|
@ -1193,14 +1196,10 @@ template <class Interval>
|
|||
int
|
||||
Interval_skip_list<Interval>::randomLevel()
|
||||
{
|
||||
const float P = 0.5;
|
||||
boost::geometric_distribution<> proba(0.5);
|
||||
boost::variate_generator<boost::rand48&, boost::geometric_distribution<> > die(random, proba);
|
||||
|
||||
int levels = 0;
|
||||
while( P < rand.get_double(0,1)) levels++;
|
||||
if ( levels <= maxLevel)
|
||||
return(levels);
|
||||
else
|
||||
return(maxLevel+1);
|
||||
return (std::min)(die(), (int)maxLevel)+1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@
|
|||
#include <list>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/uniform_smallint.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
|
||||
#include <CGAL/triangulation_assertions.h>
|
||||
|
||||
|
|
@ -43,7 +46,6 @@
|
|||
|
||||
#include <CGAL/Periodic_3_triangulation_iterators_3.h>
|
||||
|
||||
#include <CGAL/Random.h>
|
||||
#include <CGAL/Unique_hash_map.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
|
@ -178,7 +180,6 @@ private:
|
|||
Geometric_traits _gt;
|
||||
Triangulation_data_structure _tds;
|
||||
Iso_cuboid _domain;
|
||||
mutable Random rng;
|
||||
/// This threshold should be chosen such that if all edges are shorter,
|
||||
/// we can be sure that there are no self-edges anymore.
|
||||
FT edge_length_threshold;
|
||||
|
|
@ -1510,12 +1511,16 @@ Periodic_3_triangulation_3<GT,TDS>::locate(const Point & p, const Offset &o_p,
|
|||
// at the end to decide if p lies on a face/edge/vertex/interior.
|
||||
Orientation o[4];
|
||||
|
||||
boost::rand48 rng;
|
||||
boost::uniform_smallint<> four(0, 3);
|
||||
boost::variate_generator<boost::rand48&, boost::uniform_smallint<> > die4(rng, four);
|
||||
|
||||
|
||||
// Now treat the cell c.
|
||||
try_next_cell:
|
||||
// For the remembering stochastic walk,
|
||||
// we need to start trying with a random index :
|
||||
int i = rng.template get_bits<2>();
|
||||
int i = die4();
|
||||
// For the remembering visibility walk (Delaunay only), we don't :
|
||||
// int i = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
Function \ccc{CGAL::grid_simplify_point_set()} considers a regular grid covering the bounding box of the input point set, and clusters all points sharing the same cell of the grid by picking as representant one arbitrarily chosen point.
|
||||
|
||||
This method modifies the order of input points so as to pack all remaining points first, and returns and returns an iterator over the first point to remove (see erase-remove idiom). For this reason it should not be called on sorted containers.
|
||||
This method modifies the order of input points so as to pack all remaining points first, and returns an iterator over the first point to remove (see erase-remove idiom). For this reason it should not be called on sorted containers.
|
||||
|
||||
\ccInclude{CGAL/grid_simplify_point_set.h}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
\ccDefinition
|
||||
|
||||
\ccc{CGAL::random_simplify_point_set()} randomly deletes a user-specified fraction of the input points. This method modifies the order of input points so as to pack all remaining points first, and returns and returns an iterator over the first point to remove (see erase-remove idiom). For this reason it should not be called on sorted containers.
|
||||
\ccc{CGAL::random_simplify_point_set()} randomly deletes a user-specified fraction of the input points. This method modifies the order of input points so as to pack all remaining points first, and returns an iterator over the first point to remove (see erase-remove idiom). For this reason it should not be called on sorted containers.
|
||||
|
||||
\ccInclude{CGAL/random_simplify_point_set.h}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,9 +24,13 @@
|
|||
|
||||
#include <map>
|
||||
|
||||
#include <boost/random.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/geometric_distribution.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
|
||||
#include <CGAL/Segment_Delaunay_graph_2/basic.h>
|
||||
|
||||
#include <CGAL/Random.h>
|
||||
#include <CGAL/Segment_Delaunay_graph_2.h>
|
||||
#include <CGAL/Triangulation_data_structure_2.h>
|
||||
#include <CGAL/Segment_Delaunay_graph_vertex_base_2.h>
|
||||
|
|
@ -129,8 +133,7 @@ protected:
|
|||
|
||||
// here is the stack of triangulations which form the hierarchy
|
||||
Base* hierarchy[sdg_hierarchy_2__maxlevel];
|
||||
Random random; // random number generator
|
||||
|
||||
boost::rand48 random; // random generator
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
//-------------
|
||||
|
|
@ -140,7 +143,7 @@ public:
|
|||
Segment_Delaunay_graph_hierarchy_2(Input_iterator first,
|
||||
Input_iterator beyond,
|
||||
const Gt& gt=Gt())
|
||||
: Base(gt), random((long)0)
|
||||
: Base(gt)
|
||||
{
|
||||
init_hierarchy(gt);
|
||||
insert(first, beyond);
|
||||
|
|
@ -176,7 +179,9 @@ public:
|
|||
for (Input_iterator it = first; it != beyond; ++it) {
|
||||
site_vec.push_back(Site_2(*it));
|
||||
}
|
||||
std::random_shuffle(site_vec.begin(), site_vec.end());
|
||||
|
||||
boost::random_number_generator<boost::rand48> rng(random);
|
||||
std::random_shuffle(site_vec.begin(), site_vec.end(),rng);
|
||||
return insert(site_vec.begin(), site_vec.end(), Tag_false());
|
||||
}
|
||||
|
||||
|
|
@ -423,14 +428,10 @@ protected:
|
|||
// LOCAL HELPER METHODS
|
||||
//---------------------
|
||||
int random_level() {
|
||||
unsigned int l = 0;
|
||||
while ( true ) {
|
||||
if ( random(sdg_hierarchy_2__ratio) ) break;
|
||||
++l;
|
||||
}
|
||||
if (l >= sdg_hierarchy_2__maxlevel)
|
||||
l = sdg_hierarchy_2__maxlevel - 1;
|
||||
return l;
|
||||
boost::geometric_distribution<> proba(1.0/sdg_hierarchy_2__ratio);
|
||||
boost::variate_generator<boost::rand48&, boost::geometric_distribution<> > die(random, proba);
|
||||
|
||||
return (std::min)(die(), (int)sdg_hierarchy_2__maxlevel)-1;
|
||||
}
|
||||
|
||||
size_type find_level(Vertex_handle v) const {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ namespace internal {
|
|||
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||
const Kernel &k, typename Kernel::Point_2 *)
|
||||
{
|
||||
boost::random_number_generator<boost::rand48> rng(boost::rand48(0L));
|
||||
boost::rand48 random;
|
||||
boost::random_number_generator<boost::rand48> rng(random);
|
||||
std::random_shuffle(begin,end, rng);
|
||||
(Hilbert_sort_2<Kernel> (k)) (begin, end);
|
||||
}
|
||||
|
|
@ -47,7 +48,8 @@ namespace internal {
|
|||
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||
const Kernel &k, typename Kernel::Point_3 *)
|
||||
{
|
||||
boost::random_number_generator<boost::rand48> rng(boost::rand48(0L));
|
||||
boost::rand48 random;
|
||||
boost::random_number_generator<boost::rand48> rng(random);
|
||||
std::random_shuffle(begin,end, rng);
|
||||
(Hilbert_sort_3<Kernel> (k)) (begin, end);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ namespace internal {
|
|||
const Kernel &k, typename Kernel::Point_2 *)
|
||||
{
|
||||
typedef Hilbert_sort_2<Kernel> Sort;
|
||||
|
||||
boost::random_number_generator<boost::rand48> rng(boost::rand48(0L));
|
||||
boost::rand48 random;
|
||||
boost::random_number_generator<boost::rand48> rng(random);
|
||||
std::random_shuffle(begin,end,rng);
|
||||
|
||||
(Multiscale_sort<Sort> (Sort (k, 4), 16, 0.25)) (begin, end);
|
||||
|
|
@ -53,8 +53,8 @@ namespace internal {
|
|||
const Kernel &k, typename Kernel::Point_3 *)
|
||||
{
|
||||
typedef Hilbert_sort_3<Kernel> Sort;
|
||||
|
||||
boost::random_number_generator<boost::rand48> rng(boost::rand48(0L));
|
||||
boost::rand48 random;
|
||||
boost::random_number_generator<boost::rand48> rng(random);
|
||||
std::random_shuffle(begin,end, rng);
|
||||
|
||||
(Multiscale_sort<Sort> (Sort (k, 8), 64, 0.125)) (begin, end);
|
||||
|
|
|
|||
Loading…
Reference in New Issue