mirror of https://github.com/CGAL/cgal
rename all the function consistently
This commit is contained in:
parent
2f1bf6fcd3
commit
7ce41550b3
|
|
@ -35,7 +35,7 @@ double compute_and_time_sdf(const Polyhedron& mesh, Facet_with_id_pmap<double, P
|
||||||
{
|
{
|
||||||
CGAL::Timer timer;
|
CGAL::Timer timer;
|
||||||
timer.start();
|
timer.start();
|
||||||
std::pair<double, double> min_max_sdf = CGAL::compute_sdf_values(mesh, sdf_values);
|
std::pair<double, double> min_max_sdf = CGAL::sdf_values(mesh, sdf_values);
|
||||||
timer.stop();
|
timer.stop();
|
||||||
std::cout << " minimum SDF: " << min_max_sdf.first << " maximum SDF: " << min_max_sdf.second << std::endl;
|
std::cout << " minimum SDF: " << min_max_sdf.first << " maximum SDF: " << min_max_sdf.second << std::endl;
|
||||||
std::cout << " SDF Time: " << timer.time() << std::endl;
|
std::cout << " SDF Time: " << timer.time() << std::endl;
|
||||||
|
|
@ -50,7 +50,7 @@ double compute_and_time_segmentation(const Polyhedron& mesh, Facet_with_id_pmap<
|
||||||
|
|
||||||
CGAL::Timer timer;
|
CGAL::Timer timer;
|
||||||
timer.start();
|
timer.start();
|
||||||
int number_of_segments = CGAL::segment_from_sdf_values(mesh, sdf_values, segment_property_map, cluster);
|
int number_of_segments = CGAL::segmentation_from_sdf_values(mesh, sdf_values, segment_property_map, cluster);
|
||||||
timer.stop();
|
timer.stop();
|
||||||
std::cout << " number of segments: " << number_of_segments << std::endl;
|
std::cout << " number of segments: " << number_of_segments << std::endl;
|
||||||
std::cout << " Segmentation Time with " << cluster << " clusters : " << timer.time() << std::endl;
|
std::cout << " Segmentation Time with " << cluster << " clusters : " << timer.time() << std::endl;
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@
|
||||||
- `#SegmentationGeomTraits`
|
- `#SegmentationGeomTraits`
|
||||||
|
|
||||||
## Main Functions ##
|
## Main Functions ##
|
||||||
- `#CGAL::compute_sdf_values()`
|
- `#CGAL::sdf_values()`
|
||||||
- `#CGAL::postprocess_sdf_values()`
|
- `#CGAL::sdf_values_postprocessing()`
|
||||||
- `#CGAL::segment_from_sdf_values()`
|
- `#CGAL::segmentation_from_sdf_values()`
|
||||||
- `#CGAL::compute_sdf_values_and_segment()`
|
- `#CGAL::segmentation_via_sdf_values()`
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ Each ray is truncated into a segment, its endpoints being the apex of the cone a
|
||||||
Using the lengths of these truncated rays, which intuitively correspond to a local volume sampling,
|
Using the lengths of these truncated rays, which intuitively correspond to a local volume sampling,
|
||||||
the raw SDF value is computed by first applying an outlier removal procedure and then taking the average of the lengths.
|
the raw SDF value is computed by first applying an outlier removal procedure and then taking the average of the lengths.
|
||||||
|
|
||||||
The raw SDF values are computed through function `compute_sdf_values()`, setting `postprocess` to `false`.
|
The raw SDF values are computed through function `sdf_values()`, setting `postprocess` to `false`.
|
||||||
|
|
||||||
\note This package also accepts input meshes with holes. In such a case, rays that can not be truncated to segments,
|
\note This package also accepts input meshes with holes. In such a case, rays that can not be truncated to segments,
|
||||||
or rays that form an obtuse angle with the inward-normal of the first intersected facet are not accepted.
|
or rays that form an obtuse angle with the inward-normal of the first intersected facet are not accepted.
|
||||||
|
|
@ -57,7 +57,7 @@ the result of several post-processing steps:
|
||||||
|
|
||||||
- Facets with no raw SDF values are assigned the average raw SDF value of their edge-adjacent neighbors. If there is still a facet having no SDF value,
|
- Facets with no raw SDF values are assigned the average raw SDF value of their edge-adjacent neighbors. If there is still a facet having no SDF value,
|
||||||
the minimum amongst all the SDF values is assigned to it (this is a deviation from the description of the algorithm in \cgalCite{Shapira2008Consistent}).
|
the minimum amongst all the SDF values is assigned to it (this is a deviation from the description of the algorithm in \cgalCite{Shapira2008Consistent}).
|
||||||
The main reason for not assigning 0 to facets with no SDF values is that it can obstruct log-normalization process done at the beginning of `segment_from_sdf_values()`.
|
The main reason for not assigning 0 to facets with no SDF values is that it can obstruct log-normalization process done at the beginning of `segmentation_from_sdf_values()`.
|
||||||
|
|
||||||
- A bilateral smoothing \cgalCite{Tomasi1998Bilateral} is applied.
|
- A bilateral smoothing \cgalCite{Tomasi1998Bilateral} is applied.
|
||||||
This smoothing technique removes the noise while trying to keep fast changes on SDF values unchanged since they are natural candidates for segment boundaries.
|
This smoothing technique removes the noise while trying to keep fast changes on SDF values unchanged since they are natural candidates for segment boundaries.
|
||||||
|
|
@ -70,7 +70,7 @@ The main reason for not assigning 0 to facets with no SDF values is that it can
|
||||||
Large range parameters make smoothing closer to Gaussian smoothing and may also lead to over-smoothed SDF values.
|
Large range parameters make smoothing closer to Gaussian smoothing and may also lead to over-smoothed SDF values.
|
||||||
- SDF values are linearly normalized between [0,1].
|
- SDF values are linearly normalized between [0,1].
|
||||||
|
|
||||||
These post-processing steps can be applied to raw SDF values (or an alternative set of similar scalar values associated with facets) using the function `postprocess_sdf_values()`.
|
These post-processing steps can be applied to raw SDF values (or an alternative set of similar scalar values associated with facets) using the function `sdf_values_postprocessing()`.
|
||||||
|
|
||||||
\subsection Surface_mesh_segmentationSoftClustering Soft Clustering
|
\subsection Surface_mesh_segmentationSoftClustering Soft Clustering
|
||||||
|
|
||||||
|
|
@ -141,7 +141,7 @@ Influence of the smoothness parameter lambda over the segmentation (using 10 clu
|
||||||
|
|
||||||
The hard clustering assigns a cluster id to each facet (see \cgalFigureRef{Cluster_vs_segment} (a)).
|
The hard clustering assigns a cluster id to each facet (see \cgalFigureRef{Cluster_vs_segment} (a)).
|
||||||
A segment consists in a set of connected facets in the same cluster (see \cgalFigureRef{Cluster_vs_segment} (b)).
|
A segment consists in a set of connected facets in the same cluster (see \cgalFigureRef{Cluster_vs_segment} (b)).
|
||||||
By default the function `segment_from_sdf_values()` assigns to each facet the id of its segment.
|
By default the function `segmentation_from_sdf_values()` assigns to each facet the id of its segment.
|
||||||
It assigns to each facet the id of its cluster when `output_cluster_ids` is set to `true`.
|
It assigns to each facet the id of its cluster when `output_cluster_ids` is set to `true`.
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -153,16 +153,16 @@ Clusters and segments. The input number of clusters is set to 5. <b>(a)</b> Resu
|
||||||
|
|
||||||
\subsection Surface_mesh_segmentationAPI Summary
|
\subsection Surface_mesh_segmentationAPI Summary
|
||||||
Four functions are provided:
|
Four functions are provided:
|
||||||
- `compute_sdf_values()` : computes the SDF value of each facet of an input mesh in either raw or post-processed form.
|
- `sdf_values()` : computes the SDF value of each facet of an input mesh in either raw or post-processed form.
|
||||||
SDF values are associated to facets using a property map (see \ref Chapter_CGAL_and_Boost_Property_Maps
|
SDF values are associated to facets using a property map (see \ref Chapter_CGAL_and_Boost_Property_Maps
|
||||||
"CGAL and Boost Property Maps").
|
"CGAL and Boost Property Maps").
|
||||||
- `postprocess_sdf_values()` : post-processes raw SDF values. The post-processing is decoupled from
|
- `sdf_values_postprocessing()` : post-processes raw SDF values. The post-processing is decoupled from
|
||||||
the function `compute_sdf_values()` to allow the use of alternative methods to compute SDF values or additional post-processing step.
|
the function `sdf_values()` to allow the use of alternative methods to compute SDF values or additional post-processing step.
|
||||||
- `segment_from_sdf_values()` : computes the mesh segmentation from the SDF values of the facets of an input mesh.
|
- `segmentation_from_sdf_values()` : computes the mesh segmentation from the SDF values of the facets of an input mesh.
|
||||||
The input SDF values can be any set of scalar values associated to each facet as long as they have been normalized between 0 and 1.
|
The input SDF values can be any set of scalar values associated to each facet as long as they have been normalized between 0 and 1.
|
||||||
This function allows using the same SDF values with different parameters for the segmentation stage.
|
This function allows using the same SDF values with different parameters for the segmentation stage.
|
||||||
The segment or cluster ids are associated to the facets using a property map.
|
The segment or cluster ids are associated to the facets using a property map.
|
||||||
- `compute_sdf_values_and_segment()` : combines the three functions above.
|
- `segmentation_via_sdf_values()` : combines the three functions above.
|
||||||
|
|
||||||
These functions expect as input a triangulated surface mesh bounding a 3D solid object, with
|
These functions expect as input a triangulated surface mesh bounding a 3D solid object, with
|
||||||
the following properties:
|
the following properties:
|
||||||
|
|
@ -181,29 +181,29 @@ This operation is reliable when the `AABBTraits` model provided has exact predic
|
||||||
\section SDFExamples Examples
|
\section SDFExamples Examples
|
||||||
|
|
||||||
\subsection Example_1 Example: Computation of SDF Values
|
\subsection Example_1 Example: Computation of SDF Values
|
||||||
\cgalExample{Surface_mesh_segmentation/compute_sdf_values_example.cpp}
|
\cgalExample{Surface_mesh_segmentation/sdf_values_example.cpp}
|
||||||
|
|
||||||
\subsection Example_2 Example: Segmentation from SDF Values
|
\subsection Example_2 Example: Segmentation from SDF Values
|
||||||
\cgalExample{Surface_mesh_segmentation/segment_from_sdf_values_example.cpp}
|
\cgalExample{Surface_mesh_segmentation/segmentation_from_sdf_values_example.cpp}
|
||||||
|
|
||||||
\subsubsection Example_3 Computation of SDF Values and Segmentation
|
\subsubsection Example_3 Computation of SDF Values and Segmentation
|
||||||
The function `compute_sdf_values_and_segment()` combines the computation of sdf values, the post-processing and the segmentation.
|
The function `segmentation_via_sdf_values()` combines the computation of sdf values, the post-processing and the segmentation.
|
||||||
Note that when computing several segmentations of a mesh with different parameters (i.e. number of levels, and smoothing lambda),
|
Note that when computing several segmentations of a mesh with different parameters (i.e. number of levels, and smoothing lambda),
|
||||||
it is advised to first compute the SDF values using `compute_sdf_values()` and use them in calls of the function `segment_from_sdf_values()`.
|
it is advised to first compute the SDF values using `sdf_values()` and use them in calls of the function `segmentation_from_sdf_values()`.
|
||||||
|
|
||||||
\cgalExample{Surface_mesh_segmentation/compute_sdf_values_and_segment_example.cpp}
|
\cgalExample{Surface_mesh_segmentation/segmentation_via_sdf_values_example.cpp}
|
||||||
|
|
||||||
\subsection Surface_mesh_segmentationUsingapolyhedron Using a Polyhedron with an ID per Facet
|
\subsection Surface_mesh_segmentationUsingapolyhedron Using a Polyhedron with an ID per Facet
|
||||||
The previous examples use a `std::map` as property maps for storing the SDF values and the segmentation results. This example uses
|
The previous examples use a `std::map` as property maps for storing the SDF values and the segmentation results. This example uses
|
||||||
a polyhedron type with a facet type storing an extra ID field, together with a vector, as underlying data structure in the property maps.
|
a polyhedron type with a facet type storing an extra ID field, together with a vector, as underlying data structure in the property maps.
|
||||||
The main advantage is to decrease from log to constant the complexity for accessing the data associated to facets.
|
The main advantage is to decrease from log to constant the complexity for accessing the data associated to facets.
|
||||||
|
|
||||||
\cgalExample{Surface_mesh_segmentation/compute_sdf_values_and_segment_with_facet_ids_example.cpp}
|
\cgalExample{Surface_mesh_segmentation/segmentation_via_sdf_values_with_facet_ids_example.cpp}
|
||||||
<BR>
|
<BR>
|
||||||
\section Performances Performances
|
\section Performances Performances
|
||||||
<!-- \subsection SMSRuntime Runtime of the functions compute_sdf_values() and segment_from_sdf_values() -->
|
<!-- \subsection SMSRuntime Runtime of the functions sdf_values() and segmentation_from_sdf_values() -->
|
||||||
|
|
||||||
The following tables provide the runtime of the functions `compute_sdf_values()` and `segment_from_sdf_values()`.
|
The following tables provide the runtime of the functions `sdf_values()` and `segmentation_from_sdf_values()`.
|
||||||
The results were produced with the release 4.X of \cgal, on an Intel i7 3.2 Ghz laptop with 8 GB RAM, compiled by Visual C++ 2010 with /O2 option.
|
The results were produced with the release 4.X of \cgal, on an Intel i7 3.2 Ghz laptop with 8 GB RAM, compiled by Visual C++ 2010 with /O2 option.
|
||||||
The polyhedron types are using `Polyhedron_items_with_id_3` as item class.
|
The polyhedron types are using `Polyhedron_items_with_id_3` as item class.
|
||||||
The models used for the benchmarks are the <i>dinosaur</i> model with 7,828 facets, the <i>bear</i> model with 20,188 facets and the <i>elephant</i> model with 88,928 facets.
|
The models used for the benchmarks are the <i>dinosaur</i> model with 7,828 facets, the <i>bear</i> model with 20,188 facets and the <i>elephant</i> model with 88,928 facets.
|
||||||
|
|
@ -211,7 +211,7 @@ The models used for the benchmarks are the <i>dinosaur</i> model with 7,828 face
|
||||||
|
|
||||||
\todo Update release number as well as first introduced in.
|
\todo Update release number as well as first introduced in.
|
||||||
|
|
||||||
Runtime in seconds of `compute_sdf_values()` with 25 rays showing the cost of the robustness:
|
Runtime in seconds of `sdf_values()` with 25 rays showing the cost of the robustness:
|
||||||
|
|
||||||
<center>
|
<center>
|
||||||
Number of triangles | `%Simple_cartesian<double>` | `%Exact_predicates_inexact_constructions_kernel` (`EPICK`)
|
Number of triangles | `%Simple_cartesian<double>` | `%Exact_predicates_inexact_constructions_kernel` (`EPICK`)
|
||||||
|
|
@ -231,7 +231,7 @@ Number of triangles | `%Simple_cartesian<double>` | `%Exact_predicates_inexact_
|
||||||
</center>
|
</center>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
Runtime in milliseconds of `segment_from_sdf_values()` (using `%Simple_cartesian<double>` or `EPICK` gives the same results),
|
Runtime in milliseconds of `segmentation_from_sdf_values()` (using `%Simple_cartesian<double>` or `EPICK` gives the same results),
|
||||||
the graph-cut part is using the library <a href="http://pub.ist.ac.at/~vnk/software.html">MaxFlow</a> v2.21:
|
the graph-cut part is using the library <a href="http://pub.ist.ac.at/~vnk/software.html">MaxFlow</a> v2.21:
|
||||||
|
|
||||||
<center>
|
<center>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/// \example Surface_mesh_segmentation/compute_sdf_values_example.cpp
|
/// \example Surface_mesh_segmentation/sdf_values_example.cpp
|
||||||
/// \example Surface_mesh_segmentation/segment_from_sdf_values_example.cpp
|
/// \example Surface_mesh_segmentation/segmentation_from_sdf_values_example.cpp
|
||||||
/// \example Surface_mesh_segmentation/compute_sdf_values_and_segment_example.cpp
|
/// \example Surface_mesh_segmentation/segmentation_via_sdf_values_example.cpp
|
||||||
/// \example Surface_mesh_segmentation/compute_sdf_values_and_segment_with_facet_ids_example.cpp
|
/// \example Surface_mesh_segmentation/segmentation_via_sdf_values_with_facet_ids_example.cpp
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,14 @@ int main()
|
||||||
|
|
||||||
// compute SDF values
|
// compute SDF values
|
||||||
std::pair<double, double> min_max_sdf =
|
std::pair<double, double> min_max_sdf =
|
||||||
CGAL::compute_sdf_values(mesh, sdf_property_map, cone_angle, number_of_rays);
|
CGAL::sdf_values(mesh, sdf_property_map, cone_angle, number_of_rays);
|
||||||
|
|
||||||
|
|
||||||
// It is possible to compute the raw SDF values and post-process them through
|
// It is possible to compute the raw SDF values and post-process them through
|
||||||
// the following two lines
|
// the following two lines
|
||||||
// CGAL::compute_sdf_values(mesh, sdf_property_map, cone_angle, number_of_rays, false);
|
// CGAL::sdf_values(mesh, sdf_property_map, cone_angle, number_of_rays, false);
|
||||||
// std::pair<double, double> min_max_sdf =
|
// std::pair<double, double> min_max_sdf =
|
||||||
// CGAL::postprocess_sdf_values(mesh, sdf_property_map);
|
// CGAL::sdf_values_postprocessing(mesh, sdf_property_map);
|
||||||
|
|
||||||
// print minimum & maximum SDF values
|
// print minimum & maximum SDF values
|
||||||
std::cout << "minimum SDF: " << min_max_sdf.first
|
std::cout << "minimum SDF: " << min_max_sdf.first
|
||||||
|
|
@ -27,7 +27,7 @@ int main()
|
||||||
boost::associative_property_map<Facet_double_map> sdf_property_map(internal_sdf_map);
|
boost::associative_property_map<Facet_double_map> sdf_property_map(internal_sdf_map);
|
||||||
|
|
||||||
// compute SDF values using default parameters for number of rays, and cone angle
|
// compute SDF values using default parameters for number of rays, and cone angle
|
||||||
CGAL::compute_sdf_values(mesh, sdf_property_map);
|
CGAL::sdf_values(mesh, sdf_property_map);
|
||||||
|
|
||||||
// create a property-map for segment-ids
|
// create a property-map for segment-ids
|
||||||
typedef std::map<Polyhedron::Facet_const_handle, int> Facet_int_map;
|
typedef std::map<Polyhedron::Facet_const_handle, int> Facet_int_map;
|
||||||
|
|
@ -36,7 +36,7 @@ int main()
|
||||||
|
|
||||||
// segment the mesh using default parameters for number of levels, and smoothing lambda
|
// segment the mesh using default parameters for number of levels, and smoothing lambda
|
||||||
// Any other scalar values can be used instead of using SDF values computed using the CGAL function
|
// Any other scalar values can be used instead of using SDF values computed using the CGAL function
|
||||||
int number_of_segments = CGAL::segment_from_sdf_values(mesh, sdf_property_map, segment_property_map);
|
int number_of_segments = CGAL::segmentation_from_sdf_values(mesh, sdf_property_map, segment_property_map);
|
||||||
|
|
||||||
std::cout << "Number of segments: " << number_of_segments << std::endl;
|
std::cout << "Number of segments: " << number_of_segments << std::endl;
|
||||||
// print segment-ids
|
// print segment-ids
|
||||||
|
|
@ -52,6 +52,6 @@ int main()
|
||||||
|
|
||||||
// Note that we can use the same SDF values (sdf_property_map) over and over again for segmentation.
|
// Note that we can use the same SDF values (sdf_property_map) over and over again for segmentation.
|
||||||
// This feature is relevant for segmenting the mesh several times with different parameters.
|
// This feature is relevant for segmenting the mesh several times with different parameters.
|
||||||
CGAL::segment_from_sdf_values(
|
CGAL::segmentation_from_sdf_values(
|
||||||
mesh, sdf_property_map, segment_property_map, number_of_clusters, smoothing_lambda);
|
mesh, sdf_property_map, segment_property_map, number_of_clusters, smoothing_lambda);
|
||||||
}
|
}
|
||||||
|
|
@ -27,7 +27,7 @@ int main()
|
||||||
boost::associative_property_map<Facet_int_map> segment_property_map(internal_segment_map);
|
boost::associative_property_map<Facet_int_map> segment_property_map(internal_segment_map);
|
||||||
|
|
||||||
// calculate SDF values and segment the mesh using default parameters.
|
// calculate SDF values and segment the mesh using default parameters.
|
||||||
int number_of_segments = CGAL::compute_sdf_values_and_segment(mesh, segment_property_map);
|
int number_of_segments = CGAL::segmentation_via_sdf_values(mesh, segment_property_map);
|
||||||
|
|
||||||
std::cout << "Number of segments: " << number_of_segments << std::endl;
|
std::cout << "Number of segments: " << number_of_segments << std::endl;
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ int main()
|
||||||
std::vector<double> sdf_values(mesh.size_of_facets());
|
std::vector<double> sdf_values(mesh.size_of_facets());
|
||||||
Facet_with_id_pmap<double> sdf_property_map(sdf_values);
|
Facet_with_id_pmap<double> sdf_property_map(sdf_values);
|
||||||
|
|
||||||
CGAL::compute_sdf_values(mesh, sdf_property_map);
|
CGAL::sdf_values(mesh, sdf_property_map);
|
||||||
|
|
||||||
// access SDF values (with constant-complexity)
|
// access SDF values (with constant-complexity)
|
||||||
for(Polyhedron::Facet_const_iterator facet_it = mesh.facets_begin();
|
for(Polyhedron::Facet_const_iterator facet_it = mesh.facets_begin();
|
||||||
|
|
@ -68,7 +68,7 @@ int main()
|
||||||
std::vector<int> segment_ids(mesh.size_of_facets());
|
std::vector<int> segment_ids(mesh.size_of_facets());
|
||||||
Facet_with_id_pmap<int> segment_property_map(segment_ids);
|
Facet_with_id_pmap<int> segment_property_map(segment_ids);
|
||||||
|
|
||||||
CGAL::segment_from_sdf_values(mesh, sdf_property_map, segment_property_map);
|
CGAL::segmentation_from_sdf_values(mesh, sdf_property_map, segment_property_map);
|
||||||
|
|
||||||
// access segment-ids (with constant-complexity)
|
// access segment-ids (with constant-complexity)
|
||||||
for(Polyhedron::Facet_const_iterator facet_it = mesh.facets_begin();
|
for(Polyhedron::Facet_const_iterator facet_it = mesh.facets_begin();
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#include <CGAL/internal/Surface_mesh_segmentation/AABB_traversal_traits.h>
|
#include <CGAL/internal/Surface_mesh_segmentation/AABB_traversal_traits.h>
|
||||||
#include <CGAL/internal/Surface_mesh_segmentation/AABB_traits.h>
|
#include <CGAL/internal/Surface_mesh_segmentation/AABB_traits.h>
|
||||||
#include <CGAL/internal/Surface_mesh_segmentation/Disk_samplers.h>
|
#include <CGAL/internal/Surface_mesh_segmentation/Disk_samplers.h>
|
||||||
|
#include <CGAL/constructions/kernel_ftC3.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,17 +20,17 @@ template <bool Fast_sdf_calculation_mode, class Polyhedron,
|
||||||
#endif
|
#endif
|
||||||
>
|
>
|
||||||
std::pair<double, double>
|
std::pair<double, double>
|
||||||
compute_sdf_values( const Polyhedron& polyhedron,
|
sdf_values( const Polyhedron& polyhedron,
|
||||||
SDFPropertyMap sdf_values,
|
SDFPropertyMap sdf_values_map,
|
||||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||||
int number_of_rays = 25,
|
int number_of_rays = 25,
|
||||||
bool postprocess = true,
|
bool postprocess = true,
|
||||||
GeomTraits traits = GeomTraits())
|
GeomTraits traits = GeomTraits())
|
||||||
{
|
{
|
||||||
internal::Surface_mesh_segmentation<Polyhedron, GeomTraits, Fast_sdf_calculation_mode>
|
internal::Surface_mesh_segmentation<Polyhedron, GeomTraits, Fast_sdf_calculation_mode>
|
||||||
algorithm(polyhedron, traits);
|
algorithm(polyhedron, traits);
|
||||||
return algorithm.calculate_sdf_values(cone_angle, number_of_rays, sdf_values,
|
return algorithm.calculate_sdf_values(cone_angle, number_of_rays,
|
||||||
postprocess);
|
sdf_values_map, postprocess);
|
||||||
}
|
}
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
|
|
@ -49,10 +49,10 @@ compute_sdf_values( const Polyhedron& polyhedron,
|
||||||
* @tparam GeomTraits a model of SegmentationGeomTraits
|
* @tparam GeomTraits a model of SegmentationGeomTraits
|
||||||
*
|
*
|
||||||
* @param polyhedron surface mesh on which SDF values are computed
|
* @param polyhedron surface mesh on which SDF values are computed
|
||||||
* @param[out] sdf_values the SDF value of each facet
|
* @param[out] sdf_values_map the SDF value of each facet
|
||||||
* @param cone_angle opening angle in radians for the cone of each facet
|
* @param cone_angle opening angle in radians for the cone of each facet
|
||||||
* @param number_of_rays number of rays picked in the cone of each facet. In our experiments, we observe that increasing the number of rays beyond the default has little effect on the quality of the segmentation result
|
* @param number_of_rays number of rays picked in the cone of each facet. In our experiments, we observe that increasing the number of rays beyond the default has little effect on the quality of the segmentation result
|
||||||
* @param postprocess if `true`, `CGAL::postprocess_sdf_values` is called on raw SDF value computed.
|
* @param postprocess if `true`, `CGAL::sdf_values_postprocessing` is called on raw SDF value computed.
|
||||||
* @param traits traits class
|
* @param traits traits class
|
||||||
*
|
*
|
||||||
* @return minimum and maximum raw SDF values if @a postprocess is `true`, otherwise minimum and maximum SDF values (before linear normalization)
|
* @return minimum and maximum raw SDF values if @a postprocess is `true`, otherwise minimum and maximum SDF values (before linear normalization)
|
||||||
|
|
@ -63,15 +63,15 @@ template <class Polyhedron, class SDFPropertyMap, class GeomTraits
|
||||||
#endif
|
#endif
|
||||||
>
|
>
|
||||||
std::pair<double, double>
|
std::pair<double, double>
|
||||||
compute_sdf_values( const Polyhedron& polyhedron,
|
sdf_values( const Polyhedron& polyhedron,
|
||||||
SDFPropertyMap sdf_values,
|
SDFPropertyMap sdf_values_map,
|
||||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||||
int number_of_rays = 25,
|
int number_of_rays = 25,
|
||||||
bool postprocess = true,
|
bool postprocess = true,
|
||||||
GeomTraits traits = GeomTraits())
|
GeomTraits traits = GeomTraits())
|
||||||
{
|
{
|
||||||
return compute_sdf_values<true, Polyhedron, SDFPropertyMap, GeomTraits>
|
return sdf_values<true, Polyhedron, SDFPropertyMap, GeomTraits>
|
||||||
(polyhedron, sdf_values, cone_angle, number_of_rays, postprocess, traits);
|
(polyhedron, sdf_values_map, cone_angle, number_of_rays, postprocess, traits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -82,7 +82,7 @@ compute_sdf_values( const Polyhedron& polyhedron,
|
||||||
* Post-processing steps applied :
|
* Post-processing steps applied :
|
||||||
* - Facets with -1 SDF values are assigned the average SDF value of their edge-adjacent neighbors.
|
* - Facets with -1 SDF values are assigned the average SDF value of their edge-adjacent neighbors.
|
||||||
* If there is still a facet having -1 SDF value, the minimum valid SDF value assigned to it. Note that this step is not inherited from the paper.
|
* If there is still a facet having -1 SDF value, the minimum valid SDF value assigned to it. Note that this step is not inherited from the paper.
|
||||||
* The main reason for not assigning 0 to facets with no SDF values (i.e. -1) is that it can obstruct log-normalization process which takes place at the beginning of `CGAL::segment_from_sdf_values`.
|
* The main reason for not assigning 0 to facets with no SDF values (i.e. -1) is that it can obstruct log-normalization process which takes place at the beginning of `CGAL::segmentation_from_sdf_values`.
|
||||||
* - SDF values are smoothed with bilateral filtering.
|
* - SDF values are smoothed with bilateral filtering.
|
||||||
* - SDF values are linearly normalized between [0,1].
|
* - SDF values are linearly normalized between [0,1].
|
||||||
*
|
*
|
||||||
|
|
@ -95,17 +95,18 @@ compute_sdf_values( const Polyhedron& polyhedron,
|
||||||
* @tparam SDFPropertyMap a `ReadWritePropertyMap` with `Polyhedron::Facet_const_handle` as key and `double` as value type
|
* @tparam SDFPropertyMap a `ReadWritePropertyMap` with `Polyhedron::Facet_const_handle` as key and `double` as value type
|
||||||
*
|
*
|
||||||
* @param polyhedron surface mesh on which SDF values are computed
|
* @param polyhedron surface mesh on which SDF values are computed
|
||||||
* @param[in, out] sdf_values the SDF value of each facet
|
* @param[in, out] sdf_values_map the SDF value of each facet
|
||||||
*
|
*
|
||||||
* @return minimum and maximum SDF values before linear normalization
|
* @return minimum and maximum SDF values before linear normalization
|
||||||
*/
|
*/
|
||||||
template<class Polyhedron, class SDFPropertyMap>
|
template<class Polyhedron, class SDFPropertyMap>
|
||||||
std::pair<double, double>
|
std::pair<double, double>
|
||||||
postprocess_sdf_values(const Polyhedron& polyhedron, SDFPropertyMap sdf_values)
|
sdf_values_postprocessing(const Polyhedron& polyhedron,
|
||||||
|
SDFPropertyMap sdf_values_map)
|
||||||
{
|
{
|
||||||
CGAL_precondition(polyhedron.is_pure_triangle());
|
CGAL_precondition(polyhedron.is_pure_triangle());
|
||||||
return internal::Postprocess_sdf_values<Polyhedron>().postprocess(polyhedron,
|
return internal::Postprocess_sdf_values<Polyhedron>().postprocess(polyhedron,
|
||||||
sdf_values);
|
sdf_values_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -117,7 +118,7 @@ postprocess_sdf_values(const Polyhedron& polyhedron, SDFPropertyMap sdf_values)
|
||||||
* or a cluster-id (in [0, `number_of_clusters` -1]) to each facet.
|
* or a cluster-id (in [0, `number_of_clusters` -1]) to each facet.
|
||||||
* A segment is a set of connected facets which are placed under the same cluster (see \cgalFigureRef{Cluster_vs_segment}).
|
* A segment is a set of connected facets which are placed under the same cluster (see \cgalFigureRef{Cluster_vs_segment}).
|
||||||
*
|
*
|
||||||
* \note Log-normalization is applied on `sdf_values` before segmentation.
|
* \note Log-normalization is applied on `sdf_values_map` before segmentation.
|
||||||
* As described in the original paper \cgalCite{shapira2008consistent},
|
* As described in the original paper \cgalCite{shapira2008consistent},
|
||||||
* this normalization is done to preserve thin parts of the mesh
|
* this normalization is done to preserve thin parts of the mesh
|
||||||
* by increasing the distance between smaller SDF values and reducing
|
* by increasing the distance between smaller SDF values and reducing
|
||||||
|
|
@ -134,7 +135,7 @@ postprocess_sdf_values(const Polyhedron& polyhedron, SDFPropertyMap sdf_values)
|
||||||
* @tparam GeomTraits a model of SegmentationGeomTraits
|
* @tparam GeomTraits a model of SegmentationGeomTraits
|
||||||
*
|
*
|
||||||
* @param polyhedron surface mesh corresponding to the SDF values
|
* @param polyhedron surface mesh corresponding to the SDF values
|
||||||
* @param sdf_values the SDF value of each facet between [0-1]
|
* @param sdf_values_map the SDF value of each facet between [0-1]
|
||||||
* @param[out] segment_ids the segment or cluster id of each facet
|
* @param[out] segment_ids the segment or cluster id of each facet
|
||||||
* @param number_of_clusters number of clusters for the soft clustering
|
* @param number_of_clusters number of clusters for the soft clustering
|
||||||
* @param smoothing_lambda factor which indicates the importance of the surface features for the energy minimization. It is recommended to choose a value in the interval [0,1]. See the section \ref Surface_mesh_segmentationGraphCut for more details.
|
* @param smoothing_lambda factor which indicates the importance of the surface features for the energy minimization. It is recommended to choose a value in the interval [0,1]. See the section \ref Surface_mesh_segmentationGraphCut for more details.
|
||||||
|
|
@ -150,17 +151,17 @@ template <class Polyhedron, class SDFPropertyMap, class SegmentPropertyMap,
|
||||||
#endif
|
#endif
|
||||||
>
|
>
|
||||||
int
|
int
|
||||||
segment_from_sdf_values( const Polyhedron& polyhedron,
|
segmentation_from_sdf_values( const Polyhedron& polyhedron,
|
||||||
SDFPropertyMap sdf_values,
|
SDFPropertyMap sdf_values_map,
|
||||||
SegmentPropertyMap segment_ids,
|
SegmentPropertyMap segment_ids,
|
||||||
int number_of_clusters = 5,
|
int number_of_clusters = 5,
|
||||||
double smoothing_lambda = 0.26,
|
double smoothing_lambda = 0.26,
|
||||||
bool output_cluster_ids = false,
|
bool output_cluster_ids = false,
|
||||||
GeomTraits traits = GeomTraits())
|
GeomTraits traits = GeomTraits())
|
||||||
{
|
{
|
||||||
internal::Surface_mesh_segmentation<Polyhedron, GeomTraits> algorithm(
|
internal::Surface_mesh_segmentation<Polyhedron, GeomTraits> algorithm(
|
||||||
polyhedron, traits);
|
polyhedron, traits);
|
||||||
return algorithm.partition(number_of_clusters, smoothing_lambda, sdf_values,
|
return algorithm.partition(number_of_clusters, smoothing_lambda, sdf_values_map,
|
||||||
segment_ids, !output_cluster_ids);
|
segment_ids, !output_cluster_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,14 +173,14 @@ template < bool Fast_sdf_calculation_mode, class Polyhedron,
|
||||||
#endif
|
#endif
|
||||||
>
|
>
|
||||||
int
|
int
|
||||||
compute_sdf_values_and_segment(const Polyhedron& polyhedron,
|
segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
||||||
SegmentPropertyMap segment_ids,
|
SegmentPropertyMap segment_ids,
|
||||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||||
int number_of_rays = 25,
|
int number_of_rays = 25,
|
||||||
int number_of_clusters = 5,
|
int number_of_clusters = 5,
|
||||||
double smoothing_lambda = 0.26,
|
double smoothing_lambda = 0.26,
|
||||||
bool output_cluster_ids = false,
|
bool output_cluster_ids = false,
|
||||||
GeomTraits traits = GeomTraits())
|
GeomTraits traits = GeomTraits())
|
||||||
{
|
{
|
||||||
typedef std::map< typename Polyhedron::Facet_const_handle, double>
|
typedef std::map< typename Polyhedron::Facet_const_handle, double>
|
||||||
Facet_double_map;
|
Facet_double_map;
|
||||||
|
|
@ -187,9 +188,9 @@ compute_sdf_values_and_segment(const Polyhedron& polyhedron,
|
||||||
boost::associative_property_map<Facet_double_map> sdf_property_map(
|
boost::associative_property_map<Facet_double_map> sdf_property_map(
|
||||||
internal_sdf_map);
|
internal_sdf_map);
|
||||||
|
|
||||||
compute_sdf_values<Fast_sdf_calculation_mode, Polyhedron, boost::associative_property_map<Facet_double_map>, GeomTraits>
|
sdf_values<Fast_sdf_calculation_mode, Polyhedron, boost::associative_property_map<Facet_double_map>, GeomTraits>
|
||||||
(polyhedron, sdf_property_map, cone_angle, number_of_rays, true, traits);
|
(polyhedron, sdf_property_map, cone_angle, number_of_rays, true, traits);
|
||||||
return segment_from_sdf_values<Polyhedron, boost::associative_property_map<Facet_double_map>, SegmentPropertyMap, GeomTraits>
|
return segmentation_from_sdf_values<Polyhedron, boost::associative_property_map<Facet_double_map>, SegmentPropertyMap, GeomTraits>
|
||||||
(polyhedron, sdf_property_map, segment_ids, number_of_clusters,
|
(polyhedron, sdf_property_map, segment_ids, number_of_clusters,
|
||||||
smoothing_lambda, output_cluster_ids, traits);
|
smoothing_lambda, output_cluster_ids, traits);
|
||||||
}
|
}
|
||||||
|
|
@ -200,14 +201,14 @@ compute_sdf_values_and_segment(const Polyhedron& polyhedron,
|
||||||
* \ingroup PkgSurfaceSegmentation
|
* \ingroup PkgSurfaceSegmentation
|
||||||
* @brief Function computing the segmentation of a surface mesh.
|
* @brief Function computing the segmentation of a surface mesh.
|
||||||
*
|
*
|
||||||
* This function is equivalent to calling the functions `CGAL::compute_sdf_values()` and
|
* This function is equivalent to calling the functions `CGAL::sdf_values()` and
|
||||||
* `CGAL::segment_from_sdf_values()` with the same parameters.
|
* `CGAL::segmentation_from_sdf_values()` with the same parameters.
|
||||||
*
|
*
|
||||||
* \note There is no direct relation between the parameter `number_of_clusters`
|
* \note There is no direct relation between the parameter `number_of_clusters`
|
||||||
* and the final number of segments after segmentation. However, setting a large number of clusters will result in a detailed segmentation of the mesh with a large number of segments.
|
* and the final number of segments after segmentation. However, setting a large number of clusters will result in a detailed segmentation of the mesh with a large number of segments.
|
||||||
* \note For computing segmentations of the mesh with different parameters (i.e. number of levels, and smoothing lambda),
|
* \note For computing segmentations of the mesh with different parameters (i.e. number of levels, and smoothing lambda),
|
||||||
* it is more efficient to first compute the SDF values using `CGAL::compute_sdf_values()` and use them in different calls to
|
* it is more efficient to first compute the SDF values using `CGAL::sdf_values()` and use them in different calls to
|
||||||
* `CGAL::segment_from_sdf_values()`.
|
* `CGAL::segmentation_from_sdf_values()`.
|
||||||
*
|
*
|
||||||
* @pre @a polyhedron.is_pure_triangle()
|
* @pre @a polyhedron.is_pure_triangle()
|
||||||
* @pre @a number_of_clusters > 0
|
* @pre @a number_of_clusters > 0
|
||||||
|
|
@ -233,16 +234,16 @@ template < class Polyhedron, class SegmentPropertyMap, class GeomTraits
|
||||||
#endif
|
#endif
|
||||||
>
|
>
|
||||||
int
|
int
|
||||||
compute_sdf_values_and_segment(const Polyhedron& polyhedron,
|
segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
||||||
SegmentPropertyMap segment_ids,
|
SegmentPropertyMap segment_ids,
|
||||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||||
int number_of_rays = 25,
|
int number_of_rays = 25,
|
||||||
int number_of_clusters = 5,
|
int number_of_clusters = 5,
|
||||||
double smoothing_lambda = 0.26,
|
double smoothing_lambda = 0.26,
|
||||||
bool output_cluster_ids = false,
|
bool output_cluster_ids = false,
|
||||||
GeomTraits traits = GeomTraits())
|
GeomTraits traits = GeomTraits())
|
||||||
{
|
{
|
||||||
return compute_sdf_values_and_segment<true, Polyhedron, SegmentPropertyMap, GeomTraits>
|
return segmentation_via_sdf_values<true, Polyhedron, SegmentPropertyMap, GeomTraits>
|
||||||
(polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
(polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
||||||
smoothing_lambda, output_cluster_ids, traits);
|
smoothing_lambda, output_cluster_ids, traits);
|
||||||
}
|
}
|
||||||
|
|
@ -251,73 +252,73 @@ compute_sdf_values_and_segment(const Polyhedron& polyhedron,
|
||||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
#ifdef BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||||
template <bool Fast_sdf_calculation_mode, class Polyhedron, class SDFPropertyMap>
|
template <bool Fast_sdf_calculation_mode, class Polyhedron, class SDFPropertyMap>
|
||||||
std::pair<double, double>
|
std::pair<double, double>
|
||||||
compute_sdf_values(const Polyhedron& polyhedron,
|
sdf_values(const Polyhedron& polyhedron,
|
||||||
SDFPropertyMap sdf_values,
|
SDFPropertyMap sdf_values_map,
|
||||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||||
int number_of_rays = 25,
|
int number_of_rays = 25,
|
||||||
bool postprocess = true,
|
bool postprocess = true,
|
||||||
typename Polyhedron::Traits traits = typename Polyhedron::Traits())
|
typename Polyhedron::Traits traits = typename Polyhedron::Traits())
|
||||||
{
|
{
|
||||||
return compute_sdf_values<Fast_sdf_calculation_mode, Polyhedron, SDFPropertyMap, typename Polyhedron::Traits>
|
return sdf_values<Fast_sdf_calculation_mode, Polyhedron, SDFPropertyMap, typename Polyhedron::Traits>
|
||||||
(polyhedron, sdf_values, cone_angle, number_of_rays, postprocess, traits);
|
(polyhedron, sdf_values_map, cone_angle, number_of_rays, postprocess, traits);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class Polyhedron, class SDFPropertyMap>
|
template < class Polyhedron, class SDFPropertyMap>
|
||||||
std::pair<double, double>
|
std::pair<double, double>
|
||||||
compute_sdf_values(const Polyhedron& polyhedron,
|
sdf_values( const Polyhedron& polyhedron,
|
||||||
SDFPropertyMap sdf_values,
|
SDFPropertyMap sdf_values_map,
|
||||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||||
int number_of_rays = 25,
|
int number_of_rays = 25,
|
||||||
bool postprocess = true,
|
bool postprocess = true,
|
||||||
typename Polyhedron::Traits traits = typename Polyhedron::Traits())
|
typename Polyhedron::Traits traits = typename Polyhedron::Traits())
|
||||||
{
|
{
|
||||||
return compute_sdf_values<true, Polyhedron, SDFPropertyMap, typename Polyhedron::Traits>
|
return sdf_values<true, Polyhedron, SDFPropertyMap, typename Polyhedron::Traits>
|
||||||
(polyhedron, sdf_values, cone_angle, number_of_rays, postprocess, traits);
|
(polyhedron, sdf_values_map, cone_angle, number_of_rays, postprocess, traits);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Polyhedron, class SDFPropertyMap, class SegmentPropertyMap>
|
template <class Polyhedron, class SDFPropertyMap, class SegmentPropertyMap>
|
||||||
int
|
int
|
||||||
segment_from_sdf_values(const Polyhedron& polyhedron,
|
segmentation_from_sdf_values(const Polyhedron& polyhedron,
|
||||||
SDFPropertyMap sdf_values,
|
SDFPropertyMap sdf_values_map,
|
||||||
SegmentPropertyMap segment_ids,
|
SegmentPropertyMap segment_ids,
|
||||||
int number_of_clusters = 5,
|
int number_of_clusters = 5,
|
||||||
double smoothing_lambda = 0.26,
|
double smoothing_lambda = 0.26,
|
||||||
bool output_cluster_ids = false,
|
bool output_cluster_ids = false,
|
||||||
typename Polyhedron::Traits traits = typename Polyhedron::Traits())
|
typename Polyhedron::Traits traits = typename Polyhedron::Traits())
|
||||||
{
|
{
|
||||||
return segment_from_sdf_values<Polyhedron, SDFPropertyMap, SegmentPropertyMap, typename Polyhedron::Traits>
|
return segmentation_from_sdf_values<Polyhedron, SDFPropertyMap, SegmentPropertyMap, typename Polyhedron::Traits>
|
||||||
(polyhedron, sdf_values, segment_ids, number_of_clusters, smoothing_lambda,
|
(polyhedron, sdf_values_map, segment_ids, number_of_clusters, smoothing_lambda,
|
||||||
output_cluster_ids, traits);
|
output_cluster_ids, traits);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool Fast_sdf_calculation_mode, class Polyhedron, class SegmentPropertyMap>
|
template <bool Fast_sdf_calculation_mode, class Polyhedron, class SegmentPropertyMap>
|
||||||
int
|
int
|
||||||
compute_sdf_values_and_segment(const Polyhedron& polyhedron,
|
segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
||||||
SegmentPropertyMap segment_ids,
|
SegmentPropertyMap segment_ids,
|
||||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||||
int number_of_rays = 25,
|
int number_of_rays = 25,
|
||||||
int number_of_clusters = 5,
|
int number_of_clusters = 5,
|
||||||
double smoothing_lambda = 0.26,
|
double smoothing_lambda = 0.26,
|
||||||
bool output_cluster_ids = false,
|
bool output_cluster_ids = false,
|
||||||
typename Polyhedron::Traits traits = typename Polyhedron::Traits())
|
typename Polyhedron::Traits traits = typename Polyhedron::Traits())
|
||||||
{
|
{
|
||||||
return compute_sdf_values_and_segment< Fast_sdf_calculation_mode, Polyhedron, SegmentPropertyMap, typename Polyhedron::Traits>
|
return segmentation_via_sdf_values< Fast_sdf_calculation_mode, Polyhedron, SegmentPropertyMap, typename Polyhedron::Traits>
|
||||||
(polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
(polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
||||||
smoothing_lambda, output_cluster_ids, traits);
|
smoothing_lambda, output_cluster_ids, traits);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Polyhedron, class SegmentPropertyMap>
|
template <class Polyhedron, class SegmentPropertyMap>
|
||||||
int
|
int
|
||||||
compute_sdf_values_and_segment(const Polyhedron& polyhedron,
|
segmentation_via_sdf_values(const Polyhedron& polyhedron,
|
||||||
SegmentPropertyMap segment_ids,
|
SegmentPropertyMap segment_ids,
|
||||||
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
double cone_angle = 2.0 / 3.0 * CGAL_PI,
|
||||||
int number_of_rays = 25,
|
int number_of_rays = 25,
|
||||||
int number_of_clusters = 5,
|
int number_of_clusters = 5,
|
||||||
double smoothing_lambda = 0.26,
|
double smoothing_lambda = 0.26,
|
||||||
bool output_cluster_ids = false,
|
bool output_cluster_ids = false,
|
||||||
typename Polyhedron::Traits traits = typename Polyhedron::Traits())
|
typename Polyhedron::Traits traits = typename Polyhedron::Traits())
|
||||||
{
|
{
|
||||||
return compute_sdf_values_and_segment<true, Polyhedron, SegmentPropertyMap, typename Polyhedron::Traits>
|
return segmentation_via_sdf_values<true, Polyhedron, SegmentPropertyMap, typename Polyhedron::Traits>
|
||||||
(polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
(polyhedron, segment_ids, cone_angle, number_of_rays, number_of_clusters,
|
||||||
smoothing_lambda, output_cluster_ids, traits);
|
smoothing_lambda, output_cluster_ids, traits);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,14 @@ int main(void)
|
||||||
Facet_double_map internal_map;
|
Facet_double_map internal_map;
|
||||||
|
|
||||||
CGAL::Timer timer; timer.start();
|
CGAL::Timer timer; timer.start();
|
||||||
std::pair<double, double> min_max_sdf = CGAL::compute_sdf_values(mesh,
|
std::pair<double, double> min_max_sdf = CGAL::sdf_values(mesh,
|
||||||
boost::associative_property_map<Facet_double_map>(internal_map) );
|
boost::associative_property_map<Facet_double_map>(internal_map) );
|
||||||
std::cout << "minimum sdf: " << min_max_sdf.first << " maximum sdf: " << min_max_sdf.second << std::endl;
|
std::cout << "minimum sdf: " << min_max_sdf.first << " maximum sdf: " << min_max_sdf.second << std::endl;
|
||||||
std::cout << "Calculation time (fast traversal on): *** " << timer.time() << std::endl;
|
std::cout << "Calculation time (fast traversal on): *** " << timer.time() << std::endl;
|
||||||
|
|
||||||
timer.reset();
|
timer.reset();
|
||||||
Facet_double_map internal_map_2;
|
Facet_double_map internal_map_2;
|
||||||
min_max_sdf = CGAL::compute_sdf_values<false>(mesh,
|
min_max_sdf = CGAL::sdf_values<false>(mesh,
|
||||||
boost::associative_property_map<Facet_double_map>(internal_map_2) );
|
boost::associative_property_map<Facet_double_map>(internal_map_2) );
|
||||||
std::cout << "minimum sdf: " << min_max_sdf.first << " maximum sdf: " << min_max_sdf.second << std::endl;
|
std::cout << "minimum sdf: " << min_max_sdf.first << " maximum sdf: " << min_max_sdf.second << std::endl;
|
||||||
std::cout << "Calculation time (fast traversal off): *** " << timer.time() << std::endl;
|
std::cout << "Calculation time (fast traversal off): *** " << timer.time() << std::endl;
|
||||||
|
|
@ -42,7 +42,7 @@ int main(void)
|
||||||
typedef std::map<Polyhedron::Facet_const_handle, int> Facet_int_map;
|
typedef std::map<Polyhedron::Facet_const_handle, int> Facet_int_map;
|
||||||
Facet_int_map internal_segment_map;
|
Facet_int_map internal_segment_map;
|
||||||
// calculate SDF values and segment the mesh using default parameters.
|
// calculate SDF values and segment the mesh using default parameters.
|
||||||
int number_of_segments = CGAL::compute_sdf_values_and_segment(mesh,
|
int number_of_segments = CGAL::segmentation_via_sdf_values(mesh,
|
||||||
boost::associative_property_map<Facet_int_map>(internal_segment_map));
|
boost::associative_property_map<Facet_int_map>(internal_segment_map));
|
||||||
std::cout << "Number of segments: " << number_of_segments << std::endl;
|
std::cout << "Number of segments: " << number_of_segments << std::endl;
|
||||||
std::cout << "Calculation time (fast traversal on): *** " << timer.time() << std::endl;
|
std::cout << "Calculation time (fast traversal on): *** " << timer.time() << std::endl;
|
||||||
|
|
@ -50,7 +50,7 @@ int main(void)
|
||||||
timer.reset();
|
timer.reset();
|
||||||
Facet_int_map internal_segment_map_2;
|
Facet_int_map internal_segment_map_2;
|
||||||
// calculate SDF values and segment the mesh using default parameters.
|
// calculate SDF values and segment the mesh using default parameters.
|
||||||
number_of_segments = CGAL::compute_sdf_values_and_segment<false>(mesh,
|
number_of_segments = CGAL::segmentation_via_sdf_values<false>(mesh,
|
||||||
boost::associative_property_map<Facet_int_map>(internal_segment_map_2));
|
boost::associative_property_map<Facet_int_map>(internal_segment_map_2));
|
||||||
std::cout << "Number of segments: " << number_of_segments << std::endl;
|
std::cout << "Number of segments: " << number_of_segments << std::endl;
|
||||||
std::cout << "Calculation time (fast traversal off): *** " << timer.time() << std::endl;
|
std::cout << "Calculation time (fast traversal off): *** " << timer.time() << std::endl;
|
||||||
|
|
|
||||||
|
|
@ -25,14 +25,14 @@ int main(void)
|
||||||
Facet_double_map internal_map;
|
Facet_double_map internal_map;
|
||||||
boost::associative_property_map<Facet_double_map> sdf_property_map(internal_map);
|
boost::associative_property_map<Facet_double_map> sdf_property_map(internal_map);
|
||||||
|
|
||||||
std::pair<double, double> min_max_sdf = CGAL::compute_sdf_values(mesh, sdf_property_map);
|
std::pair<double, double> min_max_sdf = CGAL::sdf_values(mesh, sdf_property_map);
|
||||||
std::cout << "minimum sdf: " << min_max_sdf.first << " maximum sdf: " << min_max_sdf.second << std::endl;
|
std::cout << "minimum sdf: " << min_max_sdf.first << " maximum sdf: " << min_max_sdf.second << std::endl;
|
||||||
|
|
||||||
typedef std::map<Polyhedron::Facet_const_handle, int> Facet_int_map;
|
typedef std::map<Polyhedron::Facet_const_handle, int> Facet_int_map;
|
||||||
Facet_int_map internal_segment_map;
|
Facet_int_map internal_segment_map;
|
||||||
boost::associative_property_map<Facet_int_map> segment_property_map(internal_segment_map);
|
boost::associative_property_map<Facet_int_map> segment_property_map(internal_segment_map);
|
||||||
|
|
||||||
int nb_segments = CGAL::segment_from_sdf_values(
|
int nb_segments = CGAL::segmentation_from_sdf_values(
|
||||||
mesh, sdf_property_map, segment_property_map);
|
mesh, sdf_property_map, segment_property_map);
|
||||||
|
|
||||||
if(nb_segments != 3)
|
if(nb_segments != 3)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ int main()
|
||||||
boost::associative_property_map<Facet_int_map> segment_property_map(internal_segment_map);
|
boost::associative_property_map<Facet_int_map> segment_property_map(internal_segment_map);
|
||||||
|
|
||||||
// calculate SDF values and segment the mesh using default parameters.
|
// calculate SDF values and segment the mesh using default parameters.
|
||||||
int number_of_segments = CGAL::compute_sdf_values_and_segment(mesh, segment_property_map);
|
int number_of_segments = CGAL::segmentation_via_sdf_values(mesh, segment_property_map);
|
||||||
|
|
||||||
std::cout << "Number of segments: " << number_of_segments << std::endl;
|
std::cout << "Number of segments: " << number_of_segments << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue