#include "include/utils.h"
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Shape_detection/Efficient_RANSAC.h>
using Point_with_normal = std::pair<Point_3, Vector_3>;
using Pwn_vector = std::vector<Point_with_normal>;
int main(int argc, char** argv) {
if (argc > 1) path = argv[1];
Pwn_vector points;
std::ifstream file(path.c_str(), std::ios_base::in);
file.precision(20);
if (!file ||
!CGAL::IO::read_XYZ(
file,
std::back_inserter(points),
CGAL::parameters::point_map(Point_map()).
normal_map(Normal_map()))) {
std::cerr << "Error: cannot read the file cube.pwn!" << std::endl;
return EXIT_FAILURE;
}
file.close();
RANSAC efficient_ransac;
efficient_ransac.set_input(points);
efficient_ransac.add_shape_factory<Plane>();
efficient_ransac.detect();
auto planes = efficient_ransac.planes();
planes,
points,
plane_map(Plane_map()).
point_map(Point_map()).
plane_index_map(
regularize_coplanarity(false).
maximum_angle(FT(10)));
std::cout << "* all detected planes are regularized" << std::endl;
return EXIT_SUCCESS;
}