#include <CGAL/Exact_rational.h>
#include <CGAL/Cartesian.h>
#include <CGAL/Env_plane_traits_3.h>
#include <CGAL/envelope_3.h>
#include <iostream>
#include <list>
typedef CGAL::Exact_rational Number_type;
typedef Traits_3::Surface_3 Surface_3;
void print_diagram (const Envelope_diagram_2& diag)
{
Envelope_diagram_2::Face_const_iterator fit;
Envelope_diagram_2::Ccb_halfedge_const_circulator ccb;
Envelope_diagram_2::Surface_const_iterator sit;
for (fit = diag.faces_begin(); fit != diag.faces_end(); ++fit)
{
ccb = fit->outer_ccb();
std::cout << "[Face] ";
do
{
if(!ccb->is_fictitious())
std::cout << '(' << ccb->curve() << ") ";
++ccb;
} while (ccb != fit->outer_ccb());
std::cout << "--> " << fit->number_of_surfaces()
<< " planes:";
for (sit = fit->surfaces_begin(); sit != fit->surfaces_end(); ++sit)
std::cout << ' ' << sit->plane();
std::cout << std::endl;
}
return;
}
int main ()
{
std::list<Surface_3> planes;
planes.push_back (Surface_3(Plane_3(0, -1, 1, 0)));
planes.push_back (Surface_3(Plane_3(-1, 0, 1, 0)));
planes.push_back (Surface_3(Plane_3(0, 1 , 1, 0)));
planes.push_back (Surface_3(Plane_3(1, 0, 1, 0)));
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 traits class Env_plane_traits_3 models the EnvelopeTraits_3 concept, and is used for the construc...
Definition: Env_plane_traits_3.h:35
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,...