merge from next

This commit is contained in:
Sébastien Loriot 2012-06-01 07:27:29 +00:00
commit 88f58d2512
2 changed files with 56 additions and 8 deletions

View File

@ -12,15 +12,18 @@
#include <vector>
#define bench(METHOD) \
#define bench(METHOD,CONTAINER) \
{\
std::size_t previous=0;\
unsigned run=0;\
CGAL::Timer time;\
do{\
result.clear();\
time.start();\
METHOD( points.begin(), points.end(), std::back_inserter(result) );\
METHOD( CONTAINER.begin(), CONTAINER.end(), std::back_inserter(result) );\
time.stop();\
if( previous!=0 && previous!=result.size()) std::cerr << "error got different result" << std::endl;\
previous=result.size();\
}while(++run<repeat+1);\
std::cout << result.size() << " points on the convex hull using "<< #METHOD << "; Done in "<< time.time() << "s\n";\
}
@ -37,6 +40,7 @@ int main(int argc, char** argv)
unsigned seed=0;
if (argc>1) nbpts=atoi(argv[1]);
if (argc>2) repeat=atoi(argv[2]);
if (argc>3) seed=atoi(argv[3]);
@ -46,12 +50,52 @@ int main(int argc, char** argv)
CGAL::Random_points_in_disc_2<Point_2,Creator> g( 150.0,r);
CGAL::cpp0x::copy_n( g, nbpts, std::back_inserter(points));
//the following code is for testing when there is only two extreme points, affine hull is 2D
/*
CGAL::Bbox_2 bbox=points.begin()->bbox();
for (Points::iterator it=points.begin();it!=points.end();++it)
bbox=bbox+it->bbox();
points.push_back( Point_2(bbox.xmin()-1,bbox.ymin()-1) );
points.push_back( Point_2(bbox.xmax()+1,bbox.ymax()+1) );
*/
//the following code is for testing when there is only three extreme points
/*
CGAL::Bbox_2 bbox=points.begin()->bbox();
for (Points::iterator it=points.begin();it!=points.end();++it)
bbox=bbox+it->bbox();
points.push_back( Point_2(bbox.xmin()-1,bbox.ymin()-1) );
points.push_back( Point_2(bbox.xmax()+1,bbox.ymax()+1) );
points.push_back( Point_2(bbox.xmax(),bbox.ymax()+2) );
*/
//the following code is for testing when there is only two extreme points, affine hull is 1D
/*
points.clear();
for (unsigned i=0;i<nbpts;++i)
points.push_back(Point_2(i,i));
*/
std::cout << "seed is " << seed << "; using " << nbpts << " pts; on " << repeat+1 << " run(s).\n";
bench(CGAL::convex_hull_2)
//bench(CGAL::ch_akl_toussaint)
//bench(CGAL::ch_bykat)
//bench(CGAL::ch_eddy)
//bench(CGAL::ch_graham_andrew)
//bench(CGAL::ch_jarvis)
std::cout << "Using vector" << std::endl;
bench(CGAL::convex_hull_2,points)
//bench(CGAL::ch_akl_toussaint,points)
//bench(CGAL::ch_bykat,points)
//bench(CGAL::ch_eddy,points)
//bench(CGAL::ch_graham_andrew,points)
//bench(CGAL::ch_jarvis,points)
{
std::list<Point_2> pt_list;
std::copy(points.begin(),points.end(),std::back_inserter(pt_list));
std::cout << "Using list" << std::endl;
bench(CGAL::convex_hull_2,pt_list)
}
}

View File

@ -198,6 +198,8 @@ If the result type is a number type, the prefix is \ccc{Compute_}:
\ccNestedType{Compute_squared_radius_2}{a model of \ccc{Kernel::ComputeSquaredRadius_2}}
\ccGlue
\ccNestedType{Compute_area_2}{a model of \ccc{Kernel::ComputeArea_2}}
\ccGlue
\ccNestedType{Compute_determinant_2}{a model of \ccc{Kernel::ComputeDeterminant_2}}
\ccHeading{Generalized Predicates}
@ -443,6 +445,8 @@ If the result type is a number type, the prefix is \ccc{Compute_}:
\ccGlue
\ccNestedType{Compute_approximate_area_3}{a model of \ccc{Kernel::ComputeApproximateArea_3}}
\ccGlue
\ccNestedType{Compute_determinant_3}{a model of \ccc{Kernel::ComputeDeterminant_3}}
\ccGlue
\ccNestedType{Compute_squared_distance_3}{a model of \ccc{Kernel::ComputeSquaredDistance_3}}
\ccGlue
\ccNestedType{Compute_squared_length_3}{a model of \ccc{Kernel::ComputeSquaredLength_3}}