Merge pull request #1551 from mglisse/Number_types-gmpxx_coercion-glisse

Misc GMPXX fixes
This commit is contained in:
Laurent Rineau 2016-10-20 09:47:39 +02:00
commit c826500c7d
20 changed files with 145 additions and 137 deletions

View File

@ -73,14 +73,14 @@ private:
if ( sign_of_Dw == POSITIVE ) {
if ( R != SMALLER ) return LARGER;
Sign s = sign_a_plus_b_x_sqrt_c(D1 - D2 + CGAL::square(Dw),
RT(2) * Dw, D1);
Sign s = sign_a_plus_b_x_sqrt_c<RT>(D1 - D2 + CGAL::square(Dw),
RT(2) * Dw, D1);
return ((s == POSITIVE) ? LARGER : ((s == ZERO) ? EQUAL : SMALLER));
}
if ( R != LARGER ) return SMALLER;
Sign s = sign_a_plus_b_x_sqrt_c(D1 - D2 - CGAL::square(Dw),
RT(2) * Dw, D2);
Sign s = sign_a_plus_b_x_sqrt_c<RT>(D1 - D2 - CGAL::square(Dw),
RT(2) * Dw, D2);
return ((s == POSITIVE) ? LARGER : ((s == ZERO) ? EQUAL : SMALLER));
}

View File

@ -449,7 +449,7 @@ ke_compare_l1_l2(const FT& a1, const FT& b1, const FT& c1,
FT a1c2 = a1 * c2;
FT a2c1 = a2 * c1;
FT K = value_of_K(a1c2, a2c1, b1 * b2);
FT K = value_of_K<FT>(a1c2, a2c1, b1 * b2);
Sign s_K = CGAL::sign(K);
if ( s_J == POSITIVE ) {
@ -530,7 +530,7 @@ ke_compare_l1_r2(const FT& a1, const FT& b1, const FT& c1,
FT a1c2 = a1 * c2;
FT a2c1 = a2 * c1;
FT K = value_of_K(a1c2, a2c1, b1 * b2);
FT K = value_of_K<FT>(a1c2, a2c1, b1 * b2);
Sign s_K = CGAL::sign(K);
if ( s_K == NEGATIVE ) { return SMALLER; }
@ -550,7 +550,7 @@ ke_compare_l1_r2(const FT& a1, const FT& b1, const FT& c1,
if ( CGAL::is_positive(Jp) ) { return LARGER; }
FT P4 = value_of_P4(J, Jp, a1c2 - a2c1);
FT P4 = value_of_P4<FT>(J, Jp, a1c2 - a2c1);
Sign s_P4 = CGAL::sign(P4);
if ( s_P4 == POSITIVE ) { return SMALLER; }
@ -583,7 +583,7 @@ ke_compare_r1_l2(const FT& a1, const FT& b1, const FT& c1,
FT a1c2 = a1 * c2;
FT a2c1 = a2 * c1;
FT K = value_of_K(a1c2, a2c1, b1 * b2);
FT K = value_of_K<FT>(a1c2, a2c1, b1 * b2);
Sign s_K = CGAL::sign(K);
if ( s_K == NEGATIVE ) { return LARGER; }
@ -604,7 +604,7 @@ ke_compare_r1_l2(const FT& a1, const FT& b1, const FT& c1,
if ( CGAL::is_negative(Jp) ) { return SMALLER; }
FT P4 = value_of_P4(J, Jp, a1c2 - a2c1);
FT P4 = value_of_P4<FT>(J, Jp, a1c2 - a2c1);
Sign s_P4 = CGAL::sign(P4);
if ( s_P4 == POSITIVE ) { return LARGER; }
@ -627,7 +627,7 @@ ke_compare_r1_r2(const FT& a1, const FT& b1, const FT& c1,
FT a1c2 = a1 * c2;
FT a2c1 = a2 * c1;
FT K = value_of_K(a1c2, a2c1, b1 * b2);
FT K = value_of_K<FT>(a1c2, a2c1, b1 * b2);
Sign s_K = CGAL::sign(K);
if ( s_J == POSITIVE ) {

View File

@ -2033,9 +2033,9 @@ protected:
if (CGAL::sign(denom) == ZERO)
return;
const NT x_numer = b()*cv.c() - c()*cv.b();
const NT y_numer = c()*cv.a() - a()*cv.c();
Point_2 p (x_numer / denom, y_numer / denom);
const NT x = (b()*cv.c() - c()*cv.b()) / denom;
const NT y = (c()*cv.a() - a()*cv.c()) / denom;
Point_2 p (x, y);
inter_list.push_back (Intersection_point_2 (p, mult));
return;

View File

@ -91,7 +91,7 @@ namespace CGAL_MINIBALL_NAMESPACE {
for (int j=0; j<D; ++j) {
eps[m] -= u[m][j]*e[m-1][j];
phi[m] -= u[m][j]*f[m-1][j];
delta[m] += sqr(u[m][j]-d[m-1][j]);
delta[m] += sqr<FT>(u[m][j]-d[m-1][j]);
}
phi[m] = FT(2)*(phi[m] - t1);
eps[m] = t1*t2+FT(2)*eps[m];
@ -151,7 +151,7 @@ namespace CGAL_MINIBALL_NAMESPACE {
if (m > 1) {
// compute the coeffients beta[i] and the center:
for(unsigned int i=1; i<m; ++i) {
beta[i] = (delta[i]+eps[i]+sol[m]*phi[i])/alpha[i];
beta[i] = (static_cast<FT>(delta[i]+eps[i])+sol[m]*phi[i])/alpha[i];
for (int j=0; j<D; ++j)
center[j] += beta[i]*u[i][j];
}

View File

@ -73,11 +73,11 @@ void _test_spherical_kernel_compute(SK sk)
Root_for_spheres_2_3 rt[8];
rt[0] = Root_for_spheres_2_3(0,1,0);
rt[1] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT(1)/FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1)/FT(2)),FT(2)),0);
rt[1] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(-FT(1)/FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1)/FT(2)),FT(2)),0);
rt[2] = Root_for_spheres_2_3(-1,0,0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT(1)/FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT(1)/FT(2)),FT(2)),0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(-FT(1)/FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(-FT(1)/FT(2)),FT(2)),0);
rt[4] = Root_for_spheres_2_3(0,-1,0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1)/FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT(1)/FT(2)),FT(2)),0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1)/FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(-FT(1)/FT(2)),FT(2)),0);
rt[6] = Root_for_spheres_2_3(1,0,0);
rt[7] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1)/FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1)/FT(2)),FT(2)),0);

View File

@ -1784,11 +1784,11 @@ void _test_intersection_construct(SK sk) {
Root_for_spheres_2_3 rt[8];
rt[0] = Root_for_spheres_2_3(0,1,0);
rt[1] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),0);
rt[1] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),0);
rt[2] = Root_for_spheres_2_3(-1,0,0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)),0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)),0);
rt[4] = Root_for_spheres_2_3(0,-1,0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)),0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)),0);
rt[6] = Root_for_spheres_2_3(1,0,0);
rt[7] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),0);
@ -2479,11 +2479,11 @@ void _test_split_construct(SK sk) {
Root_for_spheres_2_3 rt[8];
rt[0] = Root_for_spheres_2_3(0,1,0);
rt[1] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),0);
rt[1] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),0);
rt[2] = Root_for_spheres_2_3(-1,0,0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)),0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)),0);
rt[4] = Root_for_spheres_2_3(0,-1,0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)),0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)),0);
rt[6] = Root_for_spheres_2_3(1,0,0);
rt[7] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),0);
@ -2567,13 +2567,13 @@ void _test_extremal_points_construct(SK sk) {
Circular_arc_point_3 pc[4], ps[6], res[6];
pc[0] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)),
pc[0] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)),
0,
CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)));
pc[1] = Root_for_spheres_2_3(0,1,0);
pc[2] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),
0,
CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)));
CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)));
pc[3] = Root_for_spheres_2_3(0,-1,0);
res[0] = x_extremal_point(c, true);
@ -2590,11 +2590,11 @@ void _test_extremal_points_construct(SK sk) {
assert(res[4] == pc[0]);
assert(res[5] == pc[2]);
ps[0] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(1),-FT(1),FT(2)), 1, 1);
ps[0] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(1),FT(-1),FT(2)), 1, 1);
ps[1] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(1),FT(1),FT(2)), 1, 1);
ps[2] = Root_for_spheres_2_3(1, CGAL::make_root_of_2(FT(1),-FT(1),FT(2)), 1);
ps[2] = Root_for_spheres_2_3(1, CGAL::make_root_of_2(FT(1),FT(-1),FT(2)), 1);
ps[3] = Root_for_spheres_2_3(1, CGAL::make_root_of_2(FT(1),FT(1),FT(2)), 1);
ps[4] = Root_for_spheres_2_3(1, 1, CGAL::make_root_of_2(FT(1),-FT(1),FT(2)));
ps[4] = Root_for_spheres_2_3(1, 1, CGAL::make_root_of_2(FT(1),FT(-1),FT(2)));
ps[5] = Root_for_spheres_2_3(1, 1, CGAL::make_root_of_2(FT(1),FT(1),FT(2)));
res[0] = x_extremal_point(s, true);

View File

@ -269,7 +269,7 @@ void _test_has_on_predicate(SK sk) {
Point_3 p_3_s_1 = Point_3(0,0,1);
Point_3 p_4_s_1 = Point_3(1,0,1);
std::cout << "Testing has_on(Sphere,Circular_arc_point)..." << std::endl;
Root_of_2 sqrt_1_div_3 = CGAL::make_root_of_2(FT(0),FT(1),FT(1) / FT(3));
Root_of_2 sqrt_1_div_3 = CGAL::make_root_of_2(FT(0),FT(1),FT(FT(1) / FT(3)));
Root_of_2 sqrt_1_div_2 = CGAL::make_root_of_2(FT(0),FT(1),FT(FT(1) / FT(2)));
Root_for_spheres_2_3 r_1_s_1 = Root_for_spheres_2_3(0,sqrt_1_div_2,sqrt_1_div_2);
Root_for_spheres_2_3 r_2_s_1 = Root_for_spheres_2_3(sqrt_1_div_3,sqrt_1_div_3,sqrt_1_div_3);
@ -327,8 +327,8 @@ void _test_has_on_predicate(SK sk) {
Polynomial_1_3(1,1,1,0));
Circle_3 c_2 = theConstruct_circle_3(pc2);
Root_of_2 r_1_1_c_2 = FT(FT(1) / FT(2));
Root_of_2 r_1_2_c_2 = CGAL::make_root_of_2(-FT(FT(1) / FT(4)),-FT(FT(1) / FT(4)),FT(5));
Root_of_2 r_1_3_c_2 = CGAL::make_root_of_2(-FT(FT(1) / FT(4)),FT(FT(1) / FT(4)),FT(5));
Root_of_2 r_1_2_c_2 = CGAL::make_root_of_2(FT(-FT(1) / FT(4)),FT(-FT(1) / FT(4)),FT(5));
Root_of_2 r_1_3_c_2 = CGAL::make_root_of_2(FT(-FT(1) / FT(4)),FT(FT(1) / FT(4)),FT(5));
Root_for_spheres_2_3 r_1_c_2 = Root_for_spheres_2_3(r_1_1_c_2,r_1_2_c_2,r_1_3_c_2);
Root_for_spheres_2_3 r_2_c_2 = Root_for_spheres_2_3(r_1_2_c_2,r_1_2_c_2,r_1_2_c_2);
Circular_arc_point_3 cp_1_c_2 = Circular_arc_point_3(r_1_c_2);
@ -408,14 +408,14 @@ void _test_has_on_predicate(SK sk) {
Root_for_spheres_2_3 rt[10];
rt[0] = Root_for_spheres_2_3(0,1,0);
rt[1] = Root_for_spheres_2_3(-FT(FT(1) / FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(3)), 0);
rt[2] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(3)), FT(FT(1) / FT(2)), 0);
rt[1] = Root_for_spheres_2_3(FT(-FT(1) / FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(3)), 0);
rt[2] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(3)), FT(FT(1) / FT(2)), 0);
rt[4] = Root_for_spheres_2_3(-1,0,0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)),0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)),0);
rt[6] = Root_for_spheres_2_3(0,-1,0);
rt[7] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)),0);
rt[7] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)),0);
rt[8] = Root_for_spheres_2_3(1,0,0);
rt[9] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),0);
@ -450,11 +450,11 @@ void _test_has_on_predicate(SK sk) {
Root_for_spheres_2_3 rt2[8];
rt2[0] = Root_for_spheres_2_3(0,CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)));
rt2[1] = Root_for_spheres_2_3(0,0,1);
rt2[2] = Root_for_spheres_2_3(0,CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)),CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)));
rt2[2] = Root_for_spheres_2_3(0,CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)),CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)));
rt2[3] = Root_for_spheres_2_3(0,-1,0);
rt2[4] = Root_for_spheres_2_3(0,CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)),CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)));
rt2[4] = Root_for_spheres_2_3(0,CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)),CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)));
rt2[5] = Root_for_spheres_2_3(0,0,-1);
rt2[6] = Root_for_spheres_2_3(0,CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)));
rt2[6] = Root_for_spheres_2_3(0,CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)));
rt2[7] = Root_for_spheres_2_3(0,1,0);
for(int i=0; i<8; i++) {
@ -579,11 +579,11 @@ void _test_do_overlap_predicate(SK sk) {
Root_for_spheres_2_3 rt[8];
rt[0] = Root_for_spheres_2_3(0,1,0);
rt[1] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),0);
rt[1] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),0);
rt[2] = Root_for_spheres_2_3(-1,0,0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)),0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)),0);
rt[4] = Root_for_spheres_2_3(0,-1,0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT(1) / FT(2)),FT(2)),0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(-FT(1) / FT(2)),FT(2)),0);
rt[6] = Root_for_spheres_2_3(1,0,0);
rt[7] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT(1) / FT(2)),FT(2)),0);

View File

@ -310,9 +310,9 @@ int main (int argc, char *argv[])
// Determine the input format.
Coord_input_format format = F_RATIONAL;
if (strcmp (argv[2*i + 2], "-i") || strcmp (argv[2*i + 2], "-I"))
if (strcmp (argv[2*i + 2], "-i") == 0 || strcmp (argv[2*i + 2], "-I") == 0)
format = F_INTEGER;
else if (strcmp (argv[2*i + 2], "-d") || strcmp (argv[2*i + 2], "-D"))
else if (strcmp (argv[2*i + 2], "-d") == 0 || strcmp (argv[2*i + 2], "-D") == 0)
format = F_DOUBLE;
// Read the input segments.

View File

@ -159,7 +159,7 @@ namespace internal {
return -sides[SIDE].y()*alpha + sides[SIDE].x()*beta;
default:
CGAL_error();
return typename K::FT(0.);
return typename K::FT(0);
}
}
@ -192,8 +192,8 @@ namespace internal {
typename K::Point_3 p_min, p_max;
get_min_max<K, AXE>(AXE==0? 0: AXE==1? sides[SIDE].z(): -sides[SIDE].y(),
AXE==0? -sides[SIDE].z(): AXE==1? 0: sides[SIDE].x(),
AXE==0? sides[SIDE].y(): AXE==1? -sides[SIDE].x(): 0,
bbox, p_min, p_max);
AXE==0? sides[SIDE].y(): AXE==1? -sides[SIDE].x():
typename K::FT(0), bbox, p_min, p_max);
switch ( AXE )
{

View File

@ -234,9 +234,9 @@ public:
Vertex_handle v = this->sncp()->new_vertex(p , boundary);
CGAL_NEF_TRACEN( v->point());
SM_decorator SD(&*v);
Sphere_point sp[] = { Sphere_point(-x, 0, 0),
Sphere_point(0, -y, 0),
Sphere_point(0, 0, -z) };
Sphere_point sp[] = { Sphere_point(NT(-x), 0, 0),
Sphere_point(0, NT(-y), 0),
Sphere_point(0, 0, NT(-z)) };
/* create box vertices */
SVertex_handle sv[3];
@ -1126,9 +1126,8 @@ public:
std::list<Point_3> points;
for(int dir=0; dir<3;++dir) {
NT cnst[3];
for(int i=0; i<3;++i)
cnst[i] = (i==dir? -h.d()[0] : 0);
NT cnst[3] = { 0, 0, 0 };
cnst[dir] = -h.d()[0];
NT cross[4][4];
cross[0][dir] = -orth_coords[(dir+1)%3]-orth_coords[(dir+2)%3];
@ -1541,10 +1540,10 @@ public:
CGAL_NEF_TRACEN("create corner frame point ");
RT vp[3];
vp[0] = -p.hx()[1];
vp[1] = -p.hy()[1];
vp[2] = -p.hz()[1];
RT vp[3] = {
static_cast<RT>(-p.hx()[1]),
static_cast<RT>(-p.hy()[1]),
static_cast<RT>(-p.hz()[1]) };
CGAL_NEF_TRACEN("create spoints");
Sphere_point SP[5];
@ -1606,10 +1605,10 @@ public:
(CGAL_NTS abs(vec.hy()) == CGAL_NTS abs(vec.hz()) && vec.hx() == 0) ||
(CGAL_NTS abs(vec.hx()) == CGAL_NTS abs(vec.hz()) && vec.hy() == 0));
RT vp[3];
vp[0] = -p.hx()[1];
vp[1] = -p.hy()[1];
vp[2] = -p.hz()[1];
RT vp[3] = {
static_cast<RT>(-p.hx()[1]),
static_cast<RT>(-p.hy()[1]),
static_cast<RT>(-p.hz()[1]) };
CGAL_NEF_TRACEN("create degenerate corner frame point ");

View File

@ -23,8 +23,8 @@ void test_write_read()
typedef CGAL::Polyhedron_3< Kernel > Polyhedron;
typedef typename Kernel::Point_3 Point;
typename Kernel::RT n( std::string("6369051672525773"));
typename Kernel::RT d( std::string("4503599627370496"));
typename Kernel::RT n(RT(std::string("6369051672525773")));
typename Kernel::RT d(RT(std::string("4503599627370496")));
Point p(n, 0, 0, d);
Point q(0, n, 0, d);

View File

@ -23,8 +23,8 @@ void test_write_read()
typedef CGAL::Polyhedron_3< Kernel > Polyhedron;
typedef typename Kernel::Point_3 Point;
typename Kernel::RT n( std::string("6369051672525773"));
typename Kernel::RT d( std::string("4503599627370496"));
typename Kernel::RT n(RT(std::string("6369051672525773")));
typename Kernel::RT d(RT(std::string("4503599627370496")));
Point p(n, 0, 0, d);
Point q(0, n, 0, d);

View File

@ -185,7 +185,7 @@ public:
RT b_ = b_num * a_den * c_den;
RT c_ = c_num * a_den * b_den;
return make_root_of_2(a_,b_,c_,smaller);
return make_root_of_2<RT>(a_,b_,c_,smaller);
}
};

View File

@ -170,11 +170,11 @@ public:
// is_extended_(x.is_extended()){}
/*! \brief Constructor from some type NTX and ROOTX
* NT must be constructible from NTX\\
* NT must be constructible from NTX and NTY\\
* ROOT must be construcible from ROOTX\\
*/
template <class NTX,class ROOTX>
explicit Sqrt_extension(const NTX& a0, const NTX& a1, const ROOTX& root)
template <class NTX,class NTY,class ROOTX>
explicit Sqrt_extension(const NTX& a0, const NTY& a1, const ROOTX& root)
: a0_(a0),
a1_(a1),
root_(root),

View File

@ -36,74 +36,62 @@
namespace CGAL {
//mpz_class internal coercions:
//self for mpz_class / mpq_class
template <class T , class U>
struct Coercion_traits<
::__gmp_expr< T , U>,::__gmp_expr< T , U> >{
typedef Tag_true Are_explicit_interoperable;
typedef Tag_true Are_implicit_interoperable;
typedef ::__gmp_expr<T , T> Type;
struct Cast{
typedef Type result_type;
template <class U3>
Type operator()(const ::__gmp_expr< T , U3>& x) const {
return x;
}
};
};
template <class T, class U1, class U2>
struct Coercion_traits<
::__gmp_expr< T , U1>,::__gmp_expr< T , U2> >{
typedef Tag_true Are_explicit_interoperable;
typedef Tag_true Are_implicit_interoperable;
typedef ::__gmp_expr< T , T > Type;
struct Cast{
typedef Type result_type;
template <class U3>
Type operator()(const ::__gmp_expr< T , U3>& x) const {
return x;
}
};
};
template <class T1 , class T2, class U1, class U2>
struct Coercion_traits< ::__gmp_expr< T1 , U1>,::__gmp_expr< T2 , U2> >{
typedef Tag_true Are_explicit_interoperable;
typedef Tag_true Are_implicit_interoperable;
typedef mpq_class Type;
struct Cast{
typedef Type result_type;
template <class T , class U>
Type operator()(const ::__gmp_expr< T , U>& x) const {
return Type(x);
}
};
};
// gmpzq_class implicit interoperable with int
template <class T, class U>
struct Coercion_traits<
::__gmp_expr< T , U >, int >{
struct Coercion_traits< ::__gmp_expr< T , U>, ::__gmp_expr< T , U> >{
typedef Tag_true Are_explicit_interoperable;
typedef Tag_true Are_implicit_interoperable;
typedef ::__gmp_expr< T , T > Type;
struct Cast{
typedef Type result_type;
template <class U3>
Type operator()(const ::__gmp_expr< T , U3>& x) const {
template <class X>
Type operator()(const X& x) const {
return x;
}
Type operator()(int x) const { return Type(x); }
};
};
// gmpz_class implicit interoperable with int
template <class T, class U1, class U2>
struct Coercion_traits< ::__gmp_expr< T , U1>, ::__gmp_expr< T , U2> >
: Coercion_traits< ::__gmp_expr<T,T>, ::__gmp_expr<T,T> > {};
//mixed mpz_class + mpq_class, ignore the possibility of mpf_class
template <class T1 , class T2, class U1, class U2>
struct Coercion_traits< ::__gmp_expr< T1 , U1>, ::__gmp_expr< T2 , U2> >
: Coercion_traits< mpq_class, mpq_class > {};
// gmpzq_class implicit interoperable with int, short, long
template <class T, class U>
struct Coercion_traits< ::__gmp_expr< T , U >, int >
: public Coercion_traits< ::__gmp_expr< T , T >, ::__gmp_expr< T , T > > {};
template <class U, class T>
struct Coercion_traits< int , ::__gmp_expr< T , U> >
:public Coercion_traits< ::__gmp_expr< T , U>, int >{};
: public Coercion_traits< ::__gmp_expr< T , T >, ::__gmp_expr< T , T > > {};
template <class T, class U>
struct Coercion_traits< ::__gmp_expr< T , U >, long >
: public Coercion_traits< ::__gmp_expr< T , T >, ::__gmp_expr< T , T > > {};
template <class T, class U>
struct Coercion_traits< long , ::__gmp_expr< T , U > >
: public Coercion_traits< ::__gmp_expr< T , T >, ::__gmp_expr< T , T > > {};
template <class T, class U>
struct Coercion_traits< ::__gmp_expr< T , U >, short >
: public Coercion_traits< ::__gmp_expr< T , T >, ::__gmp_expr< T , T > > {};
template <class T, class U>
struct Coercion_traits< short , ::__gmp_expr< T , U > >
: public Coercion_traits< ::__gmp_expr< T , T >, ::__gmp_expr< T , T > > {};
// The traits are identical for float/double. The implicit conversion from double to mpz_class might disappear some day, but hopefully by that time CGAL will not support antediluvian versions of GMP anymore, which will make it easier to specialize the traits (or we will have a default version of Coercion_traits based on std::common_type and we can remove this file).
template <class T, class U>
struct Coercion_traits< ::__gmp_expr< T , U >, double >
: public Coercion_traits< ::__gmp_expr< T , T >, ::__gmp_expr< T , T > > {};
template <class T, class U>
struct Coercion_traits< double , ::__gmp_expr< T , U > >
: public Coercion_traits< ::__gmp_expr< T , T >, ::__gmp_expr< T , T > > {};
template <class T, class U>
struct Coercion_traits< ::__gmp_expr< T , U >, float >
: public Coercion_traits< ::__gmp_expr< T , T >, ::__gmp_expr< T , T > > {};
template <class T, class U>
struct Coercion_traits< float , ::__gmp_expr< T , U > >
: public Coercion_traits< ::__gmp_expr< T , T >, ::__gmp_expr< T , T > > {};
} //namespace CGAL

View File

@ -134,7 +134,10 @@ NT prs_resultant_ufd(Polynomial<NT> A, Polynomial<NT> B) {
delta = A.degree();
g = B.lcoeff();
internal::hgdelta_update(h, g, delta);
h = signflip ? -(t*h) : t*h;
if (signflip)
h = -(t*h);
else
h = t*h;
typename Algebraic_structure_traits<NT>::Simplify simplify;
simplify(h);
return h;

View File

@ -57,6 +57,12 @@ namespace QP_from_mps_detail {
struct MPS_type_name<int> {
static const char *name() { return "integer"; }
};
#ifdef CGAL_USE_GMPXX
template<>
struct MPS_type_name<mpq_class> {
static const char *name() { return "rational"; }
};
#endif
#ifdef CGAL_USE_GMP
template<>
struct MPS_type_name<CGAL::Gmpq> {
@ -83,10 +89,22 @@ namespace QP_from_mps_detail {
};
#ifdef CGAL_USE_GMP
#ifdef CGAL_USE_GMPXX
template<>
struct IT_to_ET<int> {
typedef mpz_class ET;
};
template<>
struct IT_to_ET<mpq_class> {
typedef mpq_class ET;
};
#else
template<>
struct IT_to_ET<int> {
typedef CGAL::Gmpz ET;
};
#endif
template<>
struct IT_to_ET<CGAL::Gmpq> {
@ -199,14 +217,14 @@ void create_shifted_instance(const CGAL::Quadratic_program_from_mps <IT>& qp,
std::vector<IT> Av(m, IT(0));
for (int i=0; i<m; ++i)
for (int j=0; j<n; ++j)
Av[i] += (*(qp.get_a()+j))[i] * v[j];
Av[i] += (const IT&)(*(qp.get_a()+j))[i] * v[j];
// compute - 2 v^T D into mvTD:
std::vector<IT> mvTD(n, IT(0)); // -2D^Tv
for (int i=0; i<n; ++i) {
for (int j=0; j<n; ++j)
mvTD[i]
+= ( j <= i ? (*(qp.get_d()+i))[j] : (*(qp.get_d()+j))[i]) * v[j];
+= ( j <= i ? (const IT&)(*(qp.get_d()+i))[j] : (const IT&)(*(qp.get_d()+j))[i]) * v[j];
mvTD[i] *= -1;
}

View File

@ -62,8 +62,8 @@ private:
x4 = s2.target().x(),
y4 = s2.target().y();
FT det = determinant(x2 - x1, x4 - x3,
y2 - y1, y4 - y3);
FT det = determinant<FT>(x2 - x1, x4 - x3,
y2 - y1, y4 - y3);
return ( CGAL::sign(det) == CGAL::ZERO );
}

View File

@ -107,11 +107,11 @@ public:
const FT k_q = tq * u;
const FT k_r = tr * u;
return
sign_of_determinant(tp.x(), tp.y(), tp.z(), (tp2 + k_p) * u2 - k_p * k_p,
tr.x(), tr.y(), tr.z(), (tr2 + k_r) * u2 - k_r * k_r,
tq.x(), tq.y(), tq.z(), (tq2 + k_q) * u2 - k_q * k_q,
u.x(), u.y(), u.z(), u2 * u2);
return sign_of_determinant<FT>(
tp.x(), tp.y(), tp.z(), (tp2 + k_p) * u2 - k_p * k_p,
tr.x(), tr.y(), tr.z(), (tr2 + k_r) * u2 - k_r * k_r,
tq.x(), tq.y(), tq.z(), (tq2 + k_q) * u2 - k_q * k_q,
u.x(), u.y(), u.z(), u2 * u2);
// Note that q and r have been swapped in the determinant above, to
// inverse its sign.
}

View File

@ -1,5 +1,5 @@
0.5 2
0.5 2
1/2 2
1/2 2
0
6