#include <CGAL/config.h>
#ifndef CGAL_USE_CORE
#include <iostream>
int main() {
std::cout << "Sorry, this example needs CORE ..." << std::endl;
return 0;
}
#else
#include <iostream>
#include <list>
#include <chrono>
#include <CGAL/Cartesian.h>
#include <CGAL/CORE_algebraic_number_traits.h>
#include <CGAL/Arr_conic_traits_2.h>
#include <CGAL/Env_sphere_traits_3.h>
#include <CGAL/envelope_3.h>
using Rational = Nt_traits::Rational;
using Algebraic = Nt_traits::Algebraic;
using Rat_point_3 = Rat_kernel::Point_3;
using Conic_traits_2 =
using Sphere_3 = Traits_3::Surface_3;
int main(int argc, char* argv[]) {
const char* filename = (argc > 1) ? argv[1] : "spheres.dat";
std::ifstream in_file(filename);
if (! in_file.is_open()) {
std::cerr << "Failed to open " << filename << " ..." << std::endl;
return 1;
}
int n = 0;
std::list<Sphere_3> spheres;
int x = 0, y = 0, z = 0, sqr_r = 0;
in_file >> n;
for (int i = 0; i < n; ++i) {
in_file >> x >> y >> z >> sqr_r;
spheres.push_back(Sphere_3(Rat_point_3(x, y, z), Rational(sqr_r)));
}
in_file.close();
std::cout << "Constructing the lower envelope of " << n << " spheres.\n";
Envelope_diagram_2 min_diag;
auto start = std::chrono::system_clock::now();
std::chrono::duration<double> secs = std::chrono::system_clock::now() - start;
std::cout << "V = " << min_diag.number_of_vertices()
<< ", E = " << min_diag.number_of_edges()
<< ", F = " << min_diag.number_of_faces() << std::endl;
std::cout << "Construction took " << secs.count() << " seconds.\n";
return 0;
}
#endif
The traits class Env_sphere_traits_3 models the EnvelopeTraits_3 concept, and is used for the constru...
Definition: Env_sphere_traits_3.h:32
The class-template Envelope_diagram_2 represents the minimization diagram that corresponds to the low...
Definition: envelope_3.h:26
void lower_envelope_3(InputIterator begin, InputIterator end, Envelope_diagram_2< Traits > &diag)
Computes the lower envelope of a set of surfaces in , as given by the range [begin,...