#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Scale_space_surface_reconstruction_3.h>
#include <CGAL/IO/read_points.h>
#include <CGAL/Timer.h>
#include <fstream>
#include <iostream>
typedef Reconstruction::Point Point;
typedef Reconstruction::Facet_const_iterator Facet_iterator;
typedef Mesher::Facet_const_iterator Mesher_iterator;
typedef CGAL::Timer Timer;
int main(int argc, char* argv[]) {
std::string fname = argc==1?CGAL::data_file_path("points_3/kitten.off"):argv[1];
std::cerr << "Reading " << std::flush;
std::vector<Point> points;
{
std::cerr << "Error: cannot read file" << std::endl;
return EXIT_FAILURE;
}
std::cerr << "done: " << points.size() << " points." << std::endl;
Timer t;
t.start();
Reconstruction reconstruct(points.begin(), points.end() );
Smoother smoother(10, 200 );
reconstruct.increase_scale(4, smoother);
Mesher mesher(smoother.squared_radius(),
false,
true
);
reconstruct.reconstruct_surface(mesher);
std::cerr << "Reconstruction done in " << t.time() << " sec." << std::endl;
std::ofstream out("out.off");
for(Facet_iterator it = reconstruct.facets_begin(); it != reconstruct.facets_end(); ++it )
out << "3 " << (*it)[0] << " " << (*it)[1] << " " << (*it)[2] << '\n';
out.close();
std::ofstream garbage("garbage.off");
for(Mesher_iterator it = mesher.garbage_begin(); it != mesher.garbage_end(); ++it )
garbage << "3 " << (*it)[0] << " " << (*it)[1] << " " << (*it)[2] << '\n';
std::cerr << "Done." << std::endl;
return EXIT_SUCCESS;
}
Surface mesher for scale space reconstruction based on CGAL::Alpha_shape_3.
Definition: Alpha_shape_mesher.h:64
Smoother for scale space reconstruction based on a principal component analysis weighted by the local...
Definition: Weighted_PCA_smoother.h:71
computes a triangulated surface mesh interpolating a point set.
Definition: Scale_space_surface_reconstruction_3.h:48
bool read_points(const std::string &fname, PointOutputIterator output, const NamedParameters &np=parameters::default_values())