From 6467abc8ff05f417beffb84d179efc3135de3d74 Mon Sep 17 00:00:00 2001 From: Sylvain Pion Date: Tue, 1 Jan 2008 15:12:11 +0000 Subject: [PATCH] Use Qtwidget << Polygon_2 instead of redoing a suboptimal loop ourselves here (which additionnaly triggered a warning with -O2). --- .../demo/Convex_hull_2/convex_hull_2.cpp | 33 +++---------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/Convex_hull_2/demo/Convex_hull_2/convex_hull_2.cpp b/Convex_hull_2/demo/Convex_hull_2/convex_hull_2.cpp index e2e08b32eb0..21884e27595 100644 --- a/Convex_hull_2/demo/Convex_hull_2/convex_hull_2.cpp +++ b/Convex_hull_2/demo/Convex_hull_2/convex_hull_2.cpp @@ -23,7 +23,6 @@ #ifndef CGAL_USE_QT #include - int main(int, char*) { @@ -36,15 +35,14 @@ int main(int, char*) #else #include -#include -#include -#include #include #include #include #include +#include +#include #include #include @@ -93,38 +91,17 @@ public: *widget << (*itp++); } - std::list out; - std::list Sl; + CGAL::Polygon_2 out; CGAL::convex_hull_points_2(list_of_points.begin(), list_of_points.end(), std::back_inserter(out)); - if( out.size() > 1 ) { - Point_2 pakt,prev,pstart; + *widget << CGAL::BLUE << out; - std::list::const_iterator it; - it=out.begin(); - prev= *it; pstart=prev; - it++; - - for(; it != out.end(); ++it) { - pakt= *it; - Sl.push_back(Segment(prev,pakt)); - prev=pakt; - } - Sl.push_back(Segment(pakt,pstart)); - - *widget << CGAL::BLUE; - std::list::iterator its = Sl.begin(); - while(its!=Sl.end()) - { - *widget << (*its++); - } - } widget->unlock(); }; -};//end class +}; class MyWindow : public QMainWindow {