/* * Author: Francisc Bungiu * E-mail: fbungiu@gmail.com */ #include #include #include #include #include #include #include #include #include #include #include #include #include int main() { { typedef CGAL::Gmpq Number_type; typedef CGAL::Cartesian Kernel; typedef CGAL::Arr_segment_traits_2 Traits_2; typedef Traits_2::Point_2 Point_2; typedef Traits_2::X_monotone_curve_2 Segment_2; typedef CGAL::Arrangement_2 Arrangement_2; // First read arrangement Arrangement_2 arr; std::ifstream input("./data/simple_polygon_test_case_1.in"); CGAL::create_arrangement_from_file(arr, input); CGAL::Visibility_2::Simple_visibility_2 visibility; assert(false == (CGAL::test_is_attached >(visibility))); visibility.attach(arr); assert(true == (CGAL::test_is_attached >(visibility))); visibility.detach(); assert(false == (CGAL::test_is_attached >(visibility))); visibility.attach(arr); assert(true == (CGAL::test_are_equal(arr, visibility.arr()))); // Run test cases from https://cgal.geometryfactory.com/CGAL/Members/wiki/Visibility/TestCases assert(true == (CGAL::simple_polygon_test_case_1, Arrangement_2> ())); assert(true == (CGAL::simple_polygon_test_case_2, Arrangement_2> ())); assert(true == (CGAL::simple_polygon_test_case_3, Arrangement_2> ())); assert(true == (CGAL::simple_polygon_test_case_4, Arrangement_2> ())); } { typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; typedef CGAL::Arr_segment_traits_2 Traits_2; typedef Traits_2::Point_2 Point_2; typedef Traits_2::X_monotone_curve_2 Segment_2; typedef CGAL::Arrangement_2 Arrangement_2; // First read arrangement Arrangement_2 arr; std::ifstream input("./data/simple_polygon_test_case_1.in"); CGAL::create_arrangement_from_file(arr, input); CGAL::Visibility_2::Simple_visibility_2 visibility; assert(false == (CGAL::test_is_attached >(visibility))); visibility.attach(arr); assert(true == (CGAL::test_is_attached >(visibility))); visibility.detach(); assert(false == (CGAL::test_is_attached >(visibility))); visibility.attach(arr); assert(true == (CGAL::test_are_equal(arr, visibility.arr()))); // Run test cases from https://cgal.geometryfactory.com/CGAL/Members/wiki/Visibility/TestCases assert(true == (CGAL::simple_polygon_test_case_1, Arrangement_2> ())); assert(true == (CGAL::simple_polygon_test_case_2, Arrangement_2> ())); assert(true == (CGAL::simple_polygon_test_case_3, Arrangement_2> ())); } return 0; }