daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
  2. #include <CGAL/Arr_segment_traits_2.h>
  3. #include <CGAL/Arrangement_2.h>
  4. #include <vector>
  5.  
  6. typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
  7. typedef CGAL::Arr_segment_traits_2<Kernel>            Traits_2;
  8. typedef Traits_2::Point_2                             Point_2;
  9. typedef Traits_2::X_monotone_curve_2                  Segment_2;
  10. typedef CGAL::Arrangement_2<Traits_2>                 Arrangement_2;
  11. int main ()
  12. {
  13.   // Construct the arrangement of five intersecting segments.
  14.   Arrangement_2 arr;
  15.   std::vector<Segment_2> segments;
  16.   segments.push_back(Segment_2(Point_2(1, 0), Point_2(2, 4)));
  17.   segments.push_back(Segment_2(Point_2(5, 0), Point_2(5, 5)));
  18.   segments.push_back(Segment_2(Point_2(1, 0), Point_2(5, 3)));
  19.   segments.push_back(Segment_2(Point_2(0, 2), Point_2(6, 0)));
  20.   segments.push_back(Segment_2(Point_2(3, 0), Point_2(5, 5)));
  21.   insert(arr, segments.begin(), segments.end());
  22.  
  23.   Arrangement_2::Face_handle fh = arr.unbounded_face();
  24.   for(Arrangement_2::Hole_iterator hole_it = fh->holes_begin();
  25.                                    hole_it != fh->holes_end();
  26.                                    ++hole_it)
  27.   {
  28.     Arrangement_2::Halfedge_handle h = *hole_it, start=h;
  29.     do{
  30.         std::cout << h->target()->point();
  31.       h=h->next();
  32.     }while(start!=h);
  33.   }
  34.  
  35.   return 0;
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top