From eb6218ef3d0f5dea981abfe4c5f6d0500a06fa1d Mon Sep 17 00:00:00 2001 From: Panagiotis Cheilaris Date: Thu, 17 Jan 2013 17:07:09 +0100 Subject: [PATCH] program that prints SDG L2 details --- .../CMakeLists.txt | 1 + .../print-sdg-l2.cpp | 60 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 sdgap/examples/Segment_Delaunay_graph_Linf_2/print-sdg-l2.cpp diff --git a/sdgap/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt b/sdgap/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt index beca567a26f..4c65f186c8e 100644 --- a/sdgap/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt +++ b/sdgap/examples/Segment_Delaunay_graph_Linf_2/CMakeLists.txt @@ -29,6 +29,7 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "sdg-red-blue-info.cpp" ) create_single_source_cgal_program( "sdg-voronoi-edges.cpp" ) create_single_source_cgal_program( "print-sdg.cpp" ) + create_single_source_cgal_program( "print-sdg-l2.cpp" ) else() diff --git a/sdgap/examples/Segment_Delaunay_graph_Linf_2/print-sdg-l2.cpp b/sdgap/examples/Segment_Delaunay_graph_Linf_2/print-sdg-l2.cpp new file mode 100644 index 00000000000..3df83002968 --- /dev/null +++ b/sdgap/examples/Segment_Delaunay_graph_Linf_2/print-sdg-l2.cpp @@ -0,0 +1,60 @@ +// standard includes + +//#define CGAL_SDG_VERBOSE + +#ifndef CGAL_SDG_VERBOSE +#define CGAL_SDG_DEBUG(a) +#else +#define CGAL_SDG_DEBUG(a) { a } +#endif + +#include +#include +#include +#include + +// define the kernel +#include +#include + +typedef CGAL::Simple_cartesian CK; +typedef CGAL::Filtered_kernel Kernel; + +// typedefs for the traits and the algorithm +#include +#include + +typedef CGAL::Segment_Delaunay_graph_traits_2 Gt; +typedef CGAL::Segment_Delaunay_graph_2 SDG2; + +using namespace std; + +int main( int argc, char *argv[] ) { + if ( not (( argc == 1 ) or (argc == 2)) ) { + std::cout <<"usage: "<< argv[0] <<" [filename]\n"; + } + + ifstream ifs( (argc == 1) ? "data/sites2.cin" : argv[1] ); + assert( ifs ); + + SDG2 sdg; + SDG2::Site_2 site; + + // read the sites from the stream and insert them in the diagram + while ( ifs >> site ) { sdg.insert( site ); } + + ifs.close(); + + + std::cout << "About to validate diagram ..." << std::endl; + + // validate the diagram + //assert( sdg.is_valid(true, 1) ); + cout << endl << endl; + + std::cout << "Diagram validated." << std::endl; + + sdg.file_output_verbose(std::cout); + + return 0; +}