updated examples after efi's comments

This commit is contained in:
Oren Salzman 2011-06-01 08:34:29 +00:00
parent 9d21e9cedd
commit e88dc6f1ec
2 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,5 @@
//! \file examples/Arrangement_2/ex_rational_functions.cpp
// Constructing an arrangement of arcs of rational functions.
#include <CGAL/basic.h>
#include <CGAL/CORE_BigInt.h> //NT
@ -31,10 +30,10 @@ int main ()
std::vector<Traits_2::X_monotone_curve_2> arcs;
// Create an arc supported by the polynomial y = x^4 - 6x^2 + 8,
// defined over the interval [-2, 2]:
// defined over the interval [-2.1, 2.1]:
Polynomial_1 P1 = x*x*x*x - 6*x*x + 8;
arcs.push_back( construct_arc(P1.begin(), P1.end(),
Alg_real_1(-2), Alg_real_1(2)));
Alg_real_1(-2.1), Alg_real_1(2.1)));
// Create an arc supported by the function y = x / (1 + x^2),
// defined over the interval [-3, 3]:
@ -57,7 +56,7 @@ int main ()
Alg_real_1(-3), Alg_real_1(0)));
// Construct the arrangement of the four arcs.
Arrangement_2 arr;
Arrangement_2 arr(&traits);
insert (arr, arcs.begin(), arcs.end());
// Print the arrangement size.

View File

@ -19,9 +19,9 @@ typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
int main ()
{
// Traits class object
Traits_2 traits;
AK1 ak1 = traits.algebraic_kernel_d_1();
AK1 ak1;
Traits_2 traits(&ak1);
// constructor for rational functions
Traits_2::Construct_curve_2 construct
= traits.construct_curve_2_object();
@ -45,7 +45,7 @@ int main ()
Polynomial_1 P2 = -4*x*x+3;
Polynomial_1 minusP2 = -P2;
std::vector<std::pair<Alg_real_1,int> > roots;
ak1.solve_1_object()(P2,std::back_inserter(roots));// [-sqrt(3)/2, sqrt(3)/2]
traits.algebraic_kernel_d_1()->solve_1_object()(P2,std::back_inserter(roots));// [-sqrt(3)/2, sqrt(3)/2]
arcs.push_back(construct(P2.begin(), P2.end(), roots[0].first, roots[1].first));
arcs.push_back(construct(minusP2.begin(),minusP2.end(), roots[0].first, roots[1].first));
@ -58,7 +58,8 @@ int main ()
arcs.push_back(construct(minusP3.begin(),minusP3.end(), Q3.begin(), Q3.end(), Alg_real_1(0), false));
// Construct the arrangement of the six arcs.
Arrangement_2 arr;
//Arrangement_2 arr(&traits);
Arrangement_2 arr;
insert (arr, arcs.begin(), arcs.end());
// Print the arrangement size.