#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Kinetic_space_partition_3.h>
#include <CGAL/Real_timer.h>
#include <CGAL/IO/polygon_soup_io.h>
using FT = typename Kernel::FT;
using Timer = CGAL::Real_timer;
int main(int argc, char** argv)
{
std::string input_filename = (argc > 1 ? argv[1] : "data/test-4-rnd-polygons-4-6.off");
std::ifstream input_file(input_filename);
std::vector<Point_3> input_vertices;
std::vector<std::vector<std::size_t> > input_faces;
if (CGAL::IO::read_polygon_soup(input_filename, input_vertices, input_faces)) {
std::cout << "* reading the file: " << input_filename << "!" << std::endl;
input_file.close();
} else {
std::cerr << "ERROR: can't read the file " << input_filename << "!" << std::endl;
return EXIT_FAILURE;
}
std::cout << "--- INPUT STATS: \n* number of polygons: " << input_faces.size() << std::endl;
const unsigned int k = (argc > 2 ? std::atoi(argv[2]) : 1);
KSP ksp(CGAL::parameters::verbose(true).debug(true));
ksp.insert(input_vertices, input_faces);
Timer timer;
timer.start();
ksp.initialize(CGAL::parameters::bbox_dilation_ratio(1.1).reorient_bbox(false));
ksp.partition(k);
timer.stop();
const FT time = static_cast<FT>(timer.time());
ksp.get_linear_cell_complex(lcc);
std::vector<unsigned int> cells = { 0, 2, 3 }, count;
count = lcc.count_cells(cells);
std::cout << "For k = " << k << ":\n" << " vertices: " << count[0] << "\n faces: " << count[2] << "\n volumes: " << count[3] << std::endl;
std::cout << "\n3D kinetic partition created in " << time << " seconds!" << std::endl;
return EXIT_SUCCESS;
}
creates the kinetic partition of the bounding box of the polygons given as input data.
Definition: Kinetic_space_partition_3.h:66