diff --git a/Installation/changes.html b/Installation/changes.html
index 7c686d9919c..f1a18da224a 100755
--- a/Installation/changes.html
+++ b/Installation/changes.html
@@ -160,6 +160,17 @@ David A. Wheeler's 'SLOCCount', restricted to the include/CGAL/
an operator to accept and dispatch a tuple of values.
+
+
CGAL and Boost Property Maps
+
+ - The
key_type of the property maps provided by CGAL used to be an iterator. In order to be more easily re-used,
+ the key_type has been changed to be the value_type of the iterator.
+ The packages that have been updated to match these changes are Point Set Processing and Surface Reconstruction from Point Sets.
+ However, for most users this change should be transparent if the default property maps were used.
+ For convenience, the former behavior can be enabled by defining the macro CGAL_USE_PROPERTY_MAPS_API_V1.
+
+
+
Release 4.2
diff --git a/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt b/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt
index fb3fb5f0210..468ec744e2f 100644
--- a/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt
+++ b/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt
@@ -61,11 +61,11 @@ The following classes described in Chapter \ref chapterProperty_map
provide property maps for the implementations of points with normals
listed above:
-- `Dereference_property_map`
+- `Identity_property_map`
- `First_of_pair_property_map` and `Second_of_pair_property_map`
- `Nth_of_tuple_property_map`
-`Dereference_property_map` is the default value of the
+`Identity_property_map` is the default value of the
position property map expected by all functions in this component.
See below examples using pair and tuple property maps.
@@ -128,7 +128,7 @@ input points in increasing order of average squared distances to their
\subsection Point_set_processing_3Example_2 Example
The following example reads a point set and removes 5% of the
-points. It uses the `Dereference_property_map` property
+points. It uses the `Identity_property_map` property
map (optional as it is the default position property map of all
functions in this component.)
\cgalExample{Point_set_processing_3/remove_outliers_example.cpp}
diff --git a/Point_set_processing_3/doc/Property_map/Property_map.txt b/Point_set_processing_3/doc/Property_map/Property_map.txt
index 876c71a58c3..1e97f9a5a85 100644
--- a/Point_set_processing_3/doc/Property_map/Property_map.txt
+++ b/Point_set_processing_3/doc/Property_map/Property_map.txt
@@ -35,15 +35,14 @@ or as a `boost::tuple<..,Point_3, ..., Vector_3 >`.
This component provides property maps to support these cases:
-`Dereference_property_map`
+- `Identity_property_map`
+- `First_of_pair_property_map` and `Second_of_pair_property_map`
+- `Nth_of_tuple_property_map`
+- `Dereference_property_map`
-`First_of_pair_property_map` and `Second_of_pair_property_map`
+\subsection Property_mapExamplewithIdentity Example with Identity_property_map
-`Nth_of_tuple_property_map`
-
-\subsection Property_mapExamplewithDereferencepropertymap Example with Dereference_property_map
-
-The following example reads a point set and removes 5% of the points. It uses `Dereference_property_map` as position property map.
+The following example reads a point set and removes 5% of the points. It uses `Identity_property_map` as position property map.
\cgalExample{Point_set_processing_3/remove_outliers_example.cpp}
\subsection Property_mapExamplewithPairs Example with Pairs
diff --git a/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp
index fd2c681e7e2..3fba6dc804d 100644
--- a/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp
+++ b/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp
@@ -47,9 +47,9 @@ int main(void)
// Computes average spacing.
const unsigned int nb_neighbors = 6; // 1 ring
FT average_spacing = CGAL::compute_average_spacing(
- points.begin(), points.end(),
- CGAL::Nth_of_tuple_property_map<1,IndexedPointWithColorTuple>(),
- nb_neighbors);
+ points.begin(), points.end(),
+ CGAL::Nth_of_tuple_property_map<1,IndexedPointWithColorTuple>(),
+ nb_neighbors);
std::cout << "Average spacing: " << average_spacing << std::endl;
return EXIT_SUCCESS;
diff --git a/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp b/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp
index 556d56e994d..78ae3802532 100644
--- a/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp
+++ b/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp
@@ -8,6 +8,8 @@
#include
#include
+#include
+
#include
#include
#include
@@ -42,7 +44,7 @@ struct MyLess {
bool operator()(const T& t0, const T& t1) const
{
- return get(pmap, &t0) < get(pmap, &t1);
+ return get(pmap, t0) < get(pmap, t1);
}
};
@@ -64,7 +66,10 @@ void process_point_set(Iterator beg, Iterator end, PointPMap pmap)
template
void process_point_set(Iterator beg, Iterator end)
{
- process_point_set(beg,end, CGAL::make_dereference_property_map(beg));
+ process_point_set(beg,end,
+ CGAL::make_identity_property_map(
+ typename CGAL::value_type_traits::type())
+ );
}
@@ -75,13 +80,11 @@ template
void orient_normals(Iterator beg, Iterator end, OrientationPMap orient_pmap, NormalPMap normal_pmap)
{
for(;beg!= end;++beg){
- Vector_3& v = get(normal_pmap, beg);
-
- boost::put(orient_pmap, beg, (v == CGAL::NULL_VECTOR));
+ const Vector_3& v = get(normal_pmap, *beg);
+ put(orient_pmap, *beg, (v == CGAL::NULL_VECTOR));
if(v.x() < 0){
- v = -v;
- boost::put(normal_pmap, beg, v);
+ put(normal_pmap,*beg, -v);
}
}
}
@@ -95,7 +98,7 @@ int main()
// Here we run it on plain points. No need for a property map
{
std::vector points;
-
+
process_point_set(points.begin(), points.end());
}
@@ -108,11 +111,11 @@ int main()
for(int i = 0; i < 10; i++){
points.push_back(std::make_pair(Point_3(9-i,0,0), Vector_3(i,0,0)));
}
-
+
process_point_set(points.begin(),
points.end(),
CGAL::First_of_pair_property_map());
-
+
for(int i = 0; i < 10; i++){
std::cout << points[i].first << "\t" << points[i].second << std::endl;
}
@@ -131,11 +134,11 @@ int main()
double x = (i%2)?i:-i;
points.push_back(boost::make_tuple(i,Point_3(9-i,0,0), false, Vector_3(x,0,0)));
}
-
+
process_point_set(points.begin(),
points.end(),
CGAL::Nth_of_tuple_property_map<1,IndexedPointWithOrientableNormalTuple>());
-
+
std::cout << boost::tuples::set_open('[') << boost::tuples::set_close(']') << boost::tuples::set_delimiter(',');
for(int i = 0; i < 10; i++){
@@ -145,14 +148,13 @@ int main()
//We keep the sequence in order, but determine the normal and if it is different from zero set the Boolean to true
orient_normals(points.begin(),
points.end(),
- CGAL::make_nth_of_tuple_property_map<2>(points.begin()),
- CGAL::make_nth_of_tuple_property_map<3>(points.begin()));
-
+ CGAL::make_nth_of_tuple_property_map<2>(IndexedPointWithOrientableNormalTuple()),
+ CGAL::make_nth_of_tuple_property_map<3>(IndexedPointWithOrientableNormalTuple()));
+
std::cout << "\nAfter orient_normals\n";
for(int i = 0; i < 10; i++){
std::cout << points[i] << std::endl;
}
}
-
return 0;
}
diff --git a/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp
index 4e8fc2a53c9..778e134d61f 100644
--- a/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp
+++ b/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp
@@ -13,29 +13,28 @@ typedef Kernel::Point_3 Point;
int main(void)
{
// Reads a .xyz point set file in points[].
- // The Dereference_property_map property map can be omitted here as it is the default value.
+ // The Identity_property_map property map can be omitted here as it is the default value.
std::vector points;
std::ifstream stream("data/oni.xyz");
if (!stream ||
!CGAL::read_xyz_points(stream, std::back_inserter(points),
- CGAL::Dereference_property_map()))
+ CGAL::Identity_property_map()))
{
std::cerr << "Error: cannot read file data/oni.xyz" << std::endl;
return EXIT_FAILURE;
}
// Removes outliers using erase-remove idiom.
- // The Dereference_property_map property map can be omitted here as it is the default value.
+ // The Identity_property_map property map can be omitted here as it is the default value.
const double removed_percentage = 5.0; // percentage of points to remove
const int nb_neighbors = 24; // considers 24 nearest neighbor points
points.erase(CGAL::remove_outliers(points.begin(), points.end(),
- CGAL::Dereference_property_map(),
- nb_neighbors, removed_percentage),
+ CGAL::Identity_property_map(),
+ nb_neighbors, removed_percentage),
points.end());
// Optional: after erase(), use Scott Meyer's "swap trick" to trim excess capacity
std::vector(points).swap(points);
return EXIT_SUCCESS;
-}
-
+}
\ No newline at end of file
diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h
index e84bed076f2..8957cbe2360 100644
--- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h
+++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h
@@ -45,6 +45,8 @@ namespace CGAL {
/// optionally followed by the nx ny nz normal.
/// Faces are ignored.
///
+/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
+/// It is default to `value_type_traits::type` and can be omitted when the default is fine.
/// @tparam OutputIterator iterator over output points.
/// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3.
/// It can be omitted if OutputIterator value_type is convertible to Point_3.
@@ -55,21 +57,24 @@ namespace CGAL {
/// @return true on success.
// This variant requires all parameters.
-template
bool
read_off_points_and_normals(
- std::istream& stream, ///< input stream.
- OutputIterator output, ///< output iterator over points.
- PointPMap point_pmap, ///< property map OutputIterator -> Point_3.
- NormalPMap normal_pmap, ///< property map OutputIterator -> Vector_3.
- const Kernel& /*kernel*/) ///< geometric traits.
+ std::istream& stream, ///< input stream.
+ OutputIterator output, ///< output iterator over points.
+ PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+ NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
+ const Kernel& /*kernel*/) ///< geometric traits.
{
// value_type_traits is a workaround as back_insert_iterator's value_type is void
- typedef typename value_type_traits::type Enriched_point;
+ // typedef typename value_type_traits::type Enriched_point;
+ typedef OutputIteratorValueType Enriched_point;
typedef typename Kernel::Point_3 Point;
typedef typename Kernel::Vector_3 Vector;
@@ -127,18 +132,23 @@ read_off_points_and_normals(
Vector normal = CGAL::NULL_VECTOR;
// ... + normal...
if (iss >> nx)
- {
- // In case we could read one number, we expect that there are two more
- if(iss >> ny >> nz){
- normal = Vector(nx,ny,nz);
- } else {
- std::cerr << "Error line " << lineNumber << " of file" << std::endl;
- return false;
- }
+ {
+ // In case we could read one number, we expect that there are two more
+ if(iss >> ny >> nz){
+ normal = Vector(nx,ny,nz);
+ } else {
+ std::cerr << "Error line " << lineNumber << " of file" << std::endl;
+ return false;
}
+ }
Enriched_point 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;
pointsRead++;
}
@@ -150,8 +160,58 @@ read_off_points_and_normals(
return true;
}
+/// @cond SKIP_IN_MANUAL
+template
+bool
+read_off_points_and_normals(
+ std::istream& stream, ///< input stream.
+ OutputIterator output, ///< output iterator over points.
+ PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+ NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
+ const Kernel& kernel) ///< geometric traits.
+{
+ // just deduce value_type of OutputIterator
+ return read_off_points_and_normals
+ ::type>(
+ stream,
+ output,
+ point_pmap,
+ normal_pmap,
+ kernel);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
/// @cond SKIP_IN_MANUAL
// This variant deduces the kernel from the point property map.
+//-----------------------------------------------------------------------------------
+template
+bool
+read_off_points_and_normals(
+ std::istream& stream, ///< input stream.
+ OutputIterator output, ///< output iterator over points.
+ PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+ NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+ typedef typename boost::property_traits::value_type Point;
+ typedef typename Kernel_traits::Kernel Kernel;
+ return read_off_points_and_normals
+ (
+ stream,
+ output,
+ point_pmap,
+ normal_pmap,
+ Kernel());
+}
+
template Point_3.
- NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3.
+ PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+ NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
{
- typedef typename boost::property_traits::value_type Point;
- typedef typename Kernel_traits::Kernel Kernel;
- return read_off_points_and_normals(
+ // just deduce value_type of OutputIterator
+ return read_off_points_and_normals
+ ::type>(
stream,
output,
point_pmap,
- normal_pmap,
- Kernel());
+ normal_pmap);
}
+//-----------------------------------------------------------------------------------
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
+//-----------------------------------------------------------------------------------
+template
+bool
+read_off_points_and_normals(
+ std::istream& stream, ///< input stream.
+ OutputIterator output, ///< output iterator over points.
+ NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+ return read_off_points_and_normals
+ (
+ stream,
+ output,
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ make_dereference_property_map(output),
+#else
+ make_identity_property_map(OutputIteratorValueType()),
+#endif
+ normal_pmap);
+}
+
template
@@ -183,14 +266,16 @@ bool
read_off_points_and_normals(
std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points.
- NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3.
+ NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
{
- return read_off_points_and_normals(
+ // just deduce value_type of OutputIterator
+ return read_off_points_and_normals
+ ::type>(
stream,
output,
- make_dereference_property_map(output),
normal_pmap);
}
+//-----------------------------------------------------------------------------------
/// @endcond
@@ -201,6 +286,8 @@ read_off_points_and_normals(
/// If the position is followed by the nx ny nz normal, then the normal will be ignored.
/// Faces are ignored.
///
+/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
+/// It is default to `value_type_traits::type` and can be omitted when the default is fine.
/// @tparam OutputIterator iterator over output points.
/// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3.
/// It can be omitted if OutputIterator value_type is convertible to Point_3.
@@ -210,7 +297,9 @@ read_off_points_and_normals(
/// @return true on success.
// This variant requires all parameters.
-template
@@ -218,11 +307,12 @@ bool
read_off_points(
std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points.
- PointPMap point_pmap, ///< property map OutputIterator -> Point_3.
+ PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
const Kernel& kernel) ///< geometric traits.
{
// Calls read_off_points_and_normals() with a normal property map = boost::dummy_property_map
- return read_off_points_and_normals(
+ return read_off_points_and_normals
+ (
stream,
output,
point_pmap,
@@ -230,8 +320,52 @@ read_off_points(
kernel);
}
+/// @cond SKIP_IN_MANUAL
+template
+bool
+read_off_points(
+ std::istream& stream, ///< input stream.
+ OutputIterator output, ///< output iterator over points.
+ PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+ const Kernel& kernel) ///< geometric traits.
+{
+ // just deduce value_type of OutputIterator
+ return read_off_points
+ ::type>(
+ stream,
+ output,
+ point_pmap,
+ kernel);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
/// @cond SKIP_IN_MANUAL
// This variant deduces the kernel from the point property map.
+//-----------------------------------------------------------------------------------
+template
+bool
+read_off_points(
+ std::istream& stream, ///< input stream.
+ OutputIterator output, ///< output iterator over points.
+ PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
+{
+ typedef typename boost::property_traits::value_type Point;
+ typedef typename Kernel_traits::Kernel Kernel;
+ return read_off_points
+ (
+ stream,
+ output,
+ point_pmap,
+ Kernel());
+}
+
template
@@ -239,20 +373,41 @@ bool
read_off_points(
std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points.
- PointPMap point_pmap) ///< property map OutputIterator -> Point_3.
+ PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
{
- typedef typename boost::property_traits::value_type Point;
- typedef typename Kernel_traits::Kernel Kernel;
- return read_off_points(
+ // just deduce value_type of OutputIterator
+ return read_off_points
+ ::type>(
stream,
output,
- point_pmap,
- Kernel());
+ point_pmap);
}
+//-----------------------------------------------------------------------------------
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
+//-----------------------------------------------------------------------------------
+template
+bool
+read_off_points(
+ std::istream& stream, ///< input stream.
+ OutputIterator output) ///< output iterator over points.
+{
+ return read_off_points
+ (
+ stream,
+ output,
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ make_dereference_property_map(output)
+#else
+ make_identity_property_map(OutputIteratorValueType())
+#endif
+ );
+}
+
template
bool
@@ -260,11 +415,14 @@ read_off_points(
std::istream& stream, ///< input stream.
OutputIterator output) ///< output iterator over points.
{
- return read_off_points(
+ // just deduce value_type of OutputIterator
+ return read_off_points
+ ::type>(
stream,
- output,
- make_dereference_property_map(output));
+ output);
}
+//-----------------------------------------------------------------------------------
+
/// @endcond
diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h
index 97b23b95faa..02ff8287ca1 100644
--- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h
+++ b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h
@@ -46,6 +46,8 @@ namespace CGAL {
/// The first line may contain the number of points in the file.
/// Empty lines and comments starting by # character are allowed.
///
+/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
+/// It is default to `value_type_traits::type` and can be omitted when the default is fine.
/// @tparam OutputIterator iterator over output points.
/// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3.
/// It can be omitted if OutputIterator value_type is convertible to Point_3.
@@ -56,7 +58,9 @@ namespace CGAL {
/// @return true on success.
// This variant requires all parameters.
-template Point_3.
- NormalPMap normal_pmap, ///< property map OutputIterator -> Vector_3.
+ PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+ NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
const Kernel& /*kernel*/) ///< geometric traits.
{
// value_type_traits is a workaround as back_insert_iterator's value_type is void
- typedef typename value_type_traits::type Enriched_point;
+ //typedef typename value_type_traits::type Enriched_point;
+ typedef OutputIteratorValueType Enriched_point;
typedef typename Kernel::Point_3 Point;
typedef typename Kernel::Vector_3 Vector;
@@ -124,8 +129,13 @@ read_xyz_points_and_normals(
}
}
Enriched_point 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;
continue;
}
@@ -146,8 +156,58 @@ read_xyz_points_and_normals(
return true;
}
+/// @cond SKIP_IN_MANUAL
+template
+bool
+read_xyz_points_and_normals(
+ std::istream& stream, ///< input stream.
+ OutputIterator output, ///< output iterator over points.
+ PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+ NormalPMap normal_pmap, ///< property map: value_type of OutputIterator -> Vector_3.
+ const Kernel& kernel) ///< geometric traits.
+{
+ // just deduce value_type of OutputIterator
+ return read_xyz_points_and_normals
+ ::type>(
+ stream,
+ output,
+ point_pmap,
+ normal_pmap,
+ kernel);
+}
+//-----------------------------------------------------------------------------------
+/// @endcond
+
/// @cond SKIP_IN_MANUAL
// This variant deduces the kernel from the point property map.
+//-----------------------------------------------------------------------------------
+template
+bool
+read_xyz_points_and_normals(
+ std::istream& stream, ///< input stream.
+ OutputIterator output, ///< output iterator over points.
+ PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+ NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+ typedef typename boost::property_traits::value_type Point;
+ typedef typename Kernel_traits::Kernel Kernel;
+ return read_xyz_points_and_normals
+ (
+ stream,
+ output,
+ point_pmap,
+ normal_pmap,
+ Kernel());
+}
+
template Point_3.
- NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3.
+ PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+ NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
{
- typedef typename boost::property_traits::value_type Point;
- typedef typename Kernel_traits::Kernel Kernel;
- return read_xyz_points_and_normals(
+ // just deduce value_type of OutputIterator
+ return read_xyz_points_and_normals
+ ::type>(
stream,
output,
point_pmap,
- normal_pmap,
- Kernel());
+ normal_pmap);
}
+//-----------------------------------------------------------------------------------
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
+//-----------------------------------------------------------------------------------
+template
+bool
+read_xyz_points_and_normals(
+ std::istream& stream, ///< input stream.
+ OutputIterator output, ///< output iterator over points.
+ NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
+{
+ return read_xyz_points_and_normals
+ (
+ stream,
+ output,
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ make_dereference_property_map(output),
+#else
+ make_identity_property_map(OutputIteratorValueType()),
+#endif
+ normal_pmap);
+}
+
template
@@ -179,14 +262,16 @@ bool
read_xyz_points_and_normals(
std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points.
- NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3.
+ NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
{
- return read_xyz_points_and_normals(
+ // just deduce value_type of OutputIterator
+ return read_xyz_points_and_normals
+ ::type>(
stream,
output,
- make_dereference_property_map(output),
normal_pmap);
}
+//-----------------------------------------------------------------------------------
/// @endcond
@@ -198,6 +283,8 @@ read_xyz_points_and_normals(
/// The first line may contain the number of points in the file.
/// Empty lines and comments starting by # character are allowed.
///
+/// @tparam OutputIteratorValueType type of objects that can be put in `OutputIterator`.
+/// It is default to `value_type_traits::type` and can be omitted when the default is fine.
/// @tparam OutputIterator iterator over output points.
/// @tparam PointPMap is a model of `WritablePropertyMap` with a value_type = Point_3.
/// It can be omitted if OutputIterator value_type is convertible to Point_3.
@@ -207,7 +294,9 @@ read_xyz_points_and_normals(
/// @return true on success.
// This variant requires all parameters.
-template
@@ -215,11 +304,12 @@ bool
read_xyz_points(
std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points.
- PointPMap point_pmap, ///< property map OutputIterator -> Point_3.
+ PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
const Kernel& kernel) ///< geometric traits.
{
// Calls read_xyz_points_and_normals() with a normal property map = boost::dummy_property_map
- return read_xyz_points_and_normals(
+ return read_xyz_points_and_normals
+ (
stream,
output,
point_pmap,
@@ -227,8 +317,52 @@ read_xyz_points(
kernel);
}
+/// @cond SKIP_IN_MANUAL
+template
+bool
+read_xyz_points(
+ std::istream& stream, ///< input stream.
+ OutputIterator output, ///< output iterator over points.
+ PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+ const Kernel& kernel) ///< geometric traits.
+{
+ // just deduce value_type of OutputIterator
+ return read_xyz_points
+ ::type>(
+ stream,
+ output,
+ point_pmap,
+ kernel);
+}
+/// @endcond
+//-----------------------------------------------------------------------------------
+
/// @cond SKIP_IN_MANUAL
// This variant deduces the kernel from the point property map.
+//-----------------------------------------------------------------------------------
+template
+bool
+read_xyz_points(
+ std::istream& stream, ///< input stream.
+ OutputIterator output, ///< output iterator over points.
+ PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
+{
+ typedef typename boost::property_traits::value_type Point;
+ typedef typename Kernel_traits::Kernel Kernel;
+ return read_xyz_points
+ (
+ stream,
+ output,
+ point_pmap,
+ Kernel());
+}
+
template
@@ -236,20 +370,41 @@ bool
read_xyz_points(
std::istream& stream, ///< input stream.
OutputIterator output, ///< output iterator over points.
- PointPMap point_pmap) ///< property map OutputIterator -> Point_3.
+ PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
{
- typedef typename boost::property_traits::value_type Point;
- typedef typename Kernel_traits::Kernel Kernel;
- return read_xyz_points(
+ // just deduce value_type of OutputIterator
+ return read_xyz_points
+ ::type>(
stream,
output,
- point_pmap,
- Kernel());
+ point_pmap);
}
+//-----------------------------------------------------------------------------------
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
+//-----------------------------------------------------------------------------------
+template
+bool
+read_xyz_points(
+ std::istream& stream, ///< input stream.
+ OutputIterator output) ///< output iterator over points.
+{
+ return read_xyz_points
+ (
+ stream,
+ output,
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ make_dereference_property_map(output)
+#else
+ make_identity_property_map(OutputIteratorValueType())
+#endif
+ );
+}
+
template
bool
@@ -257,11 +412,13 @@ read_xyz_points(
std::istream& stream, ///< input stream.
OutputIterator output) ///< output iterator over points.
{
- return read_xyz_points(
+ // just deduce value_type of OutputIterator
+ return read_xyz_points
+ ::type>(
stream,
- output,
- make_dereference_property_map(output));
+ output);
}
+//-----------------------------------------------------------------------------------
/// @endcond
diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h
index c2bd092ad66..d5b2c59c273 100644
--- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h
+++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h
@@ -47,7 +47,7 @@ namespace CGAL {
/// @tparam ForwardIterator iterator over input points.
/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3.
/// It can be omitted if ForwardIterator value_type is convertible to Point_3.
-/// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = Vector_3.
+/// @tparam NormalPMap is a model of `ReadablePropertyMap` with a value_type = Vector_3.
/// @tparam Kernel Geometric traits class.
/// It can be omitted and deduced automatically from PointPMap value_type.
///
@@ -64,8 +64,8 @@ write_off_points_and_normals(
std::ostream& stream, ///< output stream.
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3.
- NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3.
+ PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
+ NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
const Kernel& /*kernel*/) ///< geometric traits.
{
// basic geometric types
@@ -88,8 +88,13 @@ write_off_points_and_normals(
// Write positions + normals
for(ForwardIterator it = first; it != beyond; it++)
{
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
Point p = get(point_pmap, it);
Vector n = get(normal_pmap, it);
+#else
+ Point p = get(point_pmap, *it);
+ Vector n = get(normal_pmap, *it);
+#endif
stream << p << " " << n << std::endl;
}
@@ -107,8 +112,8 @@ write_off_points_and_normals(
std::ostream& stream, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
- PointPMap point_pmap, ///< property map OutputIterator -> Point_3.
- NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3.
+ PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+ NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
{
typedef typename boost::property_traits::value_type Point;
typedef typename Kernel_traits::Kernel Kernel;
@@ -122,7 +127,7 @@ write_off_points_and_normals(
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
template
@@ -131,12 +136,17 @@ write_off_points_and_normals(
std::ostream& stream, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
- NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3.
+ NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
{
return write_off_points_and_normals(
stream,
first, beyond,
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
make_dereference_property_map(first),
+#else
+ make_identity_property_map(
+ typename std::iterator_traits::value_type()),
+#endif
normal_pmap);
}
/// @endcond
@@ -165,7 +175,7 @@ write_off_points(
std::ostream& stream, ///< output stream.
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3.
+ PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
const Kernel& ) ///< geometric traits.
{
// basic geometric types
@@ -187,7 +197,11 @@ write_off_points(
// Write positions
for(ForwardIterator it = first; it != beyond; it++)
{
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
Point p = get(point_pmap, it);
+#else
+ Point p = get(point_pmap, *it);
+#endif
stream << p << std::endl;
}
@@ -204,7 +218,7 @@ write_off_points(
std::ostream& stream, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
- PointPMap point_pmap) ///< property map OutputIterator -> Point_3.
+ PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
{
typedef typename boost::property_traits::value_type Point;
typedef typename Kernel_traits::Kernel Kernel;
@@ -217,7 +231,7 @@ write_off_points(
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
template
bool
@@ -229,7 +243,13 @@ write_off_points(
return write_off_points(
stream,
first, beyond,
- make_dereference_property_map(first));
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ make_dereference_property_map(first)
+#else
+ make_identity_property_map(
+ typename std::iterator_traits::value_type())
+#endif
+ );
}
/// @endcond
diff --git a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h
index 044a520525f..d96ace8d618 100644
--- a/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h
+++ b/Point_set_processing_3/include/CGAL/IO/write_xyz_points.h
@@ -47,7 +47,7 @@ namespace CGAL {
/// @tparam ForwardIterator iterator over input points.
/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3.
/// It can be omitted if ForwardIterator value_type is convertible to Point_3.
-/// @tparam NormalPMap is a model of `WritablePropertyMap` with a value_type = Vector_3.
+/// @tparam NormalPMap is a model of `ReadablePropertyMap` with a value_type = Vector_3.
/// @tparam Kernel Geometric traits class.
/// It can be omitted and deduced automatically from PointPMap value_type.
///
@@ -64,8 +64,8 @@ write_xyz_points_and_normals(
std::ostream& stream, ///< output stream.
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3.
- NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3.
+ PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
+ NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
const Kernel& /*kernel*/) ///< geometric traits.
{
// basic geometric types
@@ -83,8 +83,13 @@ write_xyz_points_and_normals(
// Write positions + normals
for(ForwardIterator it = first; it != beyond; it++)
{
+ #ifdef CGAL_USE_PROPERTY_MAPS_API_V1
Point p = get(point_pmap, it);
Vector n = get(normal_pmap, it);
+ #else
+ Point p = get(point_pmap, *it);
+ Vector n = get(normal_pmap, *it);
+ #endif
stream << p << " " << n << std::endl;
}
@@ -102,8 +107,8 @@ write_xyz_points_and_normals(
std::ostream& stream, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
- PointPMap point_pmap, ///< property map OutputIterator -> Point_3.
- NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3.
+ PointPMap point_pmap, ///< property map: value_type of OutputIterator -> Point_3.
+ NormalPMap normal_pmap) ///< property map: value_type of OutputIterator -> Vector_3.
{
typedef typename boost::property_traits::value_type Point;
typedef typename Kernel_traits::Kernel Kernel;
@@ -117,7 +122,7 @@ write_xyz_points_and_normals(
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
template
@@ -126,12 +131,17 @@ write_xyz_points_and_normals(
std::ostream& stream, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
- NormalPMap normal_pmap) ///< property map OutputIterator -> Vector_3.
+ NormalPMap normal_pmap) ///< property map: value_type of ForwardIterator -> Vector_3.
{
return write_xyz_points_and_normals(
stream,
first, beyond,
- make_dereference_property_map(first),
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ make_dereference_property_map(output),
+#else
+ make_identity_property_map(
+ typename std::iterator_traits::value_type()),
+#endif
normal_pmap);
}
/// @endcond
@@ -160,7 +170,7 @@ write_xyz_points(
std::ostream& stream, ///< output stream.
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3.
+ PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
const Kernel& /*kernel*/) ///< geometric traits.
{
// basic geometric types
@@ -177,7 +187,12 @@ write_xyz_points(
// Write positions
for(ForwardIterator it = first; it != beyond; it++)
{
+ #ifdef CGAL_USE_PROPERTY_MAPS_API_V1
Point p = get(point_pmap, it);
+ #else
+ Point p = get(point_pmap, *it);
+ #endif
+
stream << p << std::endl;
}
@@ -194,7 +209,7 @@ write_xyz_points(
std::ostream& stream, ///< output stream.
ForwardIterator first, ///< first input point.
ForwardIterator beyond, ///< past-the-end input point.
- PointPMap point_pmap) ///< property map OutputIterator -> Point_3.
+ PointPMap point_pmap) ///< property map: value_type of OutputIterator -> Point_3.
{
typedef typename boost::property_traits::value_type Point;
typedef typename Kernel_traits::Kernel Kernel;
@@ -207,7 +222,7 @@ write_xyz_points(
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
template
bool
@@ -219,7 +234,13 @@ write_xyz_points(
return write_xyz_points(
stream,
first, beyond,
- make_dereference_property_map(first));
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ make_dereference_property_map(output)
+#else
+ make_identity_property_map(
+ typename std::iterator_traits::value_type())
+#endif
+ );
}
/// @endcond
diff --git a/Point_set_processing_3/include/CGAL/Point_with_normal_3.h b/Point_set_processing_3/include/CGAL/Point_with_normal_3.h
index ac30151afd3..94636bf2b3e 100644
--- a/Point_set_processing_3/include/CGAL/Point_with_normal_3.h
+++ b/Point_set_processing_3/include/CGAL/Point_with_normal_3.h
@@ -26,6 +26,8 @@
#include
#include
+#include
+
#include
#if BOOST_VERSION >= 104000
#include
@@ -126,12 +128,56 @@ private:
//=========================================================================
+#ifndef CGAL_USE_PROPERTY_MAPS_API_V1
+/// Property map that accesses the normal vector from a Point_with_normal_3 object
+///
+/// @heading Is Model for the Concepts:
+/// \cgalModels `LvaluePropertyMap`
+///
+/// @heading Parameters:
+/// @param Gt Geometric traits class.
+template
+struct Normal_of_point_with_normal_pmap
+{
+ typedef Point_with_normal_3 Point_with_normal; ///< Position + normal
+ typedef typename Gt::Vector_3 Vector; /// normal
+
+ typedef Point_with_normal key_type;
+ typedef Vector value_type;
+ typedef value_type& reference;
+ typedef boost::lvalue_property_map_tag category;
+
+ /// Access a property map element
+ reference operator[](key_type& pwn) const { return pwn.normal(); }
+
+ typedef Normal_of_point_with_normal_pmap Self;
+ /// \name Put/get free functions
+ /// @{
+ friend const value_type& get(const Self&,const key_type& k) {return k.normal();}
+ friend reference get(const Self&, key_type& k) {return k.normal();}
+ friend void put(const Self&,key_type& k, const value_type& v) {k.normal()=v;}
+ /// @};}
+};
+
+/// Free function to create a Normal_of_point_with_normal_pmap property map.
+///
+/// @relates Normal_of_point_with_normal_pmap
+
+template // Point_with_normal type
+Normal_of_point_with_normal_pmap<
+ typename CGAL::Kernel_traits::Kernel>
+ make_normal_of_point_with_normal_pmap(Point_with_normal)
+{
+ return Normal_of_point_with_normal_pmap::Kernel>();
+}
+
+#else
/// Property map that accesses the normal vector from a Point_with_normal_3* pointer
/// (or in general an iterator over Point_with_normal_3 elements).
///
/// @heading Is Model for the Concepts:
-/// Model of `LvaluePropertyMap` concept.
+/// \cgalModels `LvaluePropertyMap`
///
/// @heading Parameters:
/// @param Gt Geometric traits class.
@@ -169,6 +215,7 @@ make_normal_of_point_with_normal_pmap(Iter)
typedef typename CGAL::Kernel_traits::Kernel Kernel;
return Normal_of_point_with_normal_pmap();
}
+#endif
/// \endcond
diff --git a/Point_set_processing_3/include/CGAL/compute_average_spacing.h b/Point_set_processing_3/include/CGAL/compute_average_spacing.h
index cf4174e9eb9..39cfa485a20 100644
--- a/Point_set_processing_3/include/CGAL/compute_average_spacing.h
+++ b/Point_set_processing_3/include/CGAL/compute_average_spacing.h
@@ -114,7 +114,7 @@ typename Kernel::FT
compute_average_spacing(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map InputIterator -> Point_3
+ PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3
unsigned int k, ///< number of neighbors.
const Kernel& /*kernel*/) ///< geometric traits.
{
@@ -140,7 +140,11 @@ compute_average_spacing(
std::vector kd_tree_points;
for(InputIterator it = first; it != beyond; it++)
{
+ #ifdef CGAL_USE_PROPERTY_MAPS_API_V1
Point point = get(point_pmap, it);
+ #else
+ Point point = get(point_pmap, *it);
+ #endif
kd_tree_points.push_back(point);
}
Tree tree(kd_tree_points.begin(), kd_tree_points.end());
@@ -151,7 +155,14 @@ compute_average_spacing(
unsigned int nb_points = 0;
for(InputIterator it = first; it != beyond; it++)
{
- sum_spacings += internal::compute_average_spacing(get(point_pmap,it),tree,k);
+ sum_spacings += internal::compute_average_spacing(
+
+ #ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ get(point_pmap,it),
+ #else
+ get(point_pmap,*it),
+ #endif
+ tree,k);
nb_points++;
}
@@ -168,7 +179,7 @@ typename Kernel_traits::value_type>::
compute_average_spacing(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map InputIterator -> Point_3
+ PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3
unsigned int k) ///< number of neighbors
{
typedef typename boost::property_traits::value_type Point;
@@ -182,7 +193,7 @@ compute_average_spacing(
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
template < typename InputIterator >
typename Kernel_traits::value_type>::Kernel::FT
compute_average_spacing(
@@ -192,7 +203,12 @@ compute_average_spacing(
{
return compute_average_spacing(
first,beyond,
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
make_dereference_property_map(first),
+#else
+ make_identity_property_map(
+ typename std::iterator_traits::value_type()),
+#endif
k);
}
/// @endcond
diff --git a/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h b/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h
index c1f1e037b4a..ebd2a228e09 100644
--- a/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h
+++ b/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h
@@ -64,8 +64,13 @@ public:
typedef typename boost::property_traits::value_type Point;
// Round points to multiples of m_epsilon, then compare.
- Point a_n = get(point_pmap,&a),
- b_n = get(point_pmap,&b);
+ #ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ Point a_n = get(point_pmap,&a);
+ Point b_n = get(point_pmap,&b);
+ #else
+ Point a_n = get(point_pmap,a);
+ Point b_n = get(point_pmap,b);
+ #endif
Point rounded_a(round_epsilon(a_n.x(), m_epsilon),
round_epsilon(a_n.y(), m_epsilon),
@@ -150,7 +155,7 @@ template Point_3
+ PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
double epsilon, ///< tolerance value when merging 3D points.
const Kernel& /*kernel*/) ///< geometric traits.
{
@@ -188,7 +193,7 @@ ForwardIterator
grid_simplify_point_set(
ForwardIterator first, ///< iterator over the first input point
ForwardIterator beyond, ///< past-the-end iterator
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3
+ PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
double epsilon) ///< tolerance value when merging 3D points
{
typedef typename boost::property_traits::value_type Point;
@@ -202,7 +207,7 @@ grid_simplify_point_set(
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
template
ForwardIterator
@@ -213,7 +218,12 @@ grid_simplify_point_set(
{
return grid_simplify_point_set(
first,beyond,
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
make_dereference_property_map(first),
+#else
+ make_identity_property_map(
+ typename std::iterator_traits::value_type()),
+#endif
epsilon);
}
/// @endcond
diff --git a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h
index e6c42a3e686..a910d1e9716 100644
--- a/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h
+++ b/Point_set_processing_3/include/CGAL/improved_jet_smooth_point_set.h
@@ -205,7 +205,7 @@ improved_jet_smooth_point(
/// \pre `k >= 2`
///
/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3.
+/// @tparam PointPMap is a model of `ReadWritePropertyMap` with a value_type = Point_3.
/// It can be omitted if ForwardIterator value_type is convertible to Point_3.
/// @tparam Kernel Geometric traits class.
/// It can be omitted and deduced automatically from PointPMap value_type.
@@ -219,7 +219,7 @@ void
improved_jet_smooth_point_set(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3.
+ PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
unsigned int k, ///< number of neighbors.
const unsigned int iter_number, ///< number of iterations.
const Kernel& kernel, ///< geometric traits.
@@ -255,15 +255,25 @@ improved_jet_smooth_point_set(
std::vector treeElements;
for (it = first, i=0 ; it != beyond ; ++it,++i)
{
- Point& p0 = get(point_pmap,it);
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ const Point& p0 = get(point_pmap,it);
+#else
+ const Point& p0 = get(point_pmap,*it);
+#endif
treeElements.push_back(KdTreeElement(p0,i));
}
Tree tree(treeElements.begin(), treeElements.end());
std::vector p(nb_points); // positions at step iter_n
std::vector b(nb_points); // ...
- for(it = first, i=0; it != beyond; it++, ++i)
- p[i] = get(point_pmap,it);
+ for(it = first, i=0; it != beyond; it++, ++i) {
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ p[i] = get(point_pmap,it);
+#else
+ p[i] = get(point_pmap,*it);
+#endif
+ }
+
// loop until convergence
for(int iter_n = 0; iter_n < iter_number ; ++iter_n)
@@ -273,7 +283,11 @@ improved_jet_smooth_point_set(
// Iterates over input points, computes (original) Laplacian smoothing and b[].
for(it = first, i=0; it != beyond; it++, ++i)
{
- Point& p0 = get(point_pmap,it);
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ const Point& p0 = get(point_pmap,it);
+#else
+ const Point& p0 = get(point_pmap,*it);
+#endif
Point np = improved_jet_smoothing_i::jet_smooth_point(p0,tree,kk);
b[i] = alpha*(np - p0) + (1-alpha)*(np - p[i]);
p[i] = np;
@@ -290,8 +304,11 @@ improved_jet_smooth_point_set(
// Implementation note: the cast to Point& allows to modify only the point's position.
for(it = first, i=0; it != beyond; it++, ++i)
{
- Point& p0 = get(point_pmap,it);
- p0 = p[i];
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ put(point_pmap, it, p[i]);
+#else
+ put(point_pmap, *it, p[i]);
+#endif
}
}
@@ -305,7 +322,7 @@ void
improved_jet_smooth_point_set(
ForwardIterator first, ///< iterator over the first input point
ForwardIterator beyond, ///< past-the-end iterator
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3
+ PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
unsigned int k, ///< number of neighbors.
const unsigned int iter_number,
FT alpha,
@@ -324,7 +341,7 @@ improved_jet_smooth_point_set(
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
template
@@ -339,7 +356,12 @@ improved_jet_smooth_point_set(
{
return improved_jet_smooth_point_set(
first,beyond,
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
make_dereference_property_map(first),
+#else
+ make_identity_property_map(
+ typename std::iterator_traits::value_type()),
+#endif
k,
iter_number,
alpha, beta);
diff --git a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h
index fd58a5b86e9..7008f4b2d78 100644
--- a/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h
+++ b/Point_set_processing_3/include/CGAL/improved_laplacian_smooth_point_set.h
@@ -188,7 +188,7 @@ improved_laplacian_smooth_point(
/// \pre `k >= 2`
///
/// @tparam ForwardIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3.
+/// @tparam PointPMap is a model of `ReadWritePropertyMap` with a value_type = Point_3.
/// It can be omitted if ForwardIterator value_type is convertible to Point_3.
/// @tparam Kernel Geometric traits class.
/// It can be omitted and deduced automatically from PointPMap value_type.
@@ -202,7 +202,7 @@ void
improved_laplacian_smooth_point_set(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3.
+ PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3.
unsigned int k, ///< number of neighbors.
const unsigned int iter_number, ///< number of iterations.
const Kernel& kernel, ///< geometric traits.
@@ -238,15 +238,24 @@ improved_laplacian_smooth_point_set(
std::vector treeElements;
for (it = first, i=0 ; it != beyond ; ++it,++i)
{
- Point& p0 = get(point_pmap,it);
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ const Point& p0 = get(point_pmap,it);
+#else
+ const Point& p0 = get(point_pmap,*it);
+#endif
treeElements.push_back(KdTreeElement(p0,i));
}
Tree tree(treeElements.begin(), treeElements.end());
std::vector p(nb_points); // positions at step iter_n
std::vector b(nb_points); // ...
- for(it = first, i=0; it != beyond; it++, ++i)
+ for(it = first, i=0; it != beyond; it++, ++i) {
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
p[i] = get(point_pmap,it);
+#else
+ p[i] = get(point_pmap,*it);
+#endif
+ }
// loop until convergence
for(int iter_n = 0; iter_n < iter_number ; ++iter_n)
@@ -254,7 +263,11 @@ improved_laplacian_smooth_point_set(
// Iterates over input points, computes (original) Laplacian smoothing and b[].
for(it = first, i=0; it != beyond; it++, ++i)
{
- Point& p0 = get(point_pmap,it);
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ const Point& p0 = get(point_pmap,it);
+#else
+ const Point& p0 = get(point_pmap,*it);
+#endif
Point np = improved_laplacian_smoothing_i::laplacian_smooth_point(p0,tree,k);
b[i] = alpha*(np - p0) + (1-alpha)*(np - p[i]);
p[i] = np;
@@ -271,8 +284,11 @@ improved_laplacian_smooth_point_set(
// Implementation note: the cast to Point& allows to modify only the point's position.
for(it = first, i=0; it != beyond; it++, ++i)
{
- Point& p0 = get(point_pmap,it);
- p0 = p[i];
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ put(point_pmap, it, p[i]);
+#else
+ put(point_pmap, *it, p[i]);
+#endif
}
}
@@ -286,7 +302,7 @@ void
improved_laplacian_smooth_point_set(
ForwardIterator first, ///< iterator over the first input point
ForwardIterator beyond, ///< past-the-end iterator
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3
+ PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
unsigned int k, ///< number of neighbors.
const unsigned int iter_number,
FT alpha,
@@ -305,7 +321,7 @@ improved_laplacian_smooth_point_set(
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
template
@@ -320,7 +336,12 @@ improved_laplacian_smooth_point_set(
{
return improved_laplacian_smooth_point_set(
first,beyond,
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
make_dereference_property_map(first),
+#else
+ make_identity_property_map(
+ typename std::iterator_traits::value_type()),
+#endif
k,
iter_number,
alpha, beta);
diff --git a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h
index 8823086669f..ba9d085b37a 100644
--- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h
+++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h
@@ -114,6 +114,7 @@ jet_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute
///
/// \pre `k >= 2`
///
+
/// @tparam ForwardIterator iterator model of the concept of the same name over input points and able to store output normals.
/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3.
/// It can be omitted if ForwardIterator value_type is convertible to Point_3.
@@ -131,8 +132,8 @@ void
jet_estimate_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3.
- NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3.
+ 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, ///< number of neighbors.
const Kernel& /*kernel*/, ///< geometric traits.
unsigned int degree_fitting = 2) ///< fitting degree
@@ -168,7 +169,11 @@ jet_estimate_normals(
std::vector kd_tree_points;
for(it = first; it != beyond; it++)
{
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
Point point = get(point_pmap, it);
+#else
+ Point point = get(point_pmap, *it);
+#endif
kd_tree_points.push_back(point);
}
Tree tree(kd_tree_points.begin(), kd_tree_points.end());
@@ -180,8 +185,20 @@ jet_estimate_normals(
// vectors (already normalized)
for(it = first; it != beyond; it++)
{
- Vector normal = internal::jet_estimate_normal(get(point_pmap,it), tree, k, degree_fitting);
+ Vector normal = internal::jet_estimate_normal(
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ get(point_pmap,it),
+#else
+ get(point_pmap,*it),
+#endif
+ tree, k, degree_fitting);
+
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
put(normal_pmap, it, normal); // normal_pmap[it] = normal
+#else
+ put(normal_pmap, *it, normal); // normal_pmap[it] = normal
+#endif
+
}
memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
@@ -198,8 +215,8 @@ void
jet_estimate_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3.
- NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3.
+ 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, ///< number of neighbors.
unsigned int degree_fitting = 2)
{
@@ -216,7 +233,7 @@ jet_estimate_normals(
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
template
@@ -224,13 +241,18 @@ void
jet_estimate_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3.
+ NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
unsigned int k, ///< number of neighbors.
unsigned int degree_fitting = 2)
{
jet_estimate_normals(
first,beyond,
- make_dereference_property_map(first),
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ make_dereference_property_map(first),
+#else
+ make_identity_property_map(
+ typename std::iterator_traits::value_type()),
+#endif
normal_pmap,
k,
degree_fitting);
diff --git a/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h b/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h
index b69f4dce48c..f98f5251f7a 100644
--- a/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h
+++ b/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h
@@ -115,7 +115,7 @@ jet_smooth_point(
/// \pre `k >= 2`
///
/// @tparam InputIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3.
+/// @tparam PointPMap is a model of `ReadWritePropertyMap` with a value_type = Point_3.
/// It can be omitted if InputIterator value_type is convertible to Point_3.
/// @tparam Kernel Geometric traits class.
/// It can be omitted and deduced automatically from PointPMap value_type.
@@ -129,7 +129,7 @@ void
jet_smooth_point_set(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map InputIterator -> Point_3.
+ PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3.
unsigned int k, ///< number of neighbors.
const Kernel& /*kernel*/, ///< geometric traits.
unsigned int degree_fitting = 2, ///< fitting degree
@@ -158,7 +158,11 @@ jet_smooth_point_set(
std::vector kd_tree_points;
for(it = first; it != beyond; it++)
{
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
Point point = get(point_pmap, it);
+#else
+ Point point = get(point_pmap, *it);
+#endif
kd_tree_points.push_back(point);
}
Tree tree(kd_tree_points.begin(), kd_tree_points.end());
@@ -167,8 +171,15 @@ jet_smooth_point_set(
// Implementation note: the cast to Point& allows to modify only the point's position.
for(it = first; it != beyond; it++)
{
- Point& p = get(point_pmap, it);
- p = internal::jet_smooth_point(p,tree,k,degree_fitting,degree_monge);
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ const Point& p = get(point_pmap, it);
+ put(point_pmap, it ,
+ internal::jet_smooth_point(p,tree,k,degree_fitting,degree_monge) );
+#else
+ const Point& p = get(point_pmap, *it);
+ put(point_pmap, *it ,
+ internal::jet_smooth_point(p,tree,k,degree_fitting,degree_monge) );
+#endif
}
}
@@ -181,7 +192,7 @@ void
jet_smooth_point_set(
InputIterator first, ///< iterator over the first input point
InputIterator beyond, ///< past-the-end iterator
- PointPMap point_pmap, ///< property map InputIterator -> Point_3
+ PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3
unsigned int k, ///< number of neighbors.
const unsigned int degree_fitting = 2,
const unsigned int degree_monge = 2)
@@ -198,7 +209,7 @@ jet_smooth_point_set(
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
template
void
@@ -211,7 +222,12 @@ jet_smooth_point_set(
{
jet_smooth_point_set(
first,beyond,
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
make_dereference_property_map(first),
+#else
+ make_identity_property_map(
+ typename std::iterator_traits::value_type()),
+#endif
k,
degree_fitting,degree_monge);
}
diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h
index df9eb73b324..69894c99ee2 100644
--- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h
+++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h
@@ -102,7 +102,7 @@ struct MST_graph_vertex_properties {
bool is_oriented; ///< Is input point's normal oriented?
};
template Normal
+ typename NormalPMap, ///< property map: value_type of ForwardIterator -> Normal
typename Kernel ///< Geometric traits class
>
class MST_graph
@@ -134,7 +134,7 @@ public:
/// @tparam Kernel Geometric traits class.
template Normal
+ typename NormalPMap, ///< property map: value_type of ForwardIterator -> Normal
typename Kernel
>
struct Propagate_normal_orientation
@@ -158,21 +158,33 @@ struct Propagate_normal_orientation
// Gets source normal
vertex_descriptor source_vertex = boost::source(edge, mst_graph);
- const Vector source_normal = mst_graph.m_normal_pmap[mst_graph[source_vertex].input_point];
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ const Vector source_normal = get(mst_graph.m_normal_pmap, mst_graph[source_vertex].input_point);
+#else
+ const Vector source_normal = get(mst_graph.m_normal_pmap, *(mst_graph[source_vertex].input_point) );
+#endif
const bool source_normal_is_oriented = mst_graph[source_vertex].is_oriented;
-
// Gets target normal
vertex_descriptor target_vertex = boost::target(edge, mst_graph);
- Vector& target_normal = mst_graph.m_normal_pmap[mst_graph[target_vertex].input_point];
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ const Vector& target_normal = get( mst_graph.m_normal_pmap, mst_graph[target_vertex].input_point);
+#else
+ const Vector& target_normal = get( mst_graph.m_normal_pmap, *(mst_graph[target_vertex].input_point) );
+#endif
bool& target_normal_is_oriented = ((MST_graph&)mst_graph)[target_vertex].is_oriented;
-
if ( ! target_normal_is_oriented )
{
// -> ->
// Orients target_normal parallel to source_normal
double normals_dot = source_normal * target_normal;
if (normals_dot < 0)
- target_normal = -target_normal;
+ {
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ put( mst_graph.m_normal_pmap, mst_graph[target_vertex].input_point, -target_normal);
+#else
+ put( mst_graph.m_normal_pmap, *(mst_graph[target_vertex].input_point), -target_normal );
+#endif
+ }
// Is orientation robust?
target_normal_is_oriented
@@ -204,8 +216,8 @@ ForwardIterator
mst_find_source(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3
- NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3
+ PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
+ NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3
const Kernel& /*kernel*/) ///< geometric traits.
{
CGAL_TRACE(" mst_find_source()\n");
@@ -220,18 +232,33 @@ mst_find_source(
ForwardIterator top_point = first;
for (ForwardIterator v = ++first; v != beyond; v++)
{
+
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
double top_z = get(point_pmap,top_point).z(); // top_point's Z coordinate
double z = get(point_pmap,v).z();
+#else
+ double top_z = get(point_pmap,*top_point).z(); // top_point's Z coordinate
+ double z = get(point_pmap,*v).z();
+#endif
+
if (top_z < z)
top_point = v;
}
// Orients its normal towards +Z axis
- Vector& normal = get(normal_pmap,top_point);
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ const Vector& normal = get(normal_pmap,top_point);
+#else
+ const Vector& normal = get(normal_pmap,*top_point);
+#endif
const Vector Z(0, 0, 1);
if (Z * normal < 0) {
CGAL_TRACE(" Flip top point normal\n");
- normal = -normal;
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ put(normal_pmap,top_point, -normal);
+#else
+ put(normal_pmap,*top_point, -normal);
+#endif
}
return top_point;
@@ -263,8 +290,8 @@ Riemannian_graph
create_riemannian_graph(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3
- NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3
+ PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
+ NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3
IndexPMap index_pmap, ///< property map ForwardIterator -> index
unsigned int k, ///< number of neighbors
const Kernel& /*kernel*/) ///< geometric traits.
@@ -303,7 +330,12 @@ create_riemannian_graph(
std::vector kd_tree_points; kd_tree_points.reserve(num_input_points);
for (ForwardIterator it = first; it != beyond; it++)
{
+
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
Point point = get(point_pmap, it);
+#else
+ Point point = get(point_pmap, *it);
+#endif
Point_vertex_handle_3 point_wrapper(point.x(), point.y(), point.z(), it);
kd_tree_points.push_back(point_wrapper);
}
@@ -335,13 +367,22 @@ create_riemannian_graph(
for (ForwardIterator it = first; it != beyond; it++)
{
std::size_t it_index = get(index_pmap,it);
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
Vector it_normal_vector = get(normal_pmap,it);
-
+#else
+ Vector it_normal_vector = get(normal_pmap,*it);
+#endif
+
// Gather set of (k+1) neighboring points.
// Perform k+1 queries (as in point set, the query point is
// output first). Search may be aborted if k is greater
// than number of input points.
+
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
Point point = get(point_pmap, it);
+#else
+ Point point = get(point_pmap, *it);
+#endif
Point_vertex_handle_3 point_wrapper(point.x(), point.y(), point.z(), it);
Neighbor_search search(*tree, point_wrapper, k+1);
Search_iterator search_iterator = search.begin();
@@ -365,7 +406,12 @@ create_riemannian_graph(
// -> ->
// Computes edge weight = 1 - | normal1 * normal2 |
// where normal1 and normal2 are the normal at the edge extremities.
+
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
Vector neighbor_normal_vector = get(normal_pmap,neighbor);
+#else
+ Vector neighbor_normal_vector = get(normal_pmap,*neighbor);
+#endif
double weight = 1.0 - std::abs(it_normal_vector * neighbor_normal_vector);
if (weight < 0)
weight = 0; // safety check
@@ -403,8 +449,8 @@ MST_graph
create_mst_graph(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3
- NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3
+ PointPMap point_pmap, ///< property map: value_type of ForwardIterator -> Point_3
+ NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3
IndexPMap index_pmap, ///< property map ForwardIterator -> index
unsigned int k, ///< number of neighbors
const Kernel& kernel, ///< geometric traits.
@@ -517,8 +563,8 @@ ForwardIterator
mst_orient_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3.
- NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3.
+ 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, ///< number of neighbors
const Kernel& kernel) ///< geometric traits.
{
@@ -625,8 +671,8 @@ ForwardIterator
mst_orient_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3.
- NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3.
+ 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) ///< number of neighbors
{
typedef typename boost::property_traits::value_type Point;
@@ -641,7 +687,7 @@ mst_orient_normals(
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
template
@@ -649,12 +695,17 @@ ForwardIterator
mst_orient_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3.
+ NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
unsigned int k) ///< number of neighbors
{
return mst_orient_normals(
first,beyond,
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
make_dereference_property_map(first),
+#else
+ make_identity_property_map(
+ typename std::iterator_traits::value_type()),
+#endif
normal_pmap,
k);
}
diff --git a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h
index 618604ef949..b69eafdeabd 100644
--- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h
+++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h
@@ -126,8 +126,8 @@ void
pca_estimate_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3.
- NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3.
+ 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, ///< number of neighbors.
const Kernel& /*kernel*/) ///< geometric traits.
{
@@ -162,7 +162,11 @@ pca_estimate_normals(
std::vector kd_tree_points;
for(it = first; it != beyond; it++)
{
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
Point point = get(point_pmap, it);
+#else
+ Point point = get(point_pmap, *it);
+#endif
kd_tree_points.push_back(point);
}
Tree tree(kd_tree_points.begin(), kd_tree_points.end());
@@ -174,8 +178,20 @@ pca_estimate_normals(
// vectors (already normalized)
for(it = first; it != beyond; it++)
{
- Vector normal = internal::pca_estimate_normal(get(point_pmap,it), tree, k);
+ Vector normal = internal::pca_estimate_normal(
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ get(point_pmap,it),
+#else
+ get(point_pmap,*it),
+#endif
+ tree,
+ k);
+
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
put(normal_pmap, it, normal); // normal_pmap[it] = normal
+#else
+ put(normal_pmap, *it, normal); // normal_pmap[it] = normal
+#endif
}
memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
@@ -192,8 +208,8 @@ void
pca_estimate_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map ForwardIterator -> Point_3.
- NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3.
+ 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) ///< number of neighbors.
{
typedef typename boost::property_traits::value_type Point;
@@ -208,7 +224,7 @@ pca_estimate_normals(
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
template
@@ -216,12 +232,17 @@ void
pca_estimate_normals(
ForwardIterator first, ///< iterator over the first input point.
ForwardIterator beyond, ///< past-the-end iterator over the input points.
- NormalPMap normal_pmap, ///< property map ForwardIterator -> Vector_3.
+ NormalPMap normal_pmap, ///< property map: value_type of ForwardIterator -> Vector_3.
unsigned int k) ///< number of neighbors.
{
pca_estimate_normals(
first,beyond,
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
make_dereference_property_map(first),
+#else
+ make_identity_property_map(
+ typename std::iterator_traits::value_type()),
+#endif
normal_pmap,
k);
}
diff --git a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h
index 7bf6eddbc6c..93be9c562c0 100644
--- a/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h
+++ b/Point_set_processing_3/include/CGAL/pca_smooth_point_set.h
@@ -97,7 +97,6 @@ pca_smooth_point(
} /* namespace internal */
-
// ----------------------------------------------------------------------------
// Public section
// ----------------------------------------------------------------------------
@@ -112,7 +111,7 @@ pca_smooth_point(
/// \pre `k >= 2`
///
/// @tparam InputIterator iterator over input points.
-/// @tparam PointPMap is a model of `ReadablePropertyMap` with a value_type = Point_3.
+/// @tparam PointPMap is a model of `ReadWritePropertyMap` with a value_type = Point_3.
/// It can be omitted if InputIterator value_type is convertible to Point_3.
/// @tparam Kernel Geometric traits class.
/// It can be omitted and deduced automatically from PointPMap value_type.
@@ -126,7 +125,7 @@ void
pca_smooth_point_set(
InputIterator first, ///< iterator over the first input point.
InputIterator beyond, ///< past-the-end iterator over the input points.
- PointPMap point_pmap, ///< property map InputIterator -> Point_3.
+ PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3.
unsigned int k, ///< number of neighbors.
const Kernel& kernel) ///< geometric traits.
{
@@ -153,7 +152,11 @@ pca_smooth_point_set(
std::vector kd_tree_points;
for(it = first; it != beyond; it++)
{
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
Point point = get(point_pmap, it);
+#else
+ Point point = get(point_pmap, *it);
+#endif
kd_tree_points.push_back(point);
}
Tree tree(kd_tree_points.begin(), kd_tree_points.end());
@@ -162,8 +165,13 @@ pca_smooth_point_set(
// Implementation note: the cast to Point& allows to modify only the point's position.
for(it = first; it != beyond; it++)
{
- Point& p = get(point_pmap, it);
- p = internal::pca_smooth_point(p,tree,k);
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
+ const Point& p = get(point_pmap, it);
+ put(point_pmap, it, internal::pca_smooth_point(p,tree,k) );
+#else
+ const Point& p = get(point_pmap, *it);
+ put(point_pmap, *it, internal::pca_smooth_point(p,tree,k) );
+#endif
}
}
/// @endcond
@@ -177,7 +185,7 @@ void
pca_smooth_point_set(
InputIterator first, ///< iterator over the first input point
InputIterator beyond, ///< past-the-end iterator
- PointPMap point_pmap, ///< property map InputIterator -> Point_3
+ PointPMap point_pmap, ///< property map: value_type of InputIterator -> Point_3
unsigned int k) ///< number of neighbors.
{
typedef typename boost::property_traits::value_type Point;
@@ -191,7 +199,7 @@ pca_smooth_point_set(
/// @endcond
/// @cond SKIP_IN_MANUAL
-// This variant creates a default point property map = Dereference_property_map.
+// This variant creates a default point property map = Identity_property_map.
template
void
@@ -202,7 +210,12 @@ pca_smooth_point_set(
{
pca_smooth_point_set(
first,beyond,
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
make_dereference_property_map(first),
+#else
+ make_identity_property_map(
+ typename std::iterator_traits::value_type()),
+#endif
k);
}
/// @endcond
diff --git a/Point_set_processing_3/include/CGAL/property_map.h b/Point_set_processing_3/include/CGAL/property_map.h
index dd49bdc08dd..fb201ea87a5 100644
--- a/Point_set_processing_3/include/CGAL/property_map.h
+++ b/Point_set_processing_3/include/CGAL/property_map.h
@@ -34,7 +34,6 @@
namespace CGAL {
-
/// \ingroup PkgProperty_map
/// Property map that converts a `T*` pointer (or in general an iterator
/// over `T` elements) to the `T` object.
@@ -67,9 +66,43 @@ make_dereference_property_map(Iter)
return Dereference_property_map::type>();
}
+/// \ingroup PkgProperty_map
+/// A `LvaluePropertyMap` property map mapping a key to itself (by reference).
+///
+/// \cgalModels `LvaluePropertyMap`
+template
+struct Identity_property_map
+{
+ typedef T key_type; ///< typedef to `T`
+ typedef T value_type; ///< typedef to `T`
+ typedef T& reference; ///< typedef to `T&`
+ typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag`
+ /// Access a property map element.
+ /// @param k a key which is returned as mapped value.
+ reference operator[](key_type& k) const { return k; }
+
+ typedef Identity_property_map Self;
+ /// \name Put/get free functions
+ /// @{
+ friend const value_type& get(const Self&,const key_type& k) {return k;}
+ friend reference get(const Self&, key_type& k) {return k;}
+ friend void put(const Self&,key_type& k, const value_type& v) {k=v;}
+ /// @}
+};
+
+/// Free function to create a `Identity_property_map` property map.
+///
+/// \relates Identity_property_map
+template // Key and value type
+Identity_property_map
+ make_identity_property_map(T)
+{
+ return Identity_property_map();
+}
+
//=========================================================================
-
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
/// \ingroup PkgProperty_map
/// Property map that accesses the first item of a `std::pair`.
/// \tparam Pair Instance of `std::pair`.
@@ -81,7 +114,7 @@ struct First_of_pair_property_map
: public boost::put_get_helper >
{
- typedef Pair* key_type; ///< typedef to 'Pair*'
+ typedef Pair* key_type; ///< typedef to `Pair*`
typedef typename Pair::first_type value_type; ///< typedef to `Pair::first_type`
typedef value_type& reference; ///< typedef to `value_type&`
typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag
@@ -98,12 +131,51 @@ struct First_of_pair_property_map
/// \relates First_of_pair_property_map
template // Type convertible to key_type
First_of_pair_property_map::type>
-make_first_of_pair_property_map(Iter)
+ make_first_of_pair_property_map(Iter)
{
// value_type_traits is a workaround as back_insert_iterator's value_type is void
return First_of_pair_property_map::type>();
}
+#else
+/// \ingroup PkgProperty_map
+/// Property map that accesses the first item of a `std::pair`.
+/// \tparam Pair Instance of `std::pair`.
+/// \cgalModels `LvaluePropertyMap`
+///
+/// \sa `CGAL::Second_of_pair_property_map`
+template
+struct First_of_pair_property_map
+{
+ typedef Pair key_type; ///< typedef to `Pair`
+ typedef typename Pair::first_type value_type; ///< typedef to `Pair::first_type`
+ typedef value_type& reference; ///< typedef to `value_type&`
+ typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag
+ /// Access a property map element.
+ /// @param pair a key whose first item is accessed
+ reference operator[](key_type& pair) const { return pair.first; }
+
+ typedef First_of_pair_property_map Self;
+ /// \name Put/get free functions
+ /// @{
+ friend const value_type& get(const Self&,const key_type& k) {return k.first;}
+ friend reference get(const Self&, key_type& k) {return k.first;}
+ friend void put(const Self&,key_type& k, const value_type& v) {k.first=v;}
+ /// @}
+};
+
+/// Free function to create a `First_of_pair_property_map` property map.
+///
+/// \relates First_of_pair_property_map
+template // Pair type
+First_of_pair_property_map
+ make_first_of_pair_property_map(Pair)
+{
+ return First_of_pair_property_map();
+}
+#endif
+
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
/// \ingroup PkgProperty_map
///
/// Property map that accesses the second item of a `std::pair`.
@@ -118,7 +190,7 @@ struct Second_of_pair_property_map
: public boost::put_get_helper >
{
- typedef Pair* key_type; ///< typedef to 'Pair*'
+ typedef Pair* key_type; ///< typedef to `Pair*`
typedef typename Pair::second_type value_type; ///< typedef to `Pair::second_type`
typedef value_type& reference; ///< typedef to `value_type&`
typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag`
@@ -135,16 +207,58 @@ struct Second_of_pair_property_map
/// \relates Second_of_pair_property_map
template // Type convertible to key_type
Second_of_pair_property_map::type>
-make_second_of_pair_property_map(Iter)
+ make_second_of_pair_property_map(Iter)
{
// value_type_traits is a workaround as back_insert_iterator's value_type is void
return Second_of_pair_property_map::type>();
}
+#else
+/// \ingroup PkgProperty_map
+///
+/// Property map that accesses the second item of a `std::pair`.
+///
+/// \tparam Pair Instance of `std::pair`.
+///
+/// \cgalModels `LvaluePropertyMap`
+///
+/// \sa `CGAL::First_of_pair_property_map`
+template
+struct Second_of_pair_property_map
+{
+ typedef Pair key_type; ///< typedef to `Pair`
+ typedef typename Pair::second_type value_type; ///< typedef to `Pair::first_type`
+ typedef value_type& reference; ///< typedef to `value_type&`
+ typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag
+
+ /// Access a property map element.
+ /// @param pair a key whose second item is accessed
+ reference operator[](key_type& pair) const { return pair.second; }
+
+ typedef Second_of_pair_property_map Self;
+ /// \name Put/get free functions
+ /// @{
+ friend const value_type& get(const Self&,const key_type& k) {return k.second;}
+ friend reference get(const Self&, key_type& k) {return k.second;}
+ friend void put(const Self&,key_type& k, const value_type& v) {k.second=v;}
+ /// @}
+};
+
+/// Free function to create a Second_of_pair_property_map property map.
+///
+/// \relates Second_of_pair_property_map
+template // Pair type
+Second_of_pair_property_map
+ make_second_of_pair_property_map(Pair)
+{
+ return Second_of_pair_property_map();
+}
+#endif
+
//=========================================================================
-
+#ifdef CGAL_USE_PROPERTY_MAPS_API_V1
/// \ingroup PkgProperty_map
///
/// Property map that accesses the Nth item of a `boost::tuple`.
@@ -158,7 +272,7 @@ struct Nth_of_tuple_property_map
: public boost::put_get_helper::type&,
Nth_of_tuple_property_map >
{
- typedef Tuple* key_type; ///< typedef to 'Tuple*'
+ typedef Tuple* key_type; ///< typedef to `Tuple*`
typedef typename boost::tuples::element::type value_type; ///< typedef to `boost::tuples::element