#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/compute_average_spacing.h>
#include <CGAL/IO/read_points.h>
#include <vector>
#include <fstream>
#include <boost/tuple/tuple.hpp>
typedef Kernel::FT FT;
typedef boost::tuple<int, Point, int, int, int> IndexedPointWithColorTuple;
int main(int argc, char*argv[])
{
const std::string fname = (argc>1)?argv[1]:CGAL::data_file_path("points_3/sphere_20k.xyz");
std::vector<IndexedPointWithColorTuple> points;
{
std::cerr << "Error: cannot read file " << fname << std::endl;
return EXIT_FAILURE;
}
for(unsigned int i = 0; i < points.size(); i++)
{
points[i].get<0>() = i;
points[i].get<2>() = 0;
points[i].get<3>() = 0;
points[i].get<4>() = 0;
}
const unsigned int nb_neighbors = 6;
FT average_spacing = CGAL::compute_average_spacing<Concurrency_tag>(
points, nb_neighbors,
std::cout << "Average spacing: " << average_spacing << std::endl;
return EXIT_SUCCESS;
}
bool read_points(const std::string &fname, PointOutputIterator output, const NamedParameters &np=parameters::default_values())
reads the point set from an input file.
Definition: read_points.h:89