diff --git a/Point_set_processing_3/doc_tex/Point_set_processing_3/io.tex b/Point_set_processing_3/doc_tex/Point_set_processing_3/io.tex index f3d7e13a45b..5e08968a058 100644 --- a/Point_set_processing_3/doc_tex/Point_set_processing_3/io.tex +++ b/Point_set_processing_3/doc_tex/Point_set_processing_3/io.tex @@ -6,13 +6,14 @@ The algorithms of this component take as input parameters iterator ranges of 3D points, or of 3D points with normals. The property maps are used to access the point or normal information from the input data, so as to let the user decide upon the implementation of a point with normal. The latter can be represented as, e.g., a class derived from the \cgal\ 3D point, or as a \ccc{std::pair, Vector_3 >}, or as a \ccc{boost::tuple<..,Point_3, ..., Vector_3 >}.\\ \\ - An another component provides property maps to support these cases: \\ \ccc{CGAL::Dereference_property_map} \\ \ccc{CGAL::First_of_pair_property_map} and \ccc{CGAL::Second_of_pair_property_map} \\ \ccc{CGAL::Nth_of_tuple_property_map} \\ \\ -Note that Dereference_property_map is the default value of the position property map expected by all functions in this component. Users of this component may use other types to represent positions and normals as long as the corresponding property maps are implemented. +\ccc{Dereference_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. \\ +Users of this package may use other types to represent positions and normals if they implement the corresponding property maps. \subsection{Streams} diff --git a/Point_set_processing_3/doc_tex/Point_set_processing_3/outliers.tex b/Point_set_processing_3/doc_tex/Point_set_processing_3/outliers.tex index fc23f98108e..56055ae1f83 100644 --- a/Point_set_processing_3/doc_tex/Point_set_processing_3/outliers.tex +++ b/Point_set_processing_3/doc_tex/Point_set_processing_3/outliers.tex @@ -23,5 +23,5 @@ Function \ccc{CGAL::remove_outliers()} deletes a user-specified fraction of outl \ccExample -The following example reads a point set and removes 5\% of the points. +The following example reads a point set and removes 5\% of the points. It uses the \ccc{CGAL::Dereference_property_map} property map (optional as it is the default position property map of all functions in this component.) \ccIncludeExampleCode{Point_set_processing_3/remove_outliers_example.cpp} diff --git a/Point_set_processing_3/doc_tex/Property_map/Property_map.tex b/Point_set_processing_3/doc_tex/Property_map/Property_map.tex index 89370c4c5b4..103eead45fc 100644 --- a/Point_set_processing_3/doc_tex/Property_map/Property_map.tex +++ b/Point_set_processing_3/doc_tex/Property_map/Property_map.tex @@ -26,7 +26,17 @@ This component provides property maps to support these cases: \\ \ccc{CGAL::First_of_pair_property_map} and \ccc{CGAL::Second_of_pair_property_map} \\ \ccc{CGAL::Nth_of_tuple_property_map} \\ -\subsection{Example} +\subsection{Example with Dereference\_property\_map} + +The following example reads a point set and removes 5\% of the points. It uses \ccc{CGAL::Dereference_property_map} as position property map. +\ccIncludeExampleCode{Point_set_processing_3/remove_outliers_example.cpp} + +\subsection{Example with Pairs} The following example reads a point set from an input file and writes it to a file, both in the xyz format. Position and normal are stored in pairs and accessed through property maps. \ccIncludeExampleCode{Point_set_processing_3/read_write_xyz_point_set_example.cpp} + +\subsection{Example with Tuples} + +The following example reads a point set in the \ccc{xyz} format and computes the average spacing. Index, position and color are stored in a tuple and accessed through property maps. +\ccIncludeExampleCode{Point_set_processing_3/average_spacing_example.cpp} 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 8dd6939ff1f..60b41c897fe 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 @@ -5,14 +5,13 @@ #include #include #include -#include // Types typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef Kernel::FT FT; typedef Kernel::Point_3 Point; -// Data type := index, followed by the point, followed by three integers that +// Data type := index, followed by the point, followed by three integers that // define the Red Green Blue color of the point. typedef boost::tuple IndexedPointWithColorTuple; @@ -38,10 +37,10 @@ int main(void) for(int i = 0; i < points.size(); i++) { points[i].get<0>() = i; // set index value of tuple to i - + points[i].get<2>() = 0; // set RGB color to black - points[i].get<3>() = 0; - points[i].get<4>() = 0; + points[i].get<3>() = 0; + points[i].get<4>() = 0; } // Computes average spacing. 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 0bfecbeb114..d4b33ed634c 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,7 +13,7 @@ typedef Kernel::Point_3 Point; int main(void) { // Reads a .xyz point set file in points[]. - // The dereference property map can be omitted here as it is the default value. + // The Dereference_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 || @@ -24,10 +24,10 @@ int main(void) } // Removes outliers using erase-remove idiom. - // The dereference property map can be omitted here as it is the default value. + // The Dereference_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 = 7; // considers 7 nearest neighbor points - points.erase( + points.erase( CGAL::remove_outliers(points.begin(), points.end(), CGAL::Dereference_property_map(), nb_neighbors,removed_percentage), points.end());