Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Using the global incremental insertion functions.
- #include "arr_rational_nt.h"
- #include <CGAL/Cartesian.h>
- #include <CGAL/Arr_segment_traits_2.h>
- #include <CGAL/Arrangement_2.h>
- #include <CGAL/Arr_overlay_2.h>
- #include <CGAL/Arr_default_overlay_traits.h>
- #include "arr_print.h"
- typedef CGAL::Cartesian<Number_type> 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;
- typedef CGAL::Arr_default_overlay_traits<Arrangement_2> Overlay_traits;
- int main() {
- // Construct the arrangement of five intersecting segments.
- Arrangement_2 arr1;
- Arrangement_2 arr2;
- Arrangement_2 arr;
- Overlay_traits overlay_traits;
- Segment_2 ss1[] = {
- Segment_2(Point_2(1, 6), Point_2(8, 5)),
- Segment_2(Point_2(8, 5), Point_2(13, 8)),
- Segment_2(Point_2(13, 8), Point_2(11, 11)),
- Segment_2(Point_2(11, 11), Point_2(6, 13)),
- Segment_2(Point_2(6, 13), Point_2(1, 6))
- };
- Segment_2 ss2[] = {
- Segment_2(Point_2(5, 2), Point_2(11, 2)),
- Segment_2(Point_2(11, 2), Point_2(8, 8)),
- Segment_2(Point_2(8, 8), Point_2(5, 2)),
- };
- insert_non_intersecting_curves(arr1, ss1, ss1 + 5);
- insert_non_intersecting_curves(arr2, ss2, ss2 + 3);
- overlay(arr1, arr2, arr, overlay_traits);
- Arrangement_2::Vertex_const_iterator vit;
- for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) {
- if (vit->degree() > 2) {
- print_neighboring_vertices<Arrangement_2>(vit);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment