Last active
June 12, 2018 11:14
-
-
Save sloriot/5a2f69951c8902948392c9368cc23ab4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment