#include <iostream>
#include <list>
#include <CGAL/Exact_rational.h>
#include <CGAL/Cartesian.h>
#include <CGAL/Env_triangle_traits_3.h>
#include <CGAL/Env_surface_data_traits_3.h>
#include <CGAL/envelope_3.h>
using Number_type = CGAL::Exact_rational;
using Data_triangle_3 = Data_traits_3::Surface_3;
void print_diagram(const Envelope_diagram_2& diag) {
for (auto fit = diag.faces_begin(); fit != diag.faces_end(); ++fit) {
if (fit->is_unbounded()) std::cout << "[Unbounded face]";
else {
auto ccb = fit->outer_ccb();
std::cout << "[Face] ";
do std::cout << '(' << ccb->target()->point() << ") ";
while (++ccb != fit->outer_ccb());
}
std::cout << "--> " << fit->number_of_surfaces() << " triangles:";
for (auto sit = fit->surfaces_begin(); sit != fit->surfaces_end(); ++sit)
std::cout << ' ' << sit->data();
std::cout << std::endl;
}
Envelope_diagram_2::Edge_const_iterator eit;
for (auto eit = diag.edges_begin(); eit != diag.edges_end(); ++eit) {
std::cout << "[Edge] (" << eit->source()->point()
<< ") (" << eit->target()->point()
<< ") --> " << eit->number_of_surfaces()
<< " triangles:";
for (auto sit = eit->surfaces_begin(); sit != eit->surfaces_end(); ++sit)
std::cout << ' ' << sit->data();
std::cout << std::endl;
}
}
int main() {
std::list<Data_triangle_3> triangles;
triangles.push_back(Data_triangle_3(t1, 'A'));
triangles.push_back(Data_triangle_3(t2, 'B'));
Envelope_diagram_2 min_diag;
std::cout << std::endl << "The minimization diagram:" << std::endl;
print_diagram(min_diag);
Envelope_diagram_2 max_diag;
std::cout << std::endl << "The maximization diagram:" << std::endl;
print_diagram (max_diag);
return 0;
}
The class Env_surface_data_traits_3 is a model of the EnvelopeTraits_3 concept and serves as a decora...
Definition: Env_surface_data_traits_3.h:39
The traits class template Env_triangle_traits_3 models the EnvelopeTraits_3 concept,...
Definition: Env_triangle_traits_3.h:41
The class-template Envelope_diagram_2 represents the minimization diagram that corresponds to the low...
Definition: envelope_3.h:26
void upper_envelope_3(InputIterator begin, InputIterator end, Envelope_diagram_2< Traits > &diag)
Computes the upper envelope of a set of surfaces in , as given by the range [begin,...
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,...