#include "include/utils.h"
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
using FT = typename Kernel::FT;
using Point_with_normal = std::pair<Point_3, Vector_3>;
using Pwn_vector = std::vector<Point_with_normal>;
int main(int argc, char** argv) {
std::string path = CGAL::data_file_path("points_3/cube.pwn");
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;
}
void regularize_planes(PlaneRange &planes, const PointRange &points, const NamedParameters &np)
Hierarchical plane regularization.
Definition: regularize_planes.h:442
Mode set_ascii_mode(std::ios &s)
This header includes all classes for regularizing planes.