From 9772610e5f99c82bd0eae80ec4412f2ef56d728c Mon Sep 17 00:00:00 2001 From: Pierre Alliez Date: Sun, 5 Jul 2009 13:58:00 +0000 Subject: [PATCH] AABB tree: benchmark across kernels and updated intersection tests (more accurate). need to fix compilation issue with EPIC kernel (I guess one include missing) --- AABB_tree/demo/AABB_tree/Scene.cpp | 3 +- AABB_tree/demo/AABB_tree/types.h | 11 +++++-- AABB_tree/doc_tex/AABB_tree/performances.tex | 30 ++++++++++++++----- AABB_tree/dont_submit | 2 +- .../Triangle_3_segment_3_intersection.h | 2 +- 5 files changed, 36 insertions(+), 12 deletions(-) diff --git a/AABB_tree/demo/AABB_tree/Scene.cpp b/AABB_tree/demo/AABB_tree/Scene.cpp index 34f9aa91990..c5ff96a5ad0 100644 --- a/AABB_tree/demo/AABB_tree/Scene.cpp +++ b/AABB_tree/demo/AABB_tree/Scene.cpp @@ -93,7 +93,8 @@ void Scene::update_bbox() m_bbox = (*it).bbox(); for(; it != m_pPolyhedron->points_end();it++) m_bbox = m_bbox + (*it).bbox(); - std::cout << "done." << std::endl; + std::cout << "done (" << m_pPolyhedron->size_of_facets() + << " facets)" << std::endl; } void Scene::draw() diff --git a/AABB_tree/demo/AABB_tree/types.h b/AABB_tree/demo/AABB_tree/types.h index 4b4f43f6df6..461611d7387 100644 --- a/AABB_tree/demo/AABB_tree/types.h +++ b/AABB_tree/demo/AABB_tree/types.h @@ -1,10 +1,15 @@ #ifndef AABB_DEMO_TYPES_H #define AABB_DEMO_TYPES_H -#include +#include +//#include +//#include #include -typedef CGAL::Simple_cartesian Kernel; +typedef CGAL::Simple_cartesian Kernel; // fastest in experiments +//typedef CGAL::Cartesian Kernel; +//typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; + typedef Kernel::FT FT; typedef Kernel::Ray_3 Ray; typedef Kernel::Line_3 Line; @@ -13,6 +18,8 @@ typedef Kernel::Plane_3 Plane; typedef Kernel::Vector_3 Vector; typedef Kernel::Segment_3 Segment; typedef Kernel::Triangle_3 Triangle; + +#include typedef CGAL::Polyhedron_3 Polyhedron; #endif // AABB_DEMO_TYPES_H diff --git a/AABB_tree/doc_tex/AABB_tree/performances.tex b/AABB_tree/doc_tex/AABB_tree/performances.tex index 1c41cc43297..3e78f16355d 100644 --- a/AABB_tree/doc_tex/AABB_tree/performances.tex +++ b/AABB_tree/doc_tex/AABB_tree/performances.tex @@ -18,17 +18,17 @@ The surface triangle mesh chosen for benchmarking intersections is the knot mode \hline \end{tabular} -The following table measures the number of intersection queries per second on the 14,400 triangle version of the knot mesh model for ray, line, segment and plane queries. Each ray query is generated by choosing a random source point within the bounding box of the mesh and a random vector. A line or segment query is generated by choosing two random points within the bounding box. A plane query is generated by picking a random point within the bounding box and a random normal vector. Note that a plane query generally intersects many triangles of the input surface mesh. This explains the low performance numbers for the intersection functions which enumerate all intersections. +The following table measures the number of intersection queries per second on the 14,400 triangle version of the knot mesh model for ray, line, segment and plane queries. Each ray query is generated by choosing a random source point within the mesh bounding box and a random vector. A line or segment query is generated by choosing two random points inside the bounding box. A plane query is generated by picking a random point inside the bounding box and a random normal vector. Note that a plane query generally intersects many triangles of the input surface mesh. This explains the low performance numbers for the intersection functions which enumerate all intersections. \begin{tabular}{|l|r|r|r|r|} \hline - Function & Ray & Line & Segment & Plane \\ + Function & Segment & Ray & Line & Plane \\ \hline - do\_intersect() & 164,182 & 171,862 & 177,007 & 217,287 \\ - number\_of\_intersected\_primitives() & 89,075 & 90,334 & 104,475 & 10,248 \\ - any\_intersection() & 163,657 & 169,989 & 183,011 & 220,203 \\ - all\_intersections() & 62,625 & 60,168 & 73,525 & 3,026 \\ - all\_intersected\_primitives() & 83,992 & 85,347 & 97,258 & 6,273 \\ + do\_intersect() & 142,806 & 140,309 & 152,327 & 231,066 \\ + number\_of\_intersected\_primitives() & 144,272 & 141,992 & 153,140 & 230,133 \\ + any\_intersection() & 147,468 & 143,230 & 148,235 & 229,336 \\ + all\_intersections() & 46,507 & 38,471 & 36,374 & 2,644 \\ + all\_intersected\_primitives() & 65,553 & 54,838 & 53,183 & 5,693 \\ \hline \end{tabular} @@ -52,6 +52,22 @@ Curve \ref{fig:AABB-tree-bench} plots the number of queries per second (here the \end{figure} \end{center} +The following table measures the number of \ccc{all_intersections() queries per second on the 14,400 triangle version of the knot mesh model for random segment queries. The \ccc{Simple_cartesian} kernel is substantially faster than the \ccc{Cartesian} kernel. + + +\begin{tabular}{|l|c|} + \hline + Kernel & #queries/s (all\_intersections() with segment queries)\\ + \hline +\ccc{Simple_cartesian} & 46,507 \\ +\ccc{Simple_cartesian} & 43,187 \\ +\ccc{Cartesian} & 5,335 \\ +\ccc{Cartesian} & 5,522 \\ +\ccc{Exact_predicates_inexact_constructions} & xxxx \\ + \hline +\end{tabular} + + \subsection{Distances} The surface triangle mesh chosen for benchmarking distances is again the knot model in four increasing resolutions obtained through Loop subdivision. In the following table we first measure the tree construction time which includes the construction of the internal KD-tree data structure to accelerate the distance queries (note how the internal KD-tree construction is negligible compared to the AABB tree construction, while it brings an acceleration of up to one order of magnitude). We then measure the number of queries per second for the three types distance queries (\ccc{closest_point}, \ccc{squared_distance} and \ccc{closest_point_and_primitive}) from point queries randomly chosen inside the bounding box. diff --git a/AABB_tree/dont_submit b/AABB_tree/dont_submit index b8369a3fa1c..5db3d720edb 100644 --- a/AABB_tree/dont_submit +++ b/AABB_tree/dont_submit @@ -1,3 +1,3 @@ cleanup.bat anchor.ppt -teaser.ppt \ No newline at end of file +teaser.ppt diff --git a/AABB_tree/include/CGAL/AABB_intersections/Triangle_3_segment_3_intersection.h b/AABB_tree/include/CGAL/AABB_intersections/Triangle_3_segment_3_intersection.h index 18a90c74feb..d1516bee936 100644 --- a/AABB_tree/include/CGAL/AABB_intersections/Triangle_3_segment_3_intersection.h +++ b/AABB_tree/include/CGAL/AABB_intersections/Triangle_3_segment_3_intersection.h @@ -89,7 +89,7 @@ intersection_triangle_segment_aux(const typename K::Segment_3 &s1, return make_object(make_segment(q1,q2)); } - return Object(); // PA: careful, this code is unreachable + // return Object(); // unreachable }