#include <CGAL/basic.h>
#ifndef CGAL_USE_CORE
#include <iostream>
int main ()
{
std::cout << "Sorry, this example needs CORE ..." << std::endl;
return 0;
}
#else
#include <CGAL/Algebraic_kernel_d_1.h>
#include <CGAL/Arr_rational_function_traits_2.h>
#include <CGAL/Arrangement_2.h>
typedef Traits_2::Polynomial_1 Polynomial_1;
typedef Traits_2::Algebraic_real_1 Alg_real_1;
int main ()
{
Traits_2 traits;
Traits_2::Construct_x_monotone_curve_2 construct_arc
= traits.construct_x_monotone_curve_2_object();
std::vector<Traits_2::X_monotone_curve_2> arcs;
Polynomial_1 P1 = x*x*x*x - 6*x*x + 8;
Alg_real_1 l(Traits_2::Algebraic_kernel_d_1::Bound(-2.1));
Alg_real_1 r(Traits_2::Algebraic_kernel_d_1::Bound(2.1));
arcs.push_back(construct_arc(P1, l, r));
Polynomial_1 P2 = x;
Polynomial_1 Q2 = 1+x*x;
arcs.push_back(construct_arc(P2, Q2, Alg_real_1(-3), Alg_real_1(3)));
Polynomial_1 P3 = 8 - x*x;
arcs.push_back(construct_arc(P3, Alg_real_1(-2), Alg_real_1(3)));
Polynomial_1 P4 = -2*x;
arcs.push_back(construct_arc(P4, Alg_real_1(-3), Alg_real_1(0)));
for (unsigned int i(0); i < arcs.size(); ++i)
std::cout << arcs[i]<<std::endl;
Arrangement_2 arr(&traits);
insert(arr, arcs.begin(), arcs.end());
std::cout << "The arrangement size:" << std::endl
<< " V = " << arr.number_of_vertices()
<< ", E = " << arr.number_of_edges()
<< ", F = " << arr.number_of_faces() << std::endl;
return 0;
}
#endif