#define CGAL_SDG_VERBOSE #undef CGAL_SDG_VERBOSE #ifndef CGAL_SDG_VERBOSE #define CGAL_SDG_DEBUG(a) #else #define CGAL_SDG_DEBUG(a) { a } #endif #include #include #include #include #include namespace CGAL_linfvoronoi { typedef CGAL::Cartesian Kernel; typedef CGAL::Segment_Delaunay_graph_Linf_traits_2 Gt; typedef CGAL::Segment_Delaunay_graph_Linf_2 SDG2; const unsigned int num_entries = 2; const std::string sublabel[] = { "Segment VD Linf", "Help" }; const std::string helpmsg[] = { "Draw the L_inf Voronoi diagram of segments", }; class linfvoronoiIpelet : public CGAL::Ipelet_base { public: linfvoronoiIpelet() :CGAL::Ipelet_base ("Linf VD segments",sublabel,helpmsg){} void protected_run(int); }; // -------------------------------------------------------------------- void linfvoronoiIpelet::protected_run(int fn) { SDG2 svd; //Voronoi for segments if (fn == (num_entries-1)) { show_help(); return; } std::list pt_list; std::list sg_list; Iso_rectangle_2 bbox; // grab input bbox = read_active_objects( CGAL::dispatch_or_drop_output ( std::back_inserter(pt_list), segment_grabber(std::back_inserter(sg_list)), std::back_inserter(sg_list) ) ); // check input if (pt_list.empty() and sg_list.empty()) { print_error_message(("Nothing selected")); return; } Kernel::FT incr_len = 75; // slightly increase the size of the bbox bbox = Iso_rectangle_2( bbox.min()+Kernel::Vector_2(-incr_len,-incr_len), bbox.max()+Kernel::Vector_2(incr_len,incr_len)); // insert input into svd for (std::list::iterator sit = sg_list.begin(); sit != sg_list.end(); ++sit) { svd.insert(sit->point(0),sit->point(1)); } svd.insert(pt_list.begin(),pt_list.end()); draw_dual_in_ipe(svd, bbox); } // end of void linfvoronoiIpelet::protected_run(int fn) } CGAL_IPELET(CGAL_linfvoronoi::linfvoronoiIpelet)