Merge branch 'gsoc2013-Point_set_processing_3-point_set_consolidation-swu' of ssh://scm.cgal.org/var/git/cgal-gsoc into gsoc2013-Point_set_processing_3-point_set_consolidation-swu

This commit is contained in:
Shihao Wu 2014-11-05 18:51:17 +08:00
commit 0fc690a32b
5 changed files with 151 additions and 282 deletions

View File

@ -2335,9 +2335,9 @@ ADDRESS = "Saarbr{\"u}cken, Germany"
series = {Texts and Monographs in Symbolic Computation}
}
@ARTICLE{WLOP2009,
@article{wlop-2009,
title = {Consolidation of unorganized point clouds for surface reconstruction},
author = H. Huang and D. Li and H. Zhang and U. Ascher and D. Cohen-Or},
author = {H. Huang and D. Li and H. Zhang and U. Ascher and D. Cohen-Or},
journal = {ACM Transactions on Graphics},
volume = {28},
issue = {5},
@ -2345,7 +2345,7 @@ ADDRESS = "Saarbr{\"u}cken, Germany"
year = {2009}
}
@ARTICLE{EAR2013
@article{ear-2013,
title = {Edge-Aware Point Set Resampling},
author = {H. Huang and S. Wu and M. Gong and D. Cohen-Or and U. Ascher and H. Zhang},
journal = {ACM Transactions on Graphics},

View File

@ -143,10 +143,9 @@ one arbitrarily chosen point. This algorithm is slower than
Function `wlop_simplify_and_regularize_point_set()` not only simplifies,
but also regularizes downsampled points. This is an implementation of
the WLOP (Weighted Locally Optimal Projection) algorithm
<a href="http://web.siat.ac.cn/~huihuang/WLOP/WLOP_page.html">[Huang et al. 2009]</a>.
the Weighted Locally Optimal Projection (WLOP) algorithm \cgalCite{wlop-2009}.
\subsection Point_set_processing_3Example_3 Grid simplification example
The following example reads a point set and simplifies it by clustering.
@ -173,7 +172,7 @@ Computing density weights for each point is an optional preprocessing. For examp
Comparison between with and without density: Left: input. Middle: `require_uniform_sampling = false`. Right: `require_uniform_sampling=true`.
\cgalFigureEnd
\subsubsection Point_set_processing_3WLOP_parallel_performance Parallel Performance:
\subsubsection Point_set_processing_3WLOP_parallel_performance Parallel Performance
A parallel version of WLOP is provided and requires the executable to be linked against the
<a href="http://www.threadingbuildingblocks.org">Intel TBB library</a>.
To control the number of threads used, the user may use the tbb::task_scheduler_init class.
@ -194,7 +193,8 @@ projecting each point onto a smooth parametric surface patch
Function `bilateral_smooth_point_set()` smooths the input point set by
iteratively projecting each point onto the implicit surface patch fitted over its `k` nearest neighbors.
Bilateral projection preserves sharp features according to the normal (gradient) information. Normals are thus required as input. See formula (2) and (4) in paper <a href="http://web.siat.ac.cn/~huihuang/EAR/EAR_page.html">[Huang et al. 2013]</a>.
Bilateral projection preserves sharp features according to the normal (gradient) information.
Normals are thus required as input. See formula (2) and (4) in \cgalCite{ear-2013}.
\subsection Point_set_processing_3Example_5 Jet smoothing example

View File

@ -323,7 +323,7 @@ public:
/// point onto the implicit surface patch fitted over its k nearest neighbors.
/// Bilateral projection preserves sharp features according to the normal
/// (gradient) information. Both point positions and normals will be modified.
/// For more details, please see formula (2) and (4) in paper \cgalCite{EAR2013}.
/// For more details, please see formula (2) and (4) in paper \cgalCite{ear-2013}.
/// \pre Normals must be unit vectors
/// \pre k >= 2
///
@ -331,19 +331,19 @@ public:
/// Possible values are `Sequential_tag`
/// and `Parallel_tag`.
/// @tparam ForwardIterator iterator over input points.
/// @tparam PointPMap is a model of `WritablePropertyMap`
/// with a value_type = Point_3<Kernel>.
/// It can be omitted if ForwardIterator::value_type is convertible to
/// Point_3<Kernel>.
/// @tparam NormalPMap is a model of `WritablePropertyMap`
/// with a value_type = Vector_3<Kernel>.
/// @tparam PointPMap is a model of `ReadablePropertyMap`
/// with a value_type = `Kernel::Point_3`.
/// It can be omitted if `ForwardIterator::value_type` is convertible to
/// `Kernel::Point_3`.
/// @tparam NormalPMap is a model of `ReadablePropertyMap`
/// with a value_type = `Kernel::Vector_3`.
/// @tparam Kernel Geometric traits class.
/// It can be omitted and deduced automatically from PointPMap value_type.
/// Kernel_traits are used for deducing the Kernel.
/// It can be omitted and deduced automatically from PointPMap's value_type.
/// `Kernel_traits` are used for deducing the kernel.
///
/// @return Average point movement error. It's a convergence criterium for the algorithm.
/// This value could help user decide how many times of iteration is
/// sufficient.
/// This value can help the user to decide how many iterations are
/// sufficient.
// This variant requires all parameters.
template <typename Concurrency_tag,
@ -353,13 +353,14 @@ template <typename Concurrency_tag,
typename Kernel>
double
bilateral_smooth_point_set(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
ForwardIterator first, ///< forward iterator to the first input point.
ForwardIterator beyond, ///< past-the-end iterator.
PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
unsigned int k, ///< size of neighborhood. The bigger the smoother the result will be.
typename Kernel::FT sharpness_angle, ///< control sharpness of the result,
///< the bigger the smoother the result will be.
unsigned int k, ///< size of neighborhood. The bigger the value is,
///< the smoother the result will be.
typename Kernel::FT sharpness_angle, ///< control sharpness of the result.
///< The bigger the value is, the smoother the result will be.
///< The range of possible value is [0, 90].
const Kernel& /*kernel*/) ///< geometric traits.
{
@ -575,9 +576,9 @@ template <typename Concurrency_tag,
typename NormalPMap>
double
bilateral_smooth_point_set(
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
PointPMap point_pmap, ///< property map OutputIterator -> Point_3.
ForwardIterator first, ///< forward iterator to the first input point.
ForwardIterator beyond, ///< past-the-end iterator.
PointPMap point_pmap, ///< property map OutputIterator -> Point_3.
NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3.
const unsigned int k, ///< number of neighbors.
double sharpness_angle ///< control sharpness(0-90)
@ -602,11 +603,11 @@ template <typename Concurrency_tag,
typename NormalPMap>
double
bilateral_smooth_point_set(
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
const unsigned int k, ///< number of neighbors.
double sharpness_angle, ///< control sharpness(0-90)
NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3.
ForwardIterator first, ///< forward iterator to the first input point.
ForwardIterator beyond, ///< past-the-end iterator.
const unsigned int k, ///< number of neighbors.
double sharpness_angle, ///< control sharpness(0-90)
NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3.
{
return bilateral_smooth_point_set<Concurrency_tag>(
first, beyond,

View File

@ -29,6 +29,7 @@
#include <iterator>
#include <set>
#include <utility>
#include <boost/version.hpp>
#if BOOST_VERSION >= 104000
@ -63,7 +64,7 @@ base_point_selection(
const rich_grid_internal::Rich_point<Kernel>& query, ///< 3D point to project
const std::vector<rich_grid_internal::Rich_point<Kernel> >&
neighbor_points,///< neighbor sample points
const typename Kernel::FT edge_senstivity,///< edge senstivity parameter
const typename Kernel::FT edge_sensitivity,///< edge senstivity parameter
unsigned int& output_base_index ///< base point index
)
{
@ -86,7 +87,7 @@ base_point_selection(
Vector diff_v_t = t - v.pt;
Point mid_point = v.pt + (diff_v_t * FT(0.5));
FT dot_produce = std::pow((FT(2.0) - vm * tm), edge_senstivity);
FT dot_produce = std::pow((FT(2.0) - vm * tm), edge_sensitivity);
Vector diff_t_mid = mid_point - t;
FT project_t = diff_t_mid * tm;
@ -270,81 +271,83 @@ update_new_point(
// ----------------------------------------------------------------------------
/// \ingroup PkgPointSetProcessing
/// This method progressively upsample the point set while
/// This method progressively upsamples the point set while
/// approaching the edge singularities, which generates a denser point set that
/// has applications in point-based rendering, hole filling,
/// and sparse surface reconstruction.
/// For more details, please refert to this paper: \cgalCite{EAR2013}.
/// @tparam OutputIteratorValueType type of objects that in `OutputIterator`.
/// It is default to `value_type_traits<OutputIterator>::%type`
/// and can be omitted when the default is fine. It should contain both
/// points position and normal information.
/// @tparam OutputIterator output iterator where output points (and normals) are put.
/// For more details, please refer to \cgalCite{ear-2013}.
/// @tparam OutputIterator Type of the output iterator.
/// The type of the objects is
/// `std::pair<Kernel::Point_3, Kernel::Vector_3>`.
/// Note that the user may use a
/// <A HREF="http://www.boost.org/libs/iterator/doc/function_output_iterator.html">function_output_iterator</A>
/// to output objects with a different type.
/// @tparam ForwardIterator iterator over input points.
/// @tparam PointPMap is a model of `WritablePropertyMap`
/// with a value_type = Point_3<Kernel>.
/// @tparam PointPMap is a model of `ReadablePropertyMap`
/// with a value_type = `Kernel::Point_3`.
/// It can be omitted if ForwardIterator::value_type is convertible to
/// Point_3<Kernel>.
/// @tparam NormalPMap is a model of `WritablePropertyMap`
/// with a value_type = Vector_3<Kernel>.
/// `Kernel::Point_3`.
/// @tparam NormalPMap is a model of `ReadablePropertyMap`
/// with a value_type = `Kernel::Vector_3`.
/// @tparam Kernel Geometric traits class.
/// It can be omitted and deduced automatically from PointPMap value_type.
/// Kernel_traits are used for deducing the Kernel.
/// @param output output iterator
///
/// It can be omitted and deduced automatically from PointPMap's value_type.
/// `Kernel_traits` are used for deducing the kernel.
///
// This variant requires all parameters.
template <typename OutputIteratorValueType,
typename OutputIterator,
template <typename OutputIterator,
typename ForwardIterator,
typename PointPMap,
typename NormalPMap,
typename Kernel>
void
OutputIterator
edge_aware_upsample_point_set(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
OutputIterator output, ///< output iterator over points (and normals),
/// where the first output point will be stored in.
PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
ForwardIterator first, ///< forward iterator to the first input point.
ForwardIterator beyond, ///< past-the-end iterator.
OutputIterator output, ///< output iterator where output points and normals
///< are put.
PointPMap point_pmap, ///< property map: value_type of `ForwardIterator` -> `Kernel::Point_3`
NormalPMap normal_pmap, ///< property map: value_type of `ForwardIterator` -> `Kernel::Vector_3`.
const typename Kernel::FT sharpness_angle, ///<
///< control the preservation of sharp features. The bigger
///< controls the preservation of sharp features.
///< The bigger the value is,
///< the smoother the result will be.
///< The range of possible value is [0, 90].
const typename Kernel::FT edge_senstivity, ///<
///< See section \ref Point_set_processing_3Upsample_Parameter2
///< for an example.
typename Kernel::FT edge_sensitivity, ///<
///< larger values of edge-sensitivity give higher priority
///< to inserting points along the sharp features.
///< The range of possible value is [0, 1].
///< to inserting points along sharp features.
///< The range of possible values is [0, 1].
///< See section \ref Point_set_processing_3Upsample_Parameter1
///< for an example.
const typename Kernel::FT neighbor_radius, ///<
///< initial size of neighbors,
///< indicates the radius of the biggest hole that will be filled.
const unsigned int number_of_output,///< points number of the output.
const unsigned int number_of_output_points,///< required number of output
///< points
const Kernel& /*kernel*/ ///< geometric traits.
)
{
typedef OutputIteratorValueType Point_with_normal;
// basic geometric types
typedef typename Kernel::Point_3 Point;
typedef typename Kernel::Vector_3 Vector;
typedef typename Kernel::FT FT;
typedef typename rich_grid_internal::Rich_point<Kernel> Rich_point;
typedef std::pair<Point, Vector> Point_with_normal;
// preconditions
CGAL_point_set_processing_precondition(first != beyond);
CGAL_point_set_processing_precondition(sharpness_angle >= 0
&&sharpness_angle <= 90);
CGAL_point_set_processing_precondition(edge_senstivity >= 0
&&edge_senstivity <= 1);
CGAL_point_set_processing_precondition(edge_sensitivity >= 0
&&edge_sensitivity <= 1);
CGAL_point_set_processing_precondition(neighbor_radius > 0);
edge_senstivity *= 10; // just project [0, 1] to [0, 10].
edge_sensitivity *= 10; // just project [0, 1] to [0, 10].
std::size_t number_of_input = std::distance(first, beyond);
CGAL_point_set_processing_precondition(number_of_output > number_of_input);
CGAL_point_set_processing_precondition(number_of_output_points > number_of_input);
Timer task_timer;
@ -422,7 +425,7 @@ edge_aware_upsample_point_set(
double density2 = upsample_internal::
base_point_selection(v,
neighbor_rich_points,
edge_senstivity,
edge_sensitivity,
base_index);
sum_density += density2;
count_density++;
@ -470,7 +473,7 @@ edge_aware_upsample_point_set(
FT density2 = upsample_internal::
base_point_selection(v,
neighbor_rich_points,
edge_senstivity,
edge_sensitivity,
base_index);
// test if it pass the density threshold
@ -506,7 +509,7 @@ edge_aware_upsample_point_set(
current_radius,
sharpness_bandwidth);
if (rich_point_set.size() >= number_of_output)
if (rich_point_set.size() >= number_of_output_points)
{
break;
}
@ -516,14 +519,14 @@ edge_aware_upsample_point_set(
#endif
if (count_not_pass == 0 ||
loop >= max_loop_time ||
rich_point_set.size() >= number_of_output)
rich_point_set.size() >= number_of_output_points)
{
break;
}
}
if (rich_point_set.size() >= number_of_output)
if (rich_point_set.size() >= number_of_output_points)
{
break;
}
@ -534,89 +537,41 @@ edge_aware_upsample_point_set(
Rich_point& v = rich_point_set[i];
Point point = v.pt;
Vector normal = v.normal;
Point_with_normal pwn;
#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
put(point_pmap, &pwn, point); // point_pmap[&pwn] = point
put(normal_pmap, &pwn, normal); // normal_pmap[&pwn] = normal
#else
put(point_pmap, pwn, point); // point_pmap[pwn] = point
put(normal_pmap, pwn, normal); // normal_pmap[pwn] = normal
#endif
*output++ = pwn;
*output++ = std::make_pair(point, normal);
}
return;
return output;
}
/// @cond SKIP_IN_MANUAL
template <typename OutputIterator,
typename ForwardIterator,
typename PointPMap,
typename NormalPMap,
typename Kernel>
void
edge_aware_upsample_point_set(
ForwardIterator first, ///< iterator over the first input point
ForwardIterator beyond, ///< past-the-end iterator
OutputIterator output, ///< output iterator over points.
PointPMap point_pmap, ///< property map: OutputIterator -> Point_3.
NormalPMap normal_pmap, ///< property map: OutputIterator -> Vector_3.
double sharpness_angle, ///< control sharpness(0-90)
double edge_senstivity, ///< edge senstivity(0-5)
double neighbor_radius, ///< initial size of neighbors.
const unsigned int number_of_output_points,///< number of iterations.
const Kernel& kernel) ///< geometric traits.
{
// just deduce value_type of OutputIterator
return edge_aware_upsample_point_set
<typename value_type_traits<OutputIterator>::type>(
first, beyond,
output,
point_pmap,
normal_pmap,
sharpness_angle,
edge_senstivity,
neighbor_radius,
number_of_output_points,
kernel);
}
/// @endcond
/// @cond SKIP_IN_MANUAL
// This variant deduces the kernel from the point property map.
template <typename OutputIteratorValueType,
typename OutputIterator,
template <typename OutputIterator,
typename ForwardIterator,
typename PointPMap,
typename NormalPMap>
void
OutputIterator
edge_aware_upsample_point_set(
ForwardIterator first, ///< iterator over the first input point
ForwardIterator beyond, ///< past-the-end iterator
ForwardIterator first, ///< forward iterator to the first input point.
ForwardIterator beyond, ///< past-the-end iterator.
OutputIterator output, ///< output iterator over points.
PointPMap point_pmap, ///< property map: OutputIterator -> Point_3.
NormalPMap normal_pmap, ///< property map: OutputIterator -> Vector_3.
PointPMap point_pmap, ///< property map: `ForwardIterator` -> Point_3.
NormalPMap normal_pmap, ///< property map: `ForwardIterator` -> Vector_3.
double sharpness_angle, ///< control sharpness(0-90)
double edge_senstivity, ///< edge senstivity(0-5)
double edge_sensitivity, ///< edge senstivity(0-5)
double neighbor_radius, ///< initial size of neighbors.
const unsigned int number_of_output_points///< number of iterations.
)
{
typedef typename boost::property_traits<PointPMap>::value_type Point;
typedef typename Kernel_traits<Point>::Kernel Kernel;
return edge_aware_upsample_point_set
<OutputIteratorValueType>(
return edge_aware_upsample_point_set(
first, beyond,
output,
point_pmap,
normal_pmap,
sharpness_angle,
edge_senstivity,
edge_sensitivity,
neighbor_radius,
number_of_output_points,
Kernel());
@ -627,97 +582,27 @@ edge_aware_upsample_point_set(
/// @cond SKIP_IN_MANUAL
template <typename OutputIterator,
typename ForwardIterator,
typename PointPMap,
typename NormalPMap>
void
edge_aware_upsample_point_set(
ForwardIterator first, ///< iterator over the first input point
ForwardIterator beyond, ///< past-the-end iterator
OutputIterator output, ///< output iterator over points.
PointPMap point_pmap, ///< property map: OutputIterator -> Point_3.
NormalPMap normal_pmap, ///< property map: OutputIterator -> Vector_3.
double sharpness_angle, ///< control sharpness(0-90)
double edge_senstivity, ///< edge senstivity(0-5)
double neighbor_radius, ///< initial size of neighbors.
const unsigned int number_of_output_points///< number of iterations.
)
{
// just deduce value_type of OutputIterator
return edge_aware_upsample_point_set
<typename value_type_traits<OutputIterator>::type>(// not sure
first, beyond,
output,
point_pmap,
normal_pmap,
sharpness_angle,
edge_senstivity,
neighbor_radius,
number_of_output_points);
}
/// @endcond
/// @cond SKIP_IN_MANUAL
// This variant creates a default point property map = Identity_property_map.
template <typename OutputIteratorValueType,
typename OutputIterator,
typename ForwardIterator,
typename NormalPMap>
void
edge_aware_upsample_point_set(
ForwardIterator first, ///< iterator over the first input point
ForwardIterator beyond, ///< past-the-end iterator
OutputIterator output, ///< output iterator over points.
NormalPMap normal_pmap,///< property map: OutputIterator->Vector_3.
double sharpness_angle, ///< control sharpness(0-90)
double edge_senstivity, ///< edge senstivity(0-5)
double neighbor_radius, ///< initial size of neighbors.
const unsigned int number_of_output_points///< number of iterations.
)
{
return edge_aware_upsample_point_set
<OutputIteratorValueType>(
first, beyond,
output,
#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
make_dereference_property_map(output),
#else
make_identity_property_map(OutputIteratorValueType()),
#endif
normal_pmap,
sharpness_angle,
edge_senstivity,
neighbor_radius,
number_of_output_points);
}
/// @endcond
/// @cond SKIP_IN_MANUAL
template <typename OutputIteratorValueType,
typename OutputIterator,
typename ForwardIterator,
typename NormalPMap>
bool
OutputIterator
edge_aware_upsample_point_set(
ForwardIterator first, ///< iterator over the first input point
ForwardIterator beyond, ///< past-the-end iterator
OutputIterator output, ///< output iterator over points.
NormalPMap normal_pmap, ///< property map: OutputIterator -> Vector_3.
double sharpness_angle, ///< control sharpness(0-90)
double edge_senstivity, ///< edge senstivity(0-5)
double edge_sensitivity, ///< edge senstivity(0-5)
double neighbor_radius, ///< initial size of neighbors.
const unsigned int number_of_output_points///< number of iterations.
)
{
// just deduce value_type of OutputIterator
return upsample_point_set
return edge_aware_upsample_point_set
<typename value_type_traits<OutputIterator>::type>(
first, beyond,
output,
normal_pmap,
sharpness_angle,
edge_senstivity,
edge_sensitivity,
neighbor_radius,
number_of_output_points);
}

View File

@ -304,55 +304,50 @@ compute_density_weight_for_sample_point(
/// dense point cloud.
/// The core of the algorithm is a Weighted Locally Optimal projection operator
/// with a density uniformization term.
/// For more details, please refer to this paper: \cgalCite{WLOP2009}.
/// For more details, please refer to \cgalCite{wlop-2009}.
/// @tparam Concurrency_tag enables sequential versus parallel algorithm.
/// Possible values are `Sequential_tag`
/// and `Parallel_tag`.
/// @tparam OutputIteratorValueType type of objects that in `OutputIterator`.
/// It is default to `value_type_traits<OutputIterator>::%type`
/// and can be omitted when the default is fine.
/// @tparam OutputIterator iterator over output points.
/// @tparam RandomAccessIterator iterator over input points.
/// @tparam PointPMapIn is a model of `WritablePropertyMap`
/// with a value_type = Point_3<Kernel>.
/// @tparam OutputIterator Type of the output iterator.
/// The type of the objects is `Kernel::Point_3`.
/// @tparam RandomAccessIterator Iterator over input points.
/// @tparam PointPMap is a model of `ReadablePropertyMap`
/// with a value_type = `Kernel::Point_3`.
/// It can be omitted if RandomAccessIterator value_type is convertible
/// to Point_3<Kernel>.
/// @tparam PointPMapOut counterpart of PointPMapIn.
/// to `Kernel::Point_3`.
/// @tparam Kernel Geometric traits class.
/// It can be omitted and deduced automatically from PointPMap value_type.
/// Kernel_traits are used for deducing the Kernel.
/// It can be omitted and deduced automatically from PointPMap's value_type.
/// `Kernel_traits` are used for deducing the kernel.
// This variant requires all parameters.
template <typename Concurrency_tag,
typename OutputIteratorValueType,
typename OutputIterator,
typename RandomAccessIterator,
typename PointPMapIn,
typename PointPMapOut,
typename PointPMap,
typename Kernel>
void
OutputIterator
wlop_simplify_and_regularize_point_set(
RandomAccessIterator first, ///< iterator over the first input point.
RandomAccessIterator beyond, ///< past-the-end iterator over the input points.
OutputIterator output, ///< add back-inserter
PointPMapIn point_pmap_input, ///< property map: value_type of
///< RandomAccessIterator -> Point_3
PointPMapOut point_pmap_output, ///< property map: value_type of
///< OutputIterator -> Point_3
RandomAccessIterator first, ///< random-access iterator to the first input point.
RandomAccessIterator beyond, ///< past-the-end iterator.
OutputIterator output, ///< output iterator where output points are put.
PointPMap point_pmap, ///< property map: value_type of
///< `RandomAccessIterator` -> `Kernel::Point_3`
double select_percentage, ///< percentage of points to retain.
///< Default: 5%.
///< %Default: 5\%.
double radius, ///< neighbors radius.
///< key parameter that need to be fine tune.
///< key parameter that needs to be finely tuned.
///< The result will be irregular if this value is too small.
///< The process will be slow, and the result will be
///< too smooth if this value is too big.
///< Usually, a radius that containing "4 rings" of
///< Usually, a radius containing the "4 ring" of
///< neighbor points is a good start.
///< Default: 0.05 * diameter of bounding box.
unsigned int iter_number, ///< number of iterations. Default: 35.
///< the more iterations, the more regular the result will be.
bool require_uniform_sampling,///< an optional preprocessing, turn it on if the distribution
///< of input is highly nonuniform. Default: false.
///< %Default: 0.05 * diameter of bounding box.
unsigned int iter_number, ///< number of iterations. %Default: 35.
///< More iterations give a more regular result.
bool require_uniform_sampling,///< an optional preprocessing, which should be
///< turned on if the distribution
///< of the input points is highly nonuniform.
///< %Default: false.
const Kernel& ///< geometric traits.
)
{
@ -398,9 +393,9 @@ wlop_simplify_and_regularize_point_set(
for(it = first_sample_iter; it != beyond; ++it)
{
#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
sample_points.push_back(get(point_pmap_input, it));
sample_points.push_back(get(point_pmap, it));
#else
sample_points.push_back(get(point_pmap_input, *it));
sample_points.push_back(get(point_pmap, *it));
#endif
}
@ -411,9 +406,9 @@ wlop_simplify_and_regularize_point_set(
for (RandomAccessIterator temp = first; temp != beyond; ++temp)
{
#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
Point original_p = get(point_pmap_input, temp);
Point original_p = get(point_pmap, temp);
#else
Point original_p = get(point_pmap_input, *temp);
Point original_p = get(point_pmap, *temp);
#endif
bbox += original_p.bbox();
}
@ -456,9 +451,9 @@ wlop_simplify_and_regularize_point_set(
compute_density_weight_for_original_point<Kernel, AABB_Tree>
(
#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
get(point_pmap_input, cur),
get(point_pmap, cur),
#else
get(point_pmap_input, *cur),
get(point_pmap, *cur),
#endif
orignal_aabb_tree,
radius2);
@ -476,9 +471,9 @@ wlop_simplify_and_regularize_point_set(
compute_density_weight_for_original_point<Kernel, AABB_Tree>
(
#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
get(point_pmap_input, it),
get(point_pmap, it),
#else
get(point_pmap_input, *it),
get(point_pmap, *it),
#endif
orignal_aabb_tree,
radius2);
@ -574,24 +569,21 @@ wlop_simplify_and_regularize_point_set(
*output++ = *sample_iter;
}
return;
return output;
}
/// @cond SKIP_IN_MANUAL
// This variant deduces the kernel from the iterator type.
template <typename Concurrency_tag,
typename OutputIteratorValueType,
typename OutputIterator,
typename RandomAccessIterator,
typename PointPMapIn,
typename PointPMapOut>
void
typename PointPMap>
OutputIterator
wlop_simplify_and_regularize_point_set(
RandomAccessIterator first, ///< iterator over the first input point
RandomAccessIterator beyond, ///< past-the-end iterator
OutputIterator output, ///< add back-inserter
PointPMapIn point_pmap_input, ///< property map RandomAccessIterator -> Point_3
PointPMapOut point_pmap_output, ///< property map OutputIterator
PointPMap point_pmap, ///< property map RandomAccessIterator -> Point_3
const double select_percentage, ///< percentage of points to retain
double neighbor_radius, ///< size of neighbors.
const unsigned int max_iter_number, ///< number of iterations.
@ -599,14 +591,13 @@ wlop_simplify_and_regularize_point_set(
/// to generate more rugularized result.
)
{
typedef typename boost::property_traits<PointPMapIn>::value_type Point;
typedef typename boost::property_traits<PointPMap>::value_type Point;
typedef typename Kernel_traits<Point>::Kernel Kernel;
typedef typename value_type_traits<OutputIterator>::type OutputIteratorType;
return wlop_simplify_and_regularize_point_set
<Concurrency_tag, OutputIteratorType>(
return wlop_simplify_and_regularize_point_set<Concurrency_tag>(
first, beyond,
output,
point_pmap_input,
point_pmap,
point_pmap_output,
select_percentage,
neighbor_radius,
@ -618,17 +609,16 @@ wlop_simplify_and_regularize_point_set(
/// @cond SKIP_IN_MANUAL
/// This variant creates a default point property map=Dereference_property_map.
template <typename Concurrency_tag,
typename OutputIteratorValueType,
template <typename Concurrency_tag,
typename OutputIterator,
typename RandomAccessIterator,
typename PointPMap>
void
OutputIterator
wlop_simplify_and_regularize_point_set(
RandomAccessIterator first, ///< iterator over the first input point
RandomAccessIterator beyond, ///< past-the-end iterator
OutputIterator output, ///< add back-inserter
PointPMap point_pmap_input, ///< property map RandomAccessIterator -> Point_3
RandomAccessIterator first, ///< forward iterator to the first input point.
RandomAccessIterator beyond, ///< past-the-end iterator.
OutputIterator output, ///< add back-inserter
PointPMap point_pmap, ///< property map RandomAccessIterator -> Point_3
const double select_percentage = 5, ///< percentage of points to retain
double neighbor_radius = -1, ///< size of neighbors.
const unsigned int max_iter_number = 35, ///< number of iterations.
@ -637,15 +627,10 @@ wlop_simplify_and_regularize_point_set(
)
{
return wlop_simplify_and_regularize_point_set
<Concurrency_tag, OutputIteratorValueType>(
<Concurrency_tag>(
first, beyond,
output,
point_pmap_input,
#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
make_dereference_property_map(output),
#else
make_identity_property_map(OutputIteratorValueType()),
#endif
point_pmap,
select_percentage,
neighbor_radius,
max_iter_number,
@ -659,11 +644,11 @@ wlop_simplify_and_regularize_point_set(
template <typename Concurrency_tag,
typename OutputIterator,
typename RandomAccessIterator >
void
OutputIterator
wlop_simplify_and_regularize_point_set(
RandomAccessIterator first, ///< iterator over the first input point
RandomAccessIterator beyond, ///< past-the-end iterator
OutputIterator output, ///< add back-inserter
RandomAccessIterator first, ///< iterator to the first input point.
RandomAccessIterator beyond, ///< past-the-end iterator.
OutputIterator output, ///< add back-inserter.
const double select_percentage = 5, ///< percentage of points to retain
double neighbor_radius = -1, ///< size of neighbors.
const unsigned int max_iter_number = 35, ///< number of iterations.
@ -671,9 +656,7 @@ wlop_simplify_and_regularize_point_set(
///to generate a more uniform result.
)
{
typedef typename value_type_traits<OutputIterator>::type OutputIteratorType;
return wlop_simplify_and_regularize_point_set
<Concurrency_tag, OutputIteratorType>(
return wlop_simplify_and_regularize_point_set<Concurrency_tag>(
first, beyond,
output,
#ifdef CGAL_USE_PROPERTY_MAPS_API_V1