AABB: fix clear_and_insert

remove lucy model (too big)
This commit is contained in:
Pierre Alliez 2009-04-28 20:04:23 +00:00
parent ea22d039c5
commit b96d8c442c
4 changed files with 20 additions and 150007 deletions

1
.gitattributes vendored
View File

@ -34,7 +34,6 @@ AABB_tree/test/AABB_tree/aabb_projection_triangle_test.cpp -text
AABB_tree/test/AABB_tree/cleanup.bat -text
AABB_tree/test/AABB_tree/data/coverrear.off -text
AABB_tree/test/AABB_tree/data/cube.off -text
AABB_tree/test/AABB_tree/data/lucy.off -text
AABB_tree/test/AABB_tree/data/nested_spheres.off -text
AABB_tree/test/AABB_tree/todo.txt -text
Algebraic_foundations/doc_tex/Algebraic_foundations/Algebraic_foundations.png -text

View File

@ -328,8 +328,14 @@ namespace CGAL {
}
m_p_root = new Node[m_data.size()-1]();
CGAL_assertion(m_p_root != NULL);
m_p_root->expand(m_data.begin(), m_data.end(), m_data.size());
if(m_p_root == NULL)
{
std::cerr << "Unable to allocate memory for AABB tree" << std::endl;
CGAL_assertion(m_p_root != NULL);
m_data.clear();
}
else
m_p_root->expand(m_data.begin(), m_data.end(), m_data.size());
}
// Clears tree and insert a set of primitives
@ -341,14 +347,6 @@ namespace CGAL {
{
clear();
// allocate memory
m_p_root = new Node[m_data.size()-1]();
if(m_p_root == NULL)
{
std::cerr << "Unable to allocate memory for AABB tree" << std::cerr;
return false;
}
// inserts primitives
while(first != beyond)
{
@ -358,10 +356,15 @@ namespace CGAL {
// allocates tree nodes
m_p_root = new Node[m_data.size()-1]();
if(m_p_root == NULL)
{
std::cerr << "Unable to allocate memory for AABB tree" << std::endl;
m_data.clear();
return false;
}
// constructs the tree
m_p_root->expand(m_data.begin(), m_data.end(), m_data.size());
return true;
}

View File

@ -193,12 +193,12 @@ void test(const char *filename)
typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
// load (triangle) polyhedral surface
// loads triangle polyhedral surface
Polyhedron polyhedron;
std::ifstream ifs(filename);
ifs >> polyhedron;
// construct tree (without internal KD-tree as we do not query any projection).
// constructs tree
std::cout << "construct tree...";
CGAL::Timer timer;
timer.start();
@ -206,7 +206,10 @@ void test(const char *filename)
timer.stop();
std::cout << "done (" << timer.time() << " s)" << std::endl;
// call tests
// tests clear and rebuilds
tree.clear_and_insert(polyhedron.facets_begin(),polyhedron.facets_end());
// calls all tests
test_all_query_types<Tree,K>(tree);
test_speed<Tree,K>(tree);
}
@ -244,6 +247,5 @@ int main(void)
test_several_kernels("./data/cube.off");
test_several_kernels("./data/coverrear.off");
test_several_kernels("./data/nested_spheres.off");
test_several_kernels("./data/lucy.off");
return 0;
}

File diff suppressed because it is too large Load Diff