#include <iostream>
#include <fstream>
#include <cassert>
#include <string>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Filtered_kernel.h>
#include <CGAL/Segment_Delaunay_graph_traits_2.h>
#include <CGAL/Segment_Delaunay_graph_2.h>
int main()
{
ifstream ifs("data/sites2.cin");
assert( ifs );
SDG2 sdg;
SDG2::Site_2 site;
while ( ifs >> site ) { sdg.insert( site ); }
ifs.close();
assert( sdg.is_valid(true, 1) );
cout << endl << endl;
string inf_vertex("infinite vertex");
char vid[] = {'A', 'B', 'C', 'D'};
SDG2::Finite_edges_iterator eit = sdg.finite_edges_begin();
for (int k = 1; eit != sdg.finite_edges_end(); ++eit, ++k) {
SDG2::Edge e = *eit;
SDG2::Vertex_handle v[] = { e.first->vertex( sdg.ccw(e.second) ),
e.first->vertex( sdg.cw(e.second) ),
e.first->vertex( e.second ),
sdg.tds().mirror_vertex(e.first, e.second) };
cout << "--- Edge " << k << " ---" << endl;
for (int i = 0; i < 4; i++) {
if ( sdg.is_infinite(v[i]) ) {
cout << vid[i] << ": " << inf_vertex << endl;
} else {
cout << vid[i] << ": " << v[i]->site() << endl;
}
}
cout << endl;
}
return 0;
}