Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
- #include <CGAL/Arr_segment_traits_2.h>
- #include <CGAL/Arrangement_2.h>
- #include <vector>
- typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
- typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
- typedef Traits_2::Point_2 Point_2;
- typedef Traits_2::X_monotone_curve_2 Segment_2;
- typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
- int main ()
- {
- // Construct the arrangement of five intersecting segments.
- Arrangement_2 arr;
- std::vector<Segment_2> segments;
- segments.push_back(Segment_2(Point_2(1, 0), Point_2(2, 4)));
- segments.push_back(Segment_2(Point_2(5, 0), Point_2(5, 5)));
- segments.push_back(Segment_2(Point_2(1, 0), Point_2(5, 3)));
- segments.push_back(Segment_2(Point_2(0, 2), Point_2(6, 0)));
- segments.push_back(Segment_2(Point_2(3, 0), Point_2(5, 5)));
- insert(arr, segments.begin(), segments.end());
- Arrangement_2::Face_handle fh = arr.unbounded_face();
- for(Arrangement_2::Hole_iterator hole_it = fh->holes_begin();
- hole_it != fh->holes_end();
- ++hole_it)
- {
- Arrangement_2::Halfedge_handle h = *hole_it, start=h;
- do{
- std::cout << h->target()->point();
- h=h->next();
- }while(start!=h);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment