diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h index 601dcf5c9a0..7e49bb62376 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h @@ -55,10 +55,10 @@ equal_lineC2(const FT &l1a, const FT &l1b, const FT &l1c, return false; // Not parallel. typename Sgn::result_type s1a = CGAL_NTS sign(l1a); if (s1a != ZERO) - return s1a == CGAL_NTS sign(l2a) - && sign_of_determinant(l1a, l1c, l2a, l2c) == ZERO; - return CGAL_NTS sign(l1b) == CGAL_NTS sign(l2b) - && sign_of_determinant(l1b, l1c, l2b, l2c) == ZERO; + return CGAL_AND(s1a == CGAL_NTS sign(l2a), + sign_of_determinant(l1a, l1c, l2a, l2c) == ZERO); + return CGAL_AND(CGAL_NTS sign(l1b) == CGAL_NTS sign(l2b), + sign_of_determinant(l1b, l1c, l2b, l2c) == ZERO); } template < class FT > @@ -230,7 +230,7 @@ compare_y_at_x_segment_C2(const FT &px, CGAL_kernel_precondition(are_ordered(s1sx, px, s1tx)); CGAL_kernel_precondition(are_ordered(s2sx, px, s2tx)); - if (s1sx != s1tx && s2sx != s2tx) { + if (CGAL_AND(s1sx != s1tx, s2sx != s2tx)) { FT s1stx = s1sx-s1tx; FT s2stx = s2sx-s2tx; @@ -265,9 +265,9 @@ typename Equal_to::result_type equal_directionC2(const FT &dx1, const FT &dy1, const FT &dx2, const FT &dy2) { - return CGAL_NTS sign(dx1) == CGAL_NTS sign(dx2) - && CGAL_NTS sign(dy1) == CGAL_NTS sign(dy2) - && sign_of_determinant(dx1, dy1, dx2, dy2) == ZERO; + return CGAL_AND_3( CGAL_NTS sign(dx1) == CGAL_NTS sign(dx2), + CGAL_NTS sign(dy1) == CGAL_NTS sign(dy2), + sign_of_determinant(dx1, dy1, dx2, dy2) == ZERO ); } template < class FT > @@ -391,7 +391,9 @@ typename Compare::result_type compare_lexicographically_xyC2(const FT &px, const FT &py, const FT &qx, const FT &qy) { - typename Compare::result_type c = CGAL_NTS compare(px,qx); + typedef typename Compare::result_type Cmp; + Cmp c = CGAL_NTS compare(px,qx); + if (is_indeterminate(c)) return indeterminate(); return (c != EQUAL) ? c : CGAL_NTS compare(py,qy); } diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h index ba15fd30790..8765d0cb587 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h @@ -61,8 +61,10 @@ compare_lexicographically_xyzC3(const FT &px, const FT &py, const FT &pz, { typedef typename Compare::result_type Cmp; Cmp c = CGAL_NTS compare(px, qx); + if (is_indeterminate(c)) return indeterminate(); if (c != EQUAL) return c; c = CGAL_NTS compare(py, qy); + if (is_indeterminate(c)) return indeterminate(); if (c != EQUAL) return c; return CGAL_NTS compare(pz, qz); } @@ -288,12 +290,12 @@ typename Equal_to::result_type equal_directionC3(const FT &dx1, const FT &dy1, const FT &dz1, const FT &dx2, const FT &dy2, const FT &dz2) { - return sign_of_determinant(dx1, dy1, dx2, dy2) == ZERO - && sign_of_determinant(dx1, dz1, dx2, dz2) == ZERO - && sign_of_determinant(dy1, dz1, dy2, dz2) == ZERO - && CGAL_NTS sign(dx1) == CGAL_NTS sign(dx2) - && CGAL_NTS sign(dy1) == CGAL_NTS sign(dy2) - && CGAL_NTS sign(dz1) == CGAL_NTS sign(dz2); + return CGAL_AND_6(sign_of_determinant(dx1, dy1, dx2, dy2) == ZERO, + sign_of_determinant(dx1, dz1, dx2, dz2) == ZERO, + sign_of_determinant(dy1, dz1, dy2, dz2) == ZERO, + CGAL_NTS sign(dx1) == CGAL_NTS sign(dx2), + CGAL_NTS sign(dy1) == CGAL_NTS sign(dy2), + CGAL_NTS sign(dz1) == CGAL_NTS sign(dz2) ); } template < class FT > @@ -313,10 +315,10 @@ equal_planeC3(const FT &ha, const FT &hb, const FT &hc, const FT &hd, sign_of_determinant(pa, pd, ha, hd) == ZERO ); Sg s1b = CGAL_NTS sign(hb); if (s1b != ZERO) - return s1b == CGAL_NTS sign(pb) - && sign_of_determinant(pb, pd, hb, hd) == ZERO; - return CGAL_NTS sign(pc) == CGAL_NTS sign(hc) - && sign_of_determinant(pc, pd, hc, hd) == ZERO; + return CGAL_AND(s1b == CGAL_NTS sign(pb), + sign_of_determinant(pb, pd, hb, hd) == ZERO ); + return CGAL_AND( CGAL_NTS sign(pc) == CGAL_NTS sign(hc), + sign_of_determinant(pc, pd, hc, hd) == ZERO ); } template diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 1a803d094ae..40d05f8094d 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -3111,7 +3111,7 @@ namespace CommonKernelFunctors { result_type operator()(const Iso_rectangle_2& i1, const Iso_rectangle_2& i2) const { - return ((i1.min)() == (i2.min)()) && ((i1.max)() == (i2.max)()); + return CGAL_AND((i1.min)() == (i2.min)(), (i1.max)() == (i2.max)()); } }; @@ -3138,7 +3138,7 @@ namespace CommonKernelFunctors { result_type operator()(const Point_3 &p, const Point_3 &q) const { - return p.x() == q.x() && p.y() == q.y() && p.z() == q.z(); + return CGAL_AND_3(p.x() == q.x(), p.y() == q.y(), p.z() == q.z()); } result_type diff --git a/STL_Extension/include/CGAL/Uncertain.h b/STL_Extension/include/CGAL/Uncertain.h index 21f46a9196a..1a7539b2b24 100644 --- a/STL_Extension/include/CGAL/Uncertain.h +++ b/STL_Extension/include/CGAL/Uncertain.h @@ -348,6 +348,7 @@ Uncertain operator&(Uncertain a, bool b) #endif #define CGAL_AND_3(X, Y, Z) CGAL_AND(X, CGAL_AND(Y, Z)) +#define CGAL_AND_6(A, B, C, D, E, F) CGAL_AND(CGAL_AND_3(A, B, C), CGAL_AND_3(D, E,F)) #define CGAL_OR_3(X, Y, Z) CGAL_OR(X, CGAL_OR(Y, Z))