Added examples with Dereference_property_map and tuple property map

This commit is contained in:
Laurent Saboret
2009-06-18 13:28:00 +00:00
parent c57dd66907
commit 533dfcf207
5 changed files with 22 additions and 12 deletions
@@ -5,14 +5,13 @@
#include <vector>
#include <fstream>
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_io.hpp>
// 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<int, Point, int, int, int> 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.
@@ -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<Point> 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<Point>(),
nb_neighbors,removed_percentage), points.end());