#include #include #include #include #include #include #include #include #include #include using Kernel=CGAL::Exact_predicates_inexact_constructions_kernel; using Point=Kernel::Point_3; using Vector=Kernel::Vector_3; using Pwn=std::pair; using Polyhedron=CGAL::Polyhedron_3; using PS3=CGAL::Point_set_3; struct Graphics_scene_options_green_points: public CGAL::Graphics_scene_options { bool colored_vertex(const PS3&, typename PS3::const_iterator) const { return true; } CGAL::IO::Color vertex_color(const PS3&, typename PS3::const_iterator) const { return CGAL::IO::Color(0,220,0); } }; int main(void) { std::vector points; if(!CGAL::IO::read_points(CGAL::data_file_path("points_3/kitten.xyz"), std::back_inserter(points), CGAL::parameters::point_map(CGAL::First_of_pair_property_map()) .normal_map(CGAL::Second_of_pair_property_map()))) { std::cerr << "Error: cannot read input file " << CGAL::data_file_path("points_3/kitten.xyz") << std::endl; return EXIT_FAILURE; } Polyhedron output_mesh; double average_spacing = CGAL::compute_average_spacing (points, 6, CGAL::parameters::point_map(CGAL::First_of_pair_property_map())); if (CGAL::poisson_surface_reconstruction_delaunay (points.begin(), points.end(), CGAL::First_of_pair_property_map(), CGAL::Second_of_pair_property_map(), output_mesh, average_spacing)) { PS3 point_set; for(Pwn& it: points) { point_set.insert(it.first); } CGAL::Graphics_scene scene; CGAL::add_to_graphics_scene(point_set, scene, Graphics_scene_options_green_points()); CGAL::add_to_graphics_scene(output_mesh, scene); CGAL::draw_graphics_scene(scene); } else { return EXIT_FAILURE; } return EXIT_SUCCESS; }