fix when not using Gmp

This commit is contained in:
Sébastien Loriot 2018-10-01 19:00:18 +02:00
parent 146fc90a33
commit 4fb1fe6079
7 changed files with 35 additions and 61 deletions

View File

@ -221,7 +221,7 @@ template<class CK,
#ifdef CGAL_USE_GMP #ifdef CGAL_USE_GMP
class EK = Simple_cartesian< Gmpq >, class EK = Simple_cartesian< Gmpq >,
#else #else
class EK = Simple_cartesian< MP_Float >, class EK = Simple_cartesian< CGAL::Quotient<MP_Float> >,
#endif #endif
class EK_MTag = Integral_domain_without_division_tag, class EK_MTag = Integral_domain_without_division_tag,
class FK = Simple_cartesian< Interval_nt<false> >, class FK = Simple_cartesian< Interval_nt<false> >,

View File

@ -70,7 +70,7 @@ namespace CGAL {
bool samepq = false; bool samepq = false;
bool samepr = false; bool samepr = false;
bool sameqr = false; bool sameqr = false;
const Comparison_result cmppq = compare(p, q); const Comparison_result cmppq = CGAL::compare(p, q);
switch(cmppq) { switch(cmppq) {
case SMALLER: case SMALLER:
min_p = &p; min_p = &p;
@ -86,7 +86,7 @@ namespace CGAL {
samepq = true; samepq = true;
break; break;
} }
const Comparison_result cmppr = compare(p, r); const Comparison_result cmppr = CGAL::compare(p, r);
Comparison_result cmpqr; Comparison_result cmpqr;
if (samepq) { if (samepq) {
cmpqr = cmppr; cmpqr = cmppr;
@ -105,7 +105,7 @@ namespace CGAL {
if (min_p == &p) { if (min_p == &p) {
switch(cmppr) { switch(cmppr) {
case SMALLER: case SMALLER:
cmpqr = compare(q, r); cmpqr = CGAL::compare(q, r);
switch(cmpqr) { switch(cmpqr) {
case SMALLER: case SMALLER:
max_p = &r; max_p = &r;
@ -135,7 +135,7 @@ namespace CGAL {
max_p = &r; max_p = &r;
break; break;
case LARGER: case LARGER:
cmpqr = compare(q, r); cmpqr = CGAL::compare(q, r);
switch(cmpqr) { switch(cmpqr) {
case SMALLER: case SMALLER:
break; break;

View File

@ -10,28 +10,19 @@
#include <fstream> #include <fstream>
#include <cassert> #include <cassert>
// choose number type #include <CGAL/Exact_rational.h>
#ifdef CGAL_USE_GMP #include <CGAL/Exact_integer.h>
# include <CGAL/Gmpq.h> // choose number type
typedef CGAL::Gmpq exact_ring_t; typedef CGAL::Exact_integer exact_ring_t;
typedef CGAL::Gmpq exact_field_t; typedef CGAL::Exact_rational exact_field_t;
namespace CGAL { namespace CGAL {
// needed for the drawing methods // needed for the drawing methods
Gmpq sqrt(const Gmpq& x) { exact_ring_t sqrt(const exact_ring_t& x) {
return Gmpq( CGAL::sqrt( CGAL::to_double(x) ) ); return exact_ring_t( sqrt( to_double(x) ) );
}
} }
} //namespace CGAL
#else
# include <CGAL/MP_Float.h>
# include <CGAL/Quotient.h>
typedef CGAL::MP_Float exact_ring_t;
typedef CGAL::Quotient<exact_ring_t> exact_field_t;
#endif
typedef exact_ring_t ring_number_t; typedef exact_ring_t ring_number_t;
typedef exact_field_t field_number_t; typedef exact_field_t field_number_t;

View File

@ -10,17 +10,12 @@
#include <fstream> #include <fstream>
#include <cassert> #include <cassert>
#include <CGAL/Exact_rational.h>
#include <CGAL/Exact_integer.h>
// choose number type // choose number type
#ifdef CGAL_USE_GMP typedef CGAL::Exact_integer exact_ring_t;
# include <CGAL/Gmpq.h> typedef CGAL::Exact_rational exact_field_t;
typedef CGAL::Gmpq exact_ring_t;
typedef CGAL::Gmpq exact_field_t;
#else
# include <CGAL/MP_Float.h>
# include <CGAL/Quotient.h>
typedef CGAL::MP_Float exact_ring_t;
typedef CGAL::Quotient<exact_ring_t> exact_field_t;
#endif
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>

View File

@ -10,28 +10,19 @@
#include <fstream> #include <fstream>
#include <cassert> #include <cassert>
// choose number type #include <CGAL/Exact_rational.h>
#ifdef CGAL_USE_GMP #include <CGAL/Exact_integer.h>
# include <CGAL/Gmpq.h> // choose number type
typedef CGAL::Gmpq exact_ring_t; typedef CGAL::Exact_integer exact_ring_t;
typedef CGAL::Gmpq exact_field_t; typedef CGAL::Exact_rational exact_field_t;
namespace CGAL { namespace CGAL {
// needed for the drawing methods // needed for the drawing methods
Gmpq sqrt(const Gmpq& x) { exact_ring_t sqrt(const exact_ring_t& x) {
return Gmpq( sqrt( to_double(x) ) ); return exact_ring_t( sqrt( to_double(x) ) );
}
} }
} //namespace CGAL
#else
# include <CGAL/MP_Float.h>
# include <CGAL/Quotient.h>
typedef CGAL::MP_Float exact_ring_t;
typedef CGAL::Quotient<exact_ring_t> exact_field_t;
#endif
typedef exact_ring_t ring_number_t; typedef exact_ring_t ring_number_t;
typedef exact_field_t field_number_t; typedef exact_field_t field_number_t;

View File

@ -10,17 +10,12 @@
#include <fstream> #include <fstream>
#include <cassert> #include <cassert>
#include <CGAL/Exact_rational.h>
#include <CGAL/Exact_integer.h>
// choose number type // choose number type
#ifdef CGAL_USE_GMP typedef CGAL::Exact_integer exact_ring_t;
# include <CGAL/Gmpq.h> typedef CGAL::Exact_rational exact_field_t;
typedef CGAL::Gmpq exact_ring_t;
typedef CGAL::Gmpq exact_field_t;
#else
# include <CGAL/MP_Float.h>
# include <CGAL/Quotient.h>
typedef CGAL::MP_Float exact_ring_t;
typedef CGAL::Quotient<exact_ring_t> exact_field_t;
#endif
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>

View File

@ -7,12 +7,14 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Segment_Delaunay_graph_Linf_filtered_traits_2.h> #include <CGAL/Segment_Delaunay_graph_Linf_filtered_traits_2.h>
#include <CGAL/Segment_Delaunay_graph_Linf_2.h> #include <CGAL/Segment_Delaunay_graph_Linf_2.h>
#include <CGAL/Gmpq.h> #include <CGAL/Exact_rational.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Field_with_sqrt_tag MTag; typedef CGAL::Field_with_sqrt_tag MTag;
typedef CGAL::Integral_domain_without_division_tag EMTag; typedef CGAL::Integral_domain_without_division_tag EMTag;
typedef CGAL::Simple_cartesian<CGAL::Gmpq> EK; typedef CGAL::Exact_rational Number_type;
typedef CGAL::Simple_cartesian<Number_type> EK;
typedef CGAL::Segment_Delaunay_graph_Linf_filtered_traits_without_intersections_2<K, MTag, EK, EMTag> Gt; typedef CGAL::Segment_Delaunay_graph_Linf_filtered_traits_without_intersections_2<K, MTag, EK, EMTag> Gt;
typedef CGAL::Segment_Delaunay_graph_Linf_2<Gt> SDG; typedef CGAL::Segment_Delaunay_graph_Linf_2<Gt> SDG;