Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
82e8e4b
Initial version of bounded_error_hausdorff method.
msmathcomp May 21, 2019
04a05c0
Implemented distance computation from mesh_1 vertices to mesh_2 trian…
msmathcomp May 21, 2019
951e4a7
Implement first rough approximation.
msmathcomp May 21, 2019
9df0d3f
Fix initialization of global upper bound, include TODOs for further s…
msmathcomp May 21, 2019
c28f007
Add detailed comments on the code written so far and merge face proce…
msmathcomp Jun 6, 2019
a67fa38
Add traversal trait for Hausdorff-based AABB traversal on the first t…
msmathcomp Jun 9, 2019
04c84ef
Add second traversal trait for Hausdorff-based AABB traversal on the …
msmathcomp Jun 9, 2019
1400662
Fixed initialization of local Hausdorff bounds.
msmathcomp Jun 9, 2019
d93aa73
Pass tm2_tree instance to the traversal of tm1
msmathcomp Jun 18, 2019
a4112c4
Implement calling of TM2_tree traversal.
msmathcomp Jun 18, 2019
c76db1e
Finish traversal traits of tm1, i.e. finish implementation of Culling…
msmathcomp Jun 18, 2019
453ec15
Implement vertex (TM1) to triangle (TM2) distance in traversal proces…
msmathcomp Jun 19, 2019
6221ebe
Finish implementation of Culling on B (i.e. TM2) traversal.
msmathcomp Jun 21, 2019
48e159b
Store candidate triangles in a set to be processed later.
msmathcomp Jun 21, 2019
7ec6c4c
Correct implementation of Culling on second mesh.
msmathcomp Jun 22, 2019
2a52382
Implement a non-trivial toy example to test subdivision with. Intende…
msmathcomp Jun 24, 2019
68e9776
Implement subdivision of a triangle from the candidate set.
msmathcomp Jun 24, 2019
17b0003
Fix typo in vertex lookup.
msmathcomp Jun 24, 2019
3c73230
Finish first working prototype giving correct answer on the toy example.
msmathcomp Jun 24, 2019
d8b6e7d
Results of Code Review with Sebastien.
msmathcomp Jul 12, 2019
519d37d
Use Kernel method instead of computations by hand.
msmathcomp Jul 12, 2019
0332d9f
Enable reading of real meshes and perturbation of them for distance c…
msmathcomp Jul 12, 2019
e78cbff
Implement naive bounded Hausdoff computation by simple subdivision.
msmathcomp Jul 15, 2019
000604f
Comment naive comparison method.
msmathcomp Jul 15, 2019
3134025
Bugfix computation of upper bound, should not go below lower bound.
msmathcomp Jul 15, 2019
30b6c70
Add naive and optimized Hausdorff implementation to test file.
msmathcomp Jul 18, 2019
98e92a9
Introduce an additional stopping criterion to stop in degenerate case…
msmathcomp Jul 18, 2019
130dcbc
Bugfix entering nodes of TM2 when traversing it.
msmathcomp Jul 19, 2019
c91c780
Add timing to the example file and restore all tests in the test file.
msmathcomp Jul 19, 2019
156cac5
Implement benchmarking on both time and number of culled triangles.
msmathcomp Jul 20, 2019
680edc4
Modify triangle bounding box distance to have sharper bounds.
msmathcomp Jul 21, 2019
405cf12
Implement Priority Queue for the set of candidate triangles.
msmathcomp Jul 21, 2019
e7e724e
Include Benchmark examples in the Hausdorff examples file.
msmathcomp Aug 23, 2019
1e37c32
Write first lines of documentation to test linking and inclusion of e…
msmathcomp Aug 23, 2019
ba0a671
Clean up Code.
msmathcomp Aug 23, 2019
68f7fac
update doc to make links working
sloriot Aug 23, 2019
316cae0
Finalize documentation of bounded Hausdorff Distance computation and …
msmathcomp Aug 23, 2019
c5c6ef0
Improve text in documentation.
msmathcomp Aug 24, 2019
5f2069a
Document named parameters.
msmathcomp Aug 24, 2019
677908e
Fix NP usage
MaelRL Aug 30, 2019
6027b2d
Add Traits::intersection_with_priority()
afabri Sep 26, 2019
a4aa6a7
rework expression
sloriot Sep 26, 2019
3e5e721
plug do_intersect_with_priority
sloriot Sep 26, 2019
89094af
use do_intersect correctly as it is still needed
sloriot Sep 26, 2019
6e73f92
fix nb of primitives
sloriot Sep 27, 2019
16e0a47
Fix traversal order, add comment on benchmark results.
msmathcomp Oct 13, 2019
fed345c
Add notes from skype meeting.
msmathcomp Oct 13, 2019
2d4c254
Keep current global bounds in mind when traversing tm2.
msmathcomp Oct 13, 2019
2066152
Merge branch 'martinskrodzki/gsoc2019-PMPHDist-martinskrodzki' into …
sloriot Feb 19, 2021
8abb285
post merge/cgal update fixes
sloriot Feb 19, 2021
5d0d98f
add missing parameter not added in 2d4c254362 ?
sloriot Feb 19, 2021
0d698f1
update header
sloriot Feb 19, 2021
35387df
do not document all overloads
sloriot Feb 19, 2021
6e4b5ea
use new macros
sloriot Feb 19, 2021
f8f3739
fixed warnings
danston Apr 7, 2021
4033bc1
added new tests with test data
danston Apr 7, 2021
841ad3b
fixed bug introduced in 2d4c254
danston Apr 7, 2021
dfd2e15
Merge remote-tracking branch 'maxGimeno/PMP-compare_faces_from_meshes…
danston Apr 7, 2021
3b7931d
added timings test
danston Apr 8, 2021
0333778
added face matching, not finished
danston Apr 8, 2021
ffc8953
caching data
danston Apr 8, 2021
a255f69
matching faces finished, still needs several more tests
danston Apr 8, 2021
410b03b
added z-shaped test
danston Apr 9, 2021
dc9e958
removed some asserts and types, added const, make it compile with epe…
danston Apr 9, 2021
63db510
epeck support, fixed bug with infinity value
danston Apr 9, 2021
4d107b3
using std priority queue instead of boost heap
danston Apr 9, 2021
95f124f
added missing ref
danston Apr 9, 2021
50fc1ca
faster queries for close meshes, now traversal traits initial bounds …
danston Apr 9, 2021
ddb8c6a
fewer candidate triangles for distance > 0
danston Apr 9, 2021
56b77cf
fixed match faces + removed small optimization (not sure about it)
danston Apr 16, 2021
81513fc
face descriptor is now stored in the candidate triangle to remember t…
danston Apr 16, 2021
4ebbaba
added bunny benchmarks versus original paper
danston Apr 19, 2021
a0812c1
added comments with refs to the original paper, checked all the formulas
danston Apr 19, 2021
33d2f10
optimized AABB tree calls
danston Apr 21, 2021
2f5ff51
missing include
danston Apr 21, 2021
9a9c3ed
a few comments in addition to the discussion with Sebastien and Martin
danston Apr 22, 2021
6bf1966
partially fixed issue for match faces + added minimum example for tha…
danston Apr 23, 2021
1b892e0
subdivision tested - it works
danston Apr 23, 2021
f92e24f
now we can return realizing triangles
danston Apr 23, 2021
69c4830
added test for realizing triangles, updated how the bounds are stored…
danston Apr 26, 2021
4cf4e2c
return a pair of realizing triangles, still to be discussed
danston Apr 26, 2021
7b8deff
Merge remote-tracking branch 'maxGimeno/PMP-compare_faces_from_meshes…
danston Apr 26, 2021
d5e1c1f
shorter bunny test
danston Apr 26, 2021
5e99e80
refined and debugged aabb tree with priority traversal
danston Apr 26, 2021
95ab1a5
tests moved to the test folder
danston Apr 27, 2021
930d364
face to triangle map made global
danston Apr 27, 2021
860cad6
added tighter bounds, changed std min/max to CGAL one, added missing …
danston Apr 27, 2021
85f88c2
added inexact check with distances + more precise realizing triangles
danston Apr 27, 2021
a2f460c
Merge branch 'master' into gsoc2019-PMPHDist-martinskrodzki
danston Apr 27, 2021
1a9a821
add a way to get a direct access to primitive in a box when below a g…
sloriot Apr 27, 2021
c3e5294
add extra function for group traversal
sloriot Apr 27, 2021
87174f3
remove useless check (go further is updated with primitives not bbox)
sloriot Apr 28, 2021
4ce1370
tested group traversal, its sequential version is slower due to more …
danston Apr 28, 2021
b45de72
tested bbox comparisons but I do not think we can use them so they ar…
danston Apr 28, 2021
5c3ae06
group traversal should be called only on TM2
danston Apr 28, 2021
4db22ca
removed internal test code that did not prove to be useful
danston Apr 28, 2021
1f11446
removed return with realizing triangles + added naive version of symm…
danston Apr 28, 2021
93855b1
Merge PMP-compare_faces_from_meshes-maxGimeno into gsoc2019-PMPHDist-…
sloriot Apr 29, 2021
d4e7879
make the code work with different input mesh types
sloriot Apr 29, 2021
e24c6bd
rename variables to make it clear from which mesh the faces are from
sloriot Apr 29, 2021
7fd291c
added input-dependent infinity value + assertions
danston Apr 29, 2021
fbffcff
Merge 'PMP-compare_faces_from_meshes-maxGimeno' into gsoc2019-PMPHDis…
sloriot Apr 29, 2021
5fe5bb0
Update Polygon_mesh_processing/examples/Polygon_mesh_processing/hausd…
danston Apr 30, 2021
5d77b22
changed sqrt to approximate sqrt
danston Apr 30, 2021
c78c4d2
all preprocessing steps are moved to their own function
danston Apr 30, 2021
9afa43d
propagate lower bound for culling on TM1 to accelerate symmetric dist…
danston Apr 30, 2021
f158e3e
added symmetric distance, it is approx 2 times faster than naive version
danston Apr 30, 2021
482bc45
added test for parallel version + METIS partition of tm1 and partiall…
danston Apr 30, 2021
887a715
added naive parallel version
danston May 3, 2021
bafc127
cout a few more timings for parallel version
danston May 3, 2021
b312012
cleanup
danston May 3, 2021
74f5d8a
added one-sided parallel hausdorff distance, still with the seg fault
danston May 3, 2021
27cc885
fixed parallel preprocessing, computation is still buggy
danston May 4, 2021
9117c7e
fixed bug with parallel computation, now works
danston May 4, 2021
e3c693c
optimized one-sided parallel version
danston May 4, 2021
7d0ae6b
testing bunny dense
danston May 4, 2021
fb85383
corrected includes
danston May 5, 2021
3c0fc28
more optimizations, using boost any and factoring out kd tree, adding…
danston May 5, 2021
13ef434
fixing build errors when tbb and/or metis is unavailable
danston May 5, 2021
c4e23b5
tested with different concurrency tags, cleanup, added empty test for…
danston May 5, 2021
00f4a52
missing header
sloriot May 6, 2021
04f556f
Merge remote-tracking branch 'sloriot/gsoc2019-PMPHDist-martinskrodzk…
danston May 9, 2021
dbfca54
hide the parallel version behind ifdefs
danston May 9, 2021
80c776c
added functions are_within_tolerance, not finished, fixing max funcs …
danston May 9, 2021
77c2dc4
testing early quit
danston May 10, 2021
559815e
added more assertions
danston May 11, 2021
acce02a
do not build if inf value < 0 and added distance_bound, not finished
danston May 11, 2021
73e9e86
added early quit option to accelerate distance vs user defined distan…
danston May 11, 2021
5686252
is_further_than function finished
danston May 11, 2021
6ae21a4
added visitor to save pairs of realizing triangles
danston May 11, 2021
859bae9
sebastien review
danston Jun 18, 2021
aaf55db
Merge remote-tracking branch 'maxGimeno/PMP-compare_faces_from_meshes…
danston Jun 18, 2021
ad6a718
added missing IO ns
danston Jun 18, 2021
d37eb48
using new OFF reader from IO
danston Jun 18, 2021
610f375
backticked tms
danston Jun 18, 2021
cd02254
missing article
danston Jun 18, 2021
76dc3a0
tree -> BVH
sloriot Jun 25, 2021
95cc999
fixed typo
danston Jun 25, 2021
18e6b8f
Merge remote-tracking branch 'sloriot/gsoc2019-PMPHDist-martinskrodzk…
danston Jun 25, 2021
7f19456
better explained concurrency tag
danston Jun 29, 2021
73581e1
added named param for choosing between one sided and symmetric dist i…
danston Jun 29, 2021
d778263
fixed ref to the bounded error distance function
danston Jun 29, 2021
dcd8fe8
added missing user docs for is_hausdorff_larger and symmetric distanc…
danston Jun 29, 2021
cb9747b
updated changes.md
danston Jul 1, 2021
6bd71a3
fix test
sloriot Jul 20, 2021
7fbec6f
do not test the paper bench
sloriot Jul 20, 2021
d8a375b
generate the refine version of blobby
sloriot Jul 20, 2021
61ab2c1
fix conversion warning
sloriot Jul 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions AABB_tree/include/CGAL/AABB_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,36 @@ namespace CGAL {
}
}

template <class Query, class Traversal_traits>
void traversal_with_priority(const Query& query, Traversal_traits& traits) const
{
switch(size())
{
case 0:
break;
case 1:
traits.intersection(query, singleton_data());
break;
default: // if(size() >= 2)
root_node()->template traversal_with_priority<Traversal_traits,Query>(query, traits, m_primitives.size());
}
}

template <class Query, class Traversal_traits>
void traversal_with_priority_and_group_traversal(const Query& query, Traversal_traits& traits, const std::size_t group_traversal_bound) const
{
switch(size())
{
case 0:
break;
case 1:
traits.intersection(query, singleton_data());
break;
default: // if(size() >= 2)
root_node()->template traversal_with_priority_and_group_traversal(m_primitives, query, traits, m_primitives.size(), 0, group_traversal_bound);
}
}

private:
typedef AABB_node<AABBTraits> Node;

Expand Down
164 changes: 164 additions & 0 deletions AABB_tree/include/CGAL/internal/AABB_tree/AABB_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ class AABB_node
Traversal_traits& traits,
const std::size_t nb_primitives) const;

template<class Traversal_traits, class Query>
void traversal_with_priority(const Query& query,
Traversal_traits& traits,
const std::size_t nb_primitives) const;

template<class Primitive_vector, class Traversal_traits, class Query>
void traversal_with_priority_and_group_traversal(const Primitive_vector& primitives,
const Query& query,
Traversal_traits& traits,
const std::size_t nb_primitives,
std::size_t first_primitive_index,
const std::size_t group_size_bound) const;


private:
typedef AABBTraits AABB_traits;
typedef AABB_node<AABB_traits> Node;
Expand Down Expand Up @@ -152,6 +166,156 @@ AABB_node<Tr>::traversal(const Query& query,
}
}

template<typename Tr>
template<class Traversal_traits, class Query>
void
AABB_node<Tr>::traversal_with_priority(const Query& query,
Traversal_traits& traits,
const std::size_t nb_primitives) const
{
// Recursive traversal
switch(nb_primitives)
{
case 2:
traits.intersection(query, left_data());
if( traits.go_further() )
{
traits.intersection(query, right_data());
}
break;
case 3:
traits.intersection(query, left_data());
if( traits.go_further() && traits.do_intersect(query, right_child()) )
{
right_child().traversal_with_priority(query, traits, 2);
}
break;
default:
bool ileft, iright;
typename Traversal_traits::Priority pleft, pright;
std::tie(ileft, pleft) = traits.do_intersect_with_priority(query, left_child());
std::tie(iright, pright) = traits.do_intersect_with_priority(query, right_child());
CGAL_precondition( (ileft || iright) ? traits.do_intersect(query, *this) : true );

if(ileft)
{
if(iright)
{
// Both children have to be inspected.
if(pleft >= pright)
{
// Inspect the left child first, has higher priority.
left_child().traversal_with_priority(query, traits, nb_primitives/2);
if( traits.go_further() )
right_child().traversal_with_priority(query, traits, nb_primitives-nb_primitives/2);
}
else
{
// Inspect the right child first, has higher priority.
right_child().traversal_with_priority(query, traits, nb_primitives-nb_primitives/2);
if( traits.go_further() )
left_child().traversal_with_priority(query, traits, nb_primitives/2);
}
}
else
{
// Only the left child has to be inspected.
left_child().traversal_with_priority(query, traits, nb_primitives/2);
}
}
else
{
if(iright)
{
// Only the right child has to be inspected.
right_child().traversal_with_priority(query, traits, nb_primitives-nb_primitives/2);
}
}
}
}

// TODO: find a better name
template<typename Tr>
template<class Primitive_vector, class Traversal_traits, class Query>
void
AABB_node<Tr>::traversal_with_priority_and_group_traversal(const Primitive_vector& primitives,
const Query& query,
Traversal_traits& traits,
const std::size_t nb_primitives,
std::size_t first_primitive_index,
const std::size_t group_traversal_bound) const
{
// Group traversal
CGAL_assertion(group_traversal_bound >= 2);
if ( nb_primitives <= group_traversal_bound )
{
if ( !traits.do_intersect(query, *this) ) return;
CGAL_assertion(traits.do_intersect(query, *this));
traits.traverse_group(query, primitives.begin()+first_primitive_index, primitives.begin()+first_primitive_index+nb_primitives);
return;
}

// Recursive traversal
switch(nb_primitives)
{
case 2:
traits.intersection(query, left_data());
if( traits.go_further() )
{
traits.intersection(query, right_data());
}
break;
case 3:
traits.intersection(query, left_data());
if( traits.go_further() && traits.do_intersect(query, right_child()) )
{
right_child().traversal_with_priority_and_group_traversal(primitives, query, traits, 2, first_primitive_index+1, group_traversal_bound);
}
break;
default:
bool ileft, iright;
typename Traversal_traits::Priority pleft, pright;
std::tie(ileft, pleft) = traits.do_intersect_with_priority(query, left_child());
std::tie(iright, pright) = traits.do_intersect_with_priority(query, right_child());
CGAL_precondition( (ileft || iright) ? traits.do_intersect(query, *this) : true );

if(ileft)
{
if(iright)
{
// Both children have to be inspected.
if(pleft >= pright)
{
// Inspect the left child first, has higher priority.
left_child().traversal_with_priority_and_group_traversal(primitives, query, traits, nb_primitives/2, first_primitive_index, group_traversal_bound);
if( traits.go_further() )
right_child().traversal_with_priority_and_group_traversal(primitives, query, traits, nb_primitives-nb_primitives/2, first_primitive_index+nb_primitives/2, group_traversal_bound);
}
else
{
// Inspect the right child first, has higher priority.
right_child().traversal_with_priority_and_group_traversal(primitives, query, traits, nb_primitives-nb_primitives/2, first_primitive_index+nb_primitives/2, group_traversal_bound);
if( traits.go_further() )
left_child().traversal_with_priority_and_group_traversal(primitives, query, traits, nb_primitives/2, first_primitive_index, group_traversal_bound);
}
}
else
{
// Only the left child has to be inspected.
left_child().traversal_with_priority_and_group_traversal(primitives, query, traits, nb_primitives/2, first_primitive_index, group_traversal_bound);
}
}
else
{
if(iright)
{
// Only the right child has to be inspected.
right_child().traversal_with_priority_and_group_traversal(primitives, query, traits, nb_primitives-nb_primitives/2, first_primitive_index+nb_primitives/2, group_traversal_bound);
}
}
}
}

} // end namespace CGAL

#endif // CGAL_AABB_NODE_H
2 changes: 2 additions & 0 deletions BGL/include/CGAL/boost/graph/parameters_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ CGAL_add_named_parameter(do_not_modify_t, do_not_modify, do_not_modify)
CGAL_add_named_parameter(allow_self_intersections_t, allow_self_intersections, allow_self_intersections)
CGAL_add_named_parameter(non_manifold_feature_map_t, non_manifold_feature_map, non_manifold_feature_map)
CGAL_add_named_parameter(polyhedral_envelope_epsilon_t, polyhedral_envelope_epsilon, polyhedral_envelope_epsilon)
CGAL_add_named_parameter(match_faces_t, match_faces, match_faces)
CGAL_add_named_parameter(face_epsilon_map_t, face_epsilon_map, face_epsilon_map)
CGAL_add_named_parameter(use_one_sided_hausdorff_t, use_one_sided_hausdorff, use_one_sided_hausdorff)

// List of named parameters that we use in the package 'Surface Mesh Simplification'
CGAL_add_named_parameter(get_cost_policy_t, get_cost_policy, get_cost)
Expand Down
10 changes: 10 additions & 0 deletions Documentation/doc/biblio/geom.bib
Original file line number Diff line number Diff line change
Expand Up @@ -152050,4 +152050,14 @@ @article{cvl-ew-12
Pages = {215--224},
Year = {2012},
Url = {http://monge.univ-mlv.fr/~colinde/pub/09edgewidth.pdf}

@inproceedings{tang2009interactive,
title={Interactive Hausdorff distance computation for general polygonal models},
author={Tang, Min and Lee, Minkyoung and Kim, Young J},
booktitle={ACM Transactions on Graphics (TOG)},
volume={28},
number={3},
pages={74},
year={2009},
organization={ACM}
}
12 changes: 11 additions & 1 deletion Installation/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ Release date: December 2021

### [Polygon Mesh Processing](https://doc.cgal.org/5.4/Manual/packages.html#PkgPolygonMeshProcessing)

- Added the function `CGAL::Polygon_mesh_processing::match_faces()`, which, given two polygon meshes, identifies their common faces as well as as faces present in only either of them.
- Added the function `CGAL::Polygon_mesh_processing::match_faces()`, which, given two polygon meshes,
identifies their common faces as well as faces present in only either of them.

- Added the functions: `CGAL::Polygon_mesh_processing::bounded_error_Hausdorff_distance()` that
computes an estimate of the one-sided Hausdorff distance between two triangle meshes which
is bounded by a user-specified error bound; `CGAL::Polygon_mesh_processing::bounded_error_symmetric_Hausdorff_distance()` that computes
an estimate of the symmetric Hausdorff distance bounded by a user-specified error bound;
and `CGAL::Polygon_mesh_processing::is_Hausdorff_distance_larger()` that returns `true`
if the bounded-error Hausdorff distance between two meshes is larger than the user-specified
max distance.


[Release 5.3](https://github.com/CGAL/cgal/releases/tag/v5.3)
-----------
Expand Down
1 change: 1 addition & 0 deletions Installation/cmake/modules/CGAL_METIS_support.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
if(METIS_FOUND AND NOT TARGET CGAL::METIS_support)
add_library(CGAL::METIS_support INTERFACE IMPORTED)
set_target_properties(CGAL::METIS_support PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "CGAL_METIS_ENABLED"
INTERFACE_INCLUDE_DIRECTORIES "${METIS_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${METIS_LIBRARIES}")
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ The page \ref bgl_namedparameters "Named Parameters" describes their usage.
- \link measure_grp `CGAL::Polygon_mesh_processing::match_faces()` \endlink

\cgalCRPSection{Distance Functions}
- `CGAL::Polygon_mesh_processing::bounded_error_Hausdorff_distance()`
- `CGAL::Polygon_mesh_processing::bounded_error_symmetric_Hausdorff_distance()`
- `CGAL::Polygon_mesh_processing::is_Hausdorff_distance_larger()`
- `CGAL::Polygon_mesh_processing::approximate_Hausdorff_distance()`
- `CGAL::Polygon_mesh_processing::approximate_symmetric_Hausdorff_distance()`
- `CGAL::Polygon_mesh_processing::approximate_max_distance_to_point_set()`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -910,10 +910,12 @@ which enables to treat one or several connected components as a face graph.

\cgalExample{Polygon_mesh_processing/face_filtered_graph_example.cpp}

\section PMPDistance Approximate Hausdorff Distance
\section PMPDistance Hausdorff Distance

This package provides methods to compute (approximate) distances between meshes and point sets.

\subsection ApproxHD Approximate Hausdorff Distance

The function \link approximate_Hausdorff_distance() `approximate_Hausdorff_distance()`\endlink
computes an approximation of the Hausdorff distance from a mesh `tm1` to a mesh `tm2`. Given a
a sampling of `tm1`, it computes the distance to `tm2` of the farthest sample point to `tm2` \cgalCite{cignoni1998metro}.
Expand All @@ -938,12 +940,12 @@ computes an approximation of the Hausdorff distance from a mesh to a point set.
For each triangle, a lower and upper bound of the Hausdorff distance to the point set are computed.
Triangles are refined until the difference between the bounds is lower than a user-defined precision threshold.

\subsection AHDExample Approximate Hausdorff Distance Example
\subsubsection AHDExample Approximate Hausdorff Distance Example
In the following example, a mesh is isotropically remeshed and the approximate distance between the input and the output is computed.

\cgalExample{Polygon_mesh_processing/hausdorff_distance_remeshing_example.cpp}

\subsection PoissonDistanceExample Max Distance Between Point Set and Surface Example
\subsubsection PoissonDistanceExample Max Distance Between Point Set and Surface Example
In \ref Poisson_surface_reconstruction_3/poisson_reconstruction_example.cpp,
a triangulated surface mesh is constructed from a point set using the
\link PkgPoissonSurfaceReconstruction3 Poisson reconstruction algorithm \endlink,
Expand All @@ -952,6 +954,50 @@ with the following code:

\snippet Poisson_surface_reconstruction_3/poisson_reconstruction_example.cpp PMP_distance_snippet

\subsection BoundedHD Bounded Hausdorff Distance

The function `CGAL::Polygon_mesh_processing::bounded_error_Hausdorff_distance()`
computes an estimate of the Hausdorff distance of two triangle meshes which is
bounded by a user-given error bound. Given two meshes `tm1` and `tm2`, it follows
the procedure given by \cgalCite{tang2009interactive}. Namely, a bounded volume hierarchy (BVH) is
built on `tm1` and `tm2` respectively. The BVH on `tm1` is used to iterate over all
triangles in `tm1`. Throughout the traversal, the procedure keeps track of a global
lower and upper bound on the Hausdorff distance respectively. For each triangle
`t` in `tm1`, by traversing the BVH on `tm2`, it is estimated via the global bounds
whether `t` can still contribute to the actual Hausdorff distance. From this
process, a set of candidate triangles is selected.

The candidate triangles are subsequently subdivided and for each smaller
triangle, the BVH on `tm2` is traversed again. This is repeated until the
triangle is smaller than the user-given error bound, all vertices of the
triangle are projected onto the same triangle in `tm2`, or the triangle's upper
bound is lower than the global lower bound. After creation, the subdivided
triangles are added to the list of candidate triangles. Thereby, all candidate
triangles are processed until a triangle is found in which the Hausdorff
distance is realized or in which it is guaranteed to be realized within the
user-given error bound.

In the current implementation, the BVH used is an AABB-tree and not the swept sphere
volumes as used in the original implementation. This should explain the runtime difference
observed with the original implementation.

The function `CGAL::Polygon_mesh_processing::bounded_error_Hausdorff_distance()` computes
the one-sided Hausdorff distance from `tm1` to `tm2`. This component also provides
the symmetric distance `CGAL::Polygon_mesh_processing::bounded_error_symmetric_Hausdorff_distance()`
and an utility function called `CGAL::Polygon_mesh_processing::is_Hausdorff_distance_larger()`
that returns `true` if the Hausdorff distance between two meshes is larger than the user-defined max distance.

\subsubsection BHDExample Bounded Hausdorff Distance Example

In the following examples: (a) the distance of a tetrahedron to a remeshed
version of itself is computed, (b) the distance of two geometries is computed
which is realized strictly in the interior of a triangle of the first geometry,
(c) a perturbation of a user-given mesh is compared to the original user-given
mesh, (d) two user-given meshes are compared, where the second mesh is gradually
moved away from the first one.

\cgalExample{Polygon_mesh_processing/hausdorff_bounded_error_distance_example.cpp}

\section PMPDetectFeatures Feature Detection

This package provides methods to detect some features of a polygon mesh.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@
\example Polygon_mesh_processing/locate_example.cpp
\example Polygon_mesh_processing/orientation_pipeline_example.cpp
\example Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp
\example Polygon_mesh_processing/hausdorff_bounded_error_distance_example.cpp
*/
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ include(CGAL_Eigen3_support)
# ##########################################################

create_single_source_cgal_program("hausdorff_distance_remeshing_example.cpp")
create_single_source_cgal_program( "hausdorff_bounded_error_distance_example.cpp")

if(TARGET CGAL::Eigen3_support)
create_single_source_cgal_program("hole_filling_example.cpp")
Expand Down Expand Up @@ -122,12 +123,23 @@ if(OpenMesh_FOUND)
PRIVATE ${OPENMESH_LIBRARIES})
endif(OpenMesh_FOUND)

find_package(METIS)
include(CGAL_METIS_support)
if(TARGET CGAL::METIS_support)
target_link_libraries(hausdorff_bounded_error_distance_example PUBLIC CGAL::METIS_support)
else()
message(STATUS "Tests, which use the METIS library will not be compiled.")
endif()

find_package(TBB)
include(CGAL_TBB_support)
if(TARGET CGAL::TBB_support)
target_link_libraries(self_intersections_example PUBLIC CGAL::TBB_support)
target_link_libraries(hausdorff_distance_remeshing_example
PUBLIC CGAL::TBB_support)
target_link_libraries(hausdorff_bounded_error_distance_example
PUBLIC CGAL::TBB_support)


create_single_source_cgal_program("corefinement_parallel_union_meshes.cpp")
target_link_libraries(corefinement_parallel_union_meshes PUBLIC CGAL::TBB_support)
Expand Down
Loading