AABB tree: fixes on tests

This commit is contained in:
Pierre Alliez 2009-05-25 07:57:24 +00:00
parent 4fb38dd560
commit af2ffa9abd
4 changed files with 19 additions and 16 deletions

View File

@ -147,7 +147,8 @@ void test_all_distance_query_types(Tree& tree)
template <class Tree, class K> template <class Tree, class K>
void test_distance_speed(Tree& tree) void test_distance_speed(Tree& tree,
const double duration)
{ {
typedef typename K::FT FT; typedef typename K::FT FT;
typedef typename K::Ray_3 Ray; typedef typename K::Ray_3 Ray;
@ -157,7 +158,7 @@ void test_distance_speed(Tree& tree)
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
unsigned int nb = 0; unsigned int nb = 0;
while(timer.time() < 1.0) while(timer.time() < duration)
{ {
// picks a random point in the tree bbox // picks a random point in the tree bbox
Point query = random_point_in<K>(tree.bbox()); Point query = random_point_in<K>(tree.bbox());
@ -220,7 +221,7 @@ struct Primitive_generator<TRIANGLE, K, Polyhedron>
* Declaration only, implementation should be given in .cpp file * Declaration only, implementation should be given in .cpp file
*/ */
template<class K, class Tree, class Polyhedron> template<class K, class Tree, class Polyhedron>
void test_impl(Tree& tree, Polyhedron& p); void test_impl(Tree& tree, Polyhedron& p, const double duration);
/** /**

View File

@ -41,18 +41,19 @@
template<class K, class Tree, class Polyhedron> template<class K, class Tree, class Polyhedron>
void test_impl(Tree& tree, Polyhedron&) void test_impl(Tree& tree, Polyhedron&, const double duration)
{ {
test_distance_speed<Tree,K>(tree); test_distance_speed<Tree,K>(tree,duration);
test_all_distance_query_types<Tree,K>(tree); test_all_distance_query_types<Tree,K>(tree);
} }
int main(void) int main(void)
{ {
std::cout << "AABB distance tests" << std::endl; std::cout << "AABB distance tests" << std::endl;
test_kernels<SEGMENT>("./data/cube.off"); const double duration = 0.2;
test_kernels<SEGMENT>("./data/coverrear.off"); test_kernels<SEGMENT>("./data/cube.off",duration);
test_kernels<SEGMENT>("./data/nested_spheres.off"); test_kernels<SEGMENT>("./data/coverrear.off",duration);
test_kernels<SEGMENT>("./data/finger.off"); test_kernels<SEGMENT>("./data/nested_spheres.off",duration);
test_kernels<SEGMENT>("./data/finger.off",duration);
return 0; return 0;
} }

View File

@ -38,18 +38,19 @@
template<class K, class Tree, class Polyhedron> template<class K, class Tree, class Polyhedron>
void test_impl(Tree& tree, Polyhedron&) void test_impl(Tree& tree, Polyhedron&,const double duration)
{ {
test_distance_speed<Tree,K>(tree); test_distance_speed<Tree,K>(tree,duration);
test_all_distance_query_types<Tree,K>(tree); test_all_distance_query_types<Tree,K>(tree);
} }
int main(void) int main(void)
{ {
std::cout << "AABB distance tests" << std::endl; std::cout << "AABB distance tests" << std::endl;
test_kernels<TRIANGLE>("./data/cube.off"); const double duration = 0.2;
test_kernels<TRIANGLE>("./data/coverrear.off"); test_kernels<TRIANGLE>("./data/cube.off",duration);
test_kernels<TRIANGLE>("./data/nested_spheres.off"); test_kernels<TRIANGLE>("./data/coverrear.off",duration);
test_kernels<TRIANGLE>("./data/finger.off"); test_kernels<TRIANGLE>("./data/nested_spheres.off",duration);
test_kernels<TRIANGLE>("./data/finger.off",duration);
return 0; return 0;
} }

View File

@ -135,7 +135,7 @@ int main()
if(filename.find(".off") != std::string::npos) if(filename.find(".off") != std::string::npos)
{ {
test_kernels<TRIANGLE>(filename.data(),duration); test_kernels<TRIANGLE>(filename.data(),duration);
std::cout << filename; // dir.leaf() std::cout << filename;
} }
} }