diff --git a/Packages/Interval_arithmetic/changes.txt b/Packages/Interval_arithmetic/changes.txt index a19d7a0b1c2..fee825445bc 100644 --- a/Packages/Interval_arithmetic/changes.txt +++ b/Packages/Interval_arithmetic/changes.txt @@ -1,6 +1,8 @@ Version 4.129 on 28 January 2002 - Fix bug reported by Tamal : Static_filters<>'s functors copy ctors and assignment operators were empty, while they should copy the data members. +- Remove the static adaptative filters generation from the + scripts/filtered_predicate_generator.pl (option -s to activate them again). Version 4.128 on 10 January 2002 - std::abort -> CGAL_CLIB_STD::abort(). diff --git a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_ftC2.h b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_ftC2.h index 2f752cbf90d..e032a69f544 100644 --- a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_ftC2.h +++ b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_ftC2.h @@ -94,287 +94,6 @@ power_testC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_power_testC2_12 -{ - static double _bound; - static double _epsilon_0; - - static Oriented_side update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pwt, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qwt, - const Static_filter_error &rx, - const Static_filter_error &ry, - const Static_filter_error &rwt, - const Static_filter_error &tx, - const Static_filter_error &ty, - const Static_filter_error &twt, - double & epsilon_0) - { - typedef Static_filter_error FT; - - - - - FT dpx = px - tx; - FT dpy = py - ty; - FT dpz = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) - pwt + twt; - FT dqx = qx - tx; - FT dqy = qy - ty; - FT dqz = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) - qwt + twt; - FT drx = rx - tx; - FT dry = ry - ty; - FT drz = CGAL_NTS square(drx) + CGAL_NTS square(dry) - rwt + twt; - - return Oriented_side(Static_Filtered_sign_of_determinant3x3_9::update_epsilon(dpx, dpy, dpz, - dqx, dqy, dqz, - drx, dry, drz, - epsilon_0)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Oriented_side epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pwt, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qwt, - const Restricted_double &rx, - const Restricted_double &ry, - const Restricted_double &rwt, - const Restricted_double &tx, - const Restricted_double &ty, - const Restricted_double &twt, - const double & epsilon_0) - { - typedef Restricted_double FT; - - - - - FT dpx = px - tx; - FT dpy = py - ty; - FT dpz = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) - pwt + twt; - FT dqx = qx - tx; - FT dqy = qy - ty; - FT dqz = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) - qwt + twt; - FT drx = rx - tx; - FT dry = ry - ty; - FT drz = CGAL_NTS square(drx) + CGAL_NTS square(dry) - rwt + twt; - - return Oriented_side(Static_Filtered_sign_of_determinant3x3_9::epsilon_variant(dpx, dpy, dpz, - dqx, dqy, dqz, - drx, dry, drz, - epsilon_0)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pwt, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qwt, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rwt, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &twt) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_power_testC2_12::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rwt.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pwt.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qwt.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - NEW_bound = max(NEW_bound, fabs(rwt.to_double())); - NEW_bound = max(NEW_bound, fabs(tx.to_double())); - NEW_bound = max(NEW_bound, fabs(ty.to_double())); - NEW_bound = max(NEW_bound, fabs(twt.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA power_testC2 updates"); - ++updates; -#endif - Static_Filtered_power_testC2_12::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA power_testC2 calls"); - ++calls; -#endif - return Static_Filtered_power_testC2_12::epsilon_variant( - px.dbl(), - py.dbl(), - pwt.dbl(), - qx.dbl(), - qy.dbl(), - qwt.dbl(), - rx.dbl(), - ry.dbl(), - rwt.dbl(), - tx.dbl(), - ty.dbl(), - twt.dbl(), - Static_Filtered_power_testC2_12::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA power_testC2 failures"); - ++failures; -#endif - return power_testC2( - px.exact(), - py.exact(), - pwt.exact(), - qx.exact(), - qy.exact(), - qwt.exact(), - rx.exact(), - ry.exact(), - rwt.exact(), - tx.exact(), - ty.exact(), - twt.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pwt, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qwt, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rwt, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &twt) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_power_testC2_12::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rwt.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST power_testC2 calls"); - ++calls; -#endif - return Static_Filtered_power_testC2_12::epsilon_variant( - px.dbl(), - py.dbl(), - pwt.dbl(), - qx.dbl(), - qy.dbl(), - qwt.dbl(), - rx.dbl(), - ry.dbl(), - rwt.dbl(), - tx.dbl(), - ty.dbl(), - twt.dbl(), - Static_Filtered_power_testC2_12::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST power_testC2 failures"); - ++failures; -#endif - return power_testC2( - px.exact(), - py.exact(), - pwt.exact(), - qx.exact(), - qy.exact(), - qwt.exact(), - rx.exact(), - ry.exact(), - rwt.exact(), - tx.exact(), - ty.exact(), - twt.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -432,272 +151,6 @@ power_testC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_power_testC2_9 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3; - - static Oriented_side update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pwt, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qwt, - const Static_filter_error &tx, - const Static_filter_error &ty, - const Static_filter_error &twt, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2, - double & epsilon_3) - { - typedef Static_filter_error FT; - - - FT dpx = px - tx; - FT dpy = py - ty; - FT dpz = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) - pwt + twt; - FT dqx = qx - tx; - FT dqy = qy - ty; - FT dqz = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) - qwt + twt; - - - Comparison_result cmpx = CGAL_NTS Static_Filtered_compare_2::update_epsilon(px, qx, - epsilon_0); - if (cmpx != EQUAL) - return Oriented_side(cmpx * Static_Filtered_sign_of_determinant2x2_4::update_epsilon(dpx, dpz, dqx, dqz, - epsilon_1)); - - - Comparison_result cmpy = CGAL_NTS Static_Filtered_compare_2::update_epsilon(py, qy, - epsilon_2); - return Oriented_side(cmpy * Static_Filtered_sign_of_determinant2x2_4::update_epsilon(dpy, dpz, dqy, dqz, - epsilon_3)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3); - // TODO: We should verify that all epsilons have really been updated. - } - - static Oriented_side epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pwt, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qwt, - const Restricted_double &tx, - const Restricted_double &ty, - const Restricted_double &twt, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2, - const double & epsilon_3) - { - typedef Restricted_double FT; - - - FT dpx = px - tx; - FT dpy = py - ty; - FT dpz = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) - pwt + twt; - FT dqx = qx - tx; - FT dqy = qy - ty; - FT dqz = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) - qwt + twt; - - - Comparison_result cmpx = CGAL_NTS Static_Filtered_compare_2::epsilon_variant(px, qx, - epsilon_0); - if (cmpx != EQUAL) - return Oriented_side(cmpx * Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(dpx, dpz, dqx, dqz, - epsilon_1)); - - - Comparison_result cmpy = CGAL_NTS Static_Filtered_compare_2::epsilon_variant(py, qy, - epsilon_2); - return Oriented_side(cmpy * Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(dpy, dpz, dqy, dqz, - epsilon_3)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pwt, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qwt, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &twt) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_power_testC2_9::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pwt.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qwt.to_double())); - NEW_bound = max(NEW_bound, fabs(tx.to_double())); - NEW_bound = max(NEW_bound, fabs(ty.to_double())); - NEW_bound = max(NEW_bound, fabs(twt.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA power_testC2 updates"); - ++updates; -#endif - Static_Filtered_power_testC2_9::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA power_testC2 calls"); - ++calls; -#endif - return Static_Filtered_power_testC2_9::epsilon_variant( - px.dbl(), - py.dbl(), - pwt.dbl(), - qx.dbl(), - qy.dbl(), - qwt.dbl(), - tx.dbl(), - ty.dbl(), - twt.dbl(), - Static_Filtered_power_testC2_9::_epsilon_0, - Static_Filtered_power_testC2_9::_epsilon_1, - Static_Filtered_power_testC2_9::_epsilon_2, - Static_Filtered_power_testC2_9::_epsilon_3); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA power_testC2 failures"); - ++failures; -#endif - return power_testC2( - px.exact(), - py.exact(), - pwt.exact(), - qx.exact(), - qy.exact(), - qwt.exact(), - tx.exact(), - ty.exact(), - twt.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pwt, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qwt, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &twt) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_power_testC2_9::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST power_testC2 calls"); - ++calls; -#endif - return Static_Filtered_power_testC2_9::epsilon_variant( - px.dbl(), - py.dbl(), - pwt.dbl(), - qx.dbl(), - qy.dbl(), - qwt.dbl(), - tx.dbl(), - ty.dbl(), - twt.dbl(), - Static_Filtered_power_testC2_9::_epsilon_0, - Static_Filtered_power_testC2_9::_epsilon_1, - Static_Filtered_power_testC2_9::_epsilon_2, - Static_Filtered_power_testC2_9::_epsilon_3); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST power_testC2 failures"); - ++failures; -#endif - return power_testC2( - px.exact(), - py.exact(), - pwt.exact(), - qx.exact(), - qy.exact(), - qwt.exact(), - tx.exact(), - ty.exact(), - twt.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - CGAL_END_NAMESPACE #endif // CGAL_ARITHMETIC_FILTER_REGULAR_TRIANGULATION_FTC2_H diff --git a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_ftC3.h b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_ftC3.h index 9ad20eb76ee..0f4608b2f35 100644 --- a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_ftC3.h +++ b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_ftC3.h @@ -118,395 +118,6 @@ power_testC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_power_testC3_20 -{ - static double _bound; - static double _epsilon_0; - - static Oriented_side update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &pwt, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - const Static_filter_error &qwt, - const Static_filter_error &rx, - const Static_filter_error &ry, - const Static_filter_error &rz, - const Static_filter_error &rwt, - const Static_filter_error &sx, - const Static_filter_error &sy, - const Static_filter_error &sz, - const Static_filter_error &swt, - const Static_filter_error &tx, - const Static_filter_error &ty, - const Static_filter_error &tz, - const Static_filter_error &twt, - double & epsilon_0) - { - typedef Static_filter_error FT; - - - FT dpx = px - tx; - FT dpy = py - ty; - FT dpz = pz - tz; - FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) + - CGAL_NTS square(dpz) - pwt + twt; - FT dqx = qx - tx; - FT dqy = qy - ty; - FT dqz = qz - tz; - FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) + - CGAL_NTS square(dqz) - qwt + twt; - FT drx = rx - tx; - FT dry = ry - ty; - FT drz = rz - tz; - FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) + - CGAL_NTS square(drz) - rwt + twt; - FT dsx = sx - tx; - FT dsy = sy - ty; - FT dsz = sz - tz; - FT dst = CGAL_NTS square(dsx) + CGAL_NTS square(dsy) + - CGAL_NTS square(dsz) - swt + twt; - - return Oriented_side( - Static_Filtered_sign_of_determinant4x4_16::update_epsilon(dpx, dpy, dpz, dpt, - dqx, dqy, dqz, dqt, - drx, dry, drz, drt, - dsx, dsy, dsz, dst, - epsilon_0)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Oriented_side epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &pwt, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const Restricted_double &qwt, - const Restricted_double &rx, - const Restricted_double &ry, - const Restricted_double &rz, - const Restricted_double &rwt, - const Restricted_double &sx, - const Restricted_double &sy, - const Restricted_double &sz, - const Restricted_double &swt, - const Restricted_double &tx, - const Restricted_double &ty, - const Restricted_double &tz, - const Restricted_double &twt, - const double & epsilon_0) - { - typedef Restricted_double FT; - - - FT dpx = px - tx; - FT dpy = py - ty; - FT dpz = pz - tz; - FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) + - CGAL_NTS square(dpz) - pwt + twt; - FT dqx = qx - tx; - FT dqy = qy - ty; - FT dqz = qz - tz; - FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) + - CGAL_NTS square(dqz) - qwt + twt; - FT drx = rx - tx; - FT dry = ry - ty; - FT drz = rz - tz; - FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) + - CGAL_NTS square(drz) - rwt + twt; - FT dsx = sx - tx; - FT dsy = sy - ty; - FT dsz = sz - tz; - FT dst = CGAL_NTS square(dsx) + CGAL_NTS square(dsy) + - CGAL_NTS square(dsz) - swt + twt; - - return Oriented_side( - Static_Filtered_sign_of_determinant4x4_16::epsilon_variant(dpx, dpy, dpz, dpt, - dqx, dqy, dqz, dqt, - drx, dry, drz, drt, - dsx, dsy, dsz, dst, - epsilon_0)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &pwt, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &qwt, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz, - const Filtered_exact &rwt, - const Filtered_exact &sx, - const Filtered_exact &sy, - const Filtered_exact &sz, - const Filtered_exact &swt, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz, - const Filtered_exact &twt) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_power_testC3_20::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound || - fabs(rwt.to_double()) > SAF_bound || - fabs(sx.to_double()) > SAF_bound || - fabs(sy.to_double()) > SAF_bound || - fabs(sz.to_double()) > SAF_bound || - fabs(swt.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(pwt.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - NEW_bound = max(NEW_bound, fabs(qwt.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - NEW_bound = max(NEW_bound, fabs(rz.to_double())); - NEW_bound = max(NEW_bound, fabs(rwt.to_double())); - NEW_bound = max(NEW_bound, fabs(sx.to_double())); - NEW_bound = max(NEW_bound, fabs(sy.to_double())); - NEW_bound = max(NEW_bound, fabs(sz.to_double())); - NEW_bound = max(NEW_bound, fabs(swt.to_double())); - NEW_bound = max(NEW_bound, fabs(tx.to_double())); - NEW_bound = max(NEW_bound, fabs(ty.to_double())); - NEW_bound = max(NEW_bound, fabs(tz.to_double())); - NEW_bound = max(NEW_bound, fabs(twt.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA power_testC3 updates"); - ++updates; -#endif - Static_Filtered_power_testC3_20::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA power_testC3 calls"); - ++calls; -#endif - return Static_Filtered_power_testC3_20::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - pwt.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - qwt.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - rwt.dbl(), - sx.dbl(), - sy.dbl(), - sz.dbl(), - swt.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - twt.dbl(), - Static_Filtered_power_testC3_20::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA power_testC3 failures"); - ++failures; -#endif - return power_testC3( - px.exact(), - py.exact(), - pz.exact(), - pwt.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - qwt.exact(), - rx.exact(), - ry.exact(), - rz.exact(), - rwt.exact(), - sx.exact(), - sy.exact(), - sz.exact(), - swt.exact(), - tx.exact(), - ty.exact(), - tz.exact(), - twt.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &pwt, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &qwt, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz, - const Filtered_exact &rwt, - const Filtered_exact &sx, - const Filtered_exact &sy, - const Filtered_exact &sz, - const Filtered_exact &swt, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz, - const Filtered_exact &twt) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_power_testC3_20::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound || - fabs(rwt.to_double()) > SAF_bound || - fabs(sx.to_double()) > SAF_bound || - fabs(sy.to_double()) > SAF_bound || - fabs(sz.to_double()) > SAF_bound || - fabs(swt.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST power_testC3 calls"); - ++calls; -#endif - return Static_Filtered_power_testC3_20::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - pwt.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - qwt.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - rwt.dbl(), - sx.dbl(), - sy.dbl(), - sz.dbl(), - swt.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - twt.dbl(), - Static_Filtered_power_testC3_20::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST power_testC3 failures"); - ++failures; -#endif - return power_testC3( - px.exact(), - py.exact(), - pz.exact(), - pwt.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - qwt.exact(), - rx.exact(), - ry.exact(), - rz.exact(), - rwt.exact(), - sx.exact(), - sy.exact(), - sz.exact(), - swt.exact(), - tx.exact(), - ty.exact(), - tz.exact(), - twt.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -585,409 +196,6 @@ power_testC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_power_testC3_16 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4,_epsilon_5; - - static Oriented_side update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &pwt, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - const Static_filter_error &qwt, - const Static_filter_error &rx, - const Static_filter_error &ry, - const Static_filter_error &rz, - const Static_filter_error &rwt, - const Static_filter_error &tx, - const Static_filter_error &ty, - const Static_filter_error &tz, - const Static_filter_error &twt, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2, - double & epsilon_3, - double & epsilon_4, - double & epsilon_5) - { - typedef Static_filter_error FT; - - - FT dpx = px - tx; - FT dpy = py - ty; - FT dpz = pz - tz; - FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) + - CGAL_NTS square(dpz) - pwt + twt; - FT dqx = qx - tx; - FT dqy = qy - ty; - FT dqz = qz - tz; - FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) + - CGAL_NTS square(dqz) - qwt + twt; - FT drx = rx - tx; - FT dry = ry - ty; - FT drz = rz - tz; - FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) + - CGAL_NTS square(drz) - rwt + twt; - Sign cmp; - - - cmp = Static_Filtered_sign_of_determinant3x3_9::update_epsilon(dpx, dpy, dpt, - dqx, dqy, dqt, - drx, dry, drt, - epsilon_0); - if (cmp != ZERO) - return Oriented_side(cmp * Static_Filtered_sign_of_determinant2x2_4::update_epsilon(px-rx, py-ry, - qx-rx, qy-ry, - epsilon_1)); - - - cmp = Static_Filtered_sign_of_determinant3x3_9::update_epsilon(dpx, dpz, dpt, - dqx, dqz, dqt, - drx, drz, drt, - epsilon_2); - if (cmp != ZERO) - return Oriented_side(cmp * Static_Filtered_sign_of_determinant2x2_4::update_epsilon(px-rx, pz-rz, - qx-rx, qz-rz, - epsilon_3)); - - - cmp = Static_Filtered_sign_of_determinant3x3_9::update_epsilon(dpy, dpz, dpt, - dqy, dqz, dqt, - dry, drz, drt, - epsilon_4); - return Oriented_side(cmp * Static_Filtered_sign_of_determinant2x2_4::update_epsilon(py-ry, pz-rz, - qy-ry, qz-rz, - epsilon_5)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4,_epsilon_5); - // TODO: We should verify that all epsilons have really been updated. - } - - static Oriented_side epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &pwt, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const Restricted_double &qwt, - const Restricted_double &rx, - const Restricted_double &ry, - const Restricted_double &rz, - const Restricted_double &rwt, - const Restricted_double &tx, - const Restricted_double &ty, - const Restricted_double &tz, - const Restricted_double &twt, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2, - const double & epsilon_3, - const double & epsilon_4, - const double & epsilon_5) - { - typedef Restricted_double FT; - - - FT dpx = px - tx; - FT dpy = py - ty; - FT dpz = pz - tz; - FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) + - CGAL_NTS square(dpz) - pwt + twt; - FT dqx = qx - tx; - FT dqy = qy - ty; - FT dqz = qz - tz; - FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) + - CGAL_NTS square(dqz) - qwt + twt; - FT drx = rx - tx; - FT dry = ry - ty; - FT drz = rz - tz; - FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) + - CGAL_NTS square(drz) - rwt + twt; - Sign cmp; - - - cmp = Static_Filtered_sign_of_determinant3x3_9::epsilon_variant(dpx, dpy, dpt, - dqx, dqy, dqt, - drx, dry, drt, - epsilon_0); - if (cmp != ZERO) - return Oriented_side(cmp * Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(px-rx, py-ry, - qx-rx, qy-ry, - epsilon_1)); - - - cmp = Static_Filtered_sign_of_determinant3x3_9::epsilon_variant(dpx, dpz, dpt, - dqx, dqz, dqt, - drx, drz, drt, - epsilon_2); - if (cmp != ZERO) - return Oriented_side(cmp * Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(px-rx, pz-rz, - qx-rx, qz-rz, - epsilon_3)); - - - cmp = Static_Filtered_sign_of_determinant3x3_9::epsilon_variant(dpy, dpz, dpt, - dqy, dqz, dqt, - dry, drz, drt, - epsilon_4); - return Oriented_side(cmp * Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(py-ry, pz-rz, - qy-ry, qz-rz, - epsilon_5)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &pwt, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &qwt, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz, - const Filtered_exact &rwt, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz, - const Filtered_exact &twt) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_power_testC3_16::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound || - fabs(rwt.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(pwt.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - NEW_bound = max(NEW_bound, fabs(qwt.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - NEW_bound = max(NEW_bound, fabs(rz.to_double())); - NEW_bound = max(NEW_bound, fabs(rwt.to_double())); - NEW_bound = max(NEW_bound, fabs(tx.to_double())); - NEW_bound = max(NEW_bound, fabs(ty.to_double())); - NEW_bound = max(NEW_bound, fabs(tz.to_double())); - NEW_bound = max(NEW_bound, fabs(twt.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA power_testC3 updates"); - ++updates; -#endif - Static_Filtered_power_testC3_16::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA power_testC3 calls"); - ++calls; -#endif - return Static_Filtered_power_testC3_16::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - pwt.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - qwt.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - rwt.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - twt.dbl(), - Static_Filtered_power_testC3_16::_epsilon_0, - Static_Filtered_power_testC3_16::_epsilon_1, - Static_Filtered_power_testC3_16::_epsilon_2, - Static_Filtered_power_testC3_16::_epsilon_3, - Static_Filtered_power_testC3_16::_epsilon_4, - Static_Filtered_power_testC3_16::_epsilon_5); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA power_testC3 failures"); - ++failures; -#endif - return power_testC3( - px.exact(), - py.exact(), - pz.exact(), - pwt.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - qwt.exact(), - rx.exact(), - ry.exact(), - rz.exact(), - rwt.exact(), - tx.exact(), - ty.exact(), - tz.exact(), - twt.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &pwt, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &qwt, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz, - const Filtered_exact &rwt, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz, - const Filtered_exact &twt) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_power_testC3_16::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound || - fabs(rwt.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST power_testC3 calls"); - ++calls; -#endif - return Static_Filtered_power_testC3_16::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - pwt.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - qwt.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - rwt.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - twt.dbl(), - Static_Filtered_power_testC3_16::_epsilon_0, - Static_Filtered_power_testC3_16::_epsilon_1, - Static_Filtered_power_testC3_16::_epsilon_2, - Static_Filtered_power_testC3_16::_epsilon_3, - Static_Filtered_power_testC3_16::_epsilon_4, - Static_Filtered_power_testC3_16::_epsilon_5); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST power_testC3 failures"); - ++failures; -#endif - return power_testC3( - px.exact(), - py.exact(), - pz.exact(), - pwt.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - qwt.exact(), - rx.exact(), - ry.exact(), - rz.exact(), - rwt.exact(), - tx.exact(), - ty.exact(), - tz.exact(), - twt.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -1054,337 +262,6 @@ power_testC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_power_testC3_12 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4,_epsilon_5; - - static Oriented_side update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &pwt, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - const Static_filter_error &qwt, - const Static_filter_error &tx, - const Static_filter_error &ty, - const Static_filter_error &tz, - const Static_filter_error &twt, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2, - double & epsilon_3, - double & epsilon_4, - double & epsilon_5) - { - typedef Static_filter_error FT; - - - FT dpx = px - tx; - FT dpy = py - ty; - FT dpz = pz - tz; - FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) + - CGAL_NTS square(dpz) - pwt + twt; - FT dqx = qx - tx; - FT dqy = qy - ty; - FT dqz = qz - tz; - FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) + - CGAL_NTS square (dqz) - qwt + twt; - Comparison_result cmp; - - - cmp = CGAL_NTS Static_Filtered_compare_2::update_epsilon(px, qx, - epsilon_0); - if (cmp != EQUAL) - return Oriented_side(cmp * Static_Filtered_sign_of_determinant2x2_4::update_epsilon(dpx, dpt, dqx, dqt, - epsilon_1)); - - - cmp = CGAL_NTS Static_Filtered_compare_2::update_epsilon(py, qy, - epsilon_2); - if (cmp != EQUAL) - return Oriented_side(cmp * Static_Filtered_sign_of_determinant2x2_4::update_epsilon(dpy, dpt, dqy, dqt, - epsilon_3)); - - - cmp = CGAL_NTS Static_Filtered_compare_2::update_epsilon(pz, qz, - epsilon_4); - return Oriented_side(cmp * Static_Filtered_sign_of_determinant2x2_4::update_epsilon(dpz, dpt, dqz, dqt, - epsilon_5)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4,_epsilon_5); - // TODO: We should verify that all epsilons have really been updated. - } - - static Oriented_side epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &pwt, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const Restricted_double &qwt, - const Restricted_double &tx, - const Restricted_double &ty, - const Restricted_double &tz, - const Restricted_double &twt, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2, - const double & epsilon_3, - const double & epsilon_4, - const double & epsilon_5) - { - typedef Restricted_double FT; - - - FT dpx = px - tx; - FT dpy = py - ty; - FT dpz = pz - tz; - FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) + - CGAL_NTS square(dpz) - pwt + twt; - FT dqx = qx - tx; - FT dqy = qy - ty; - FT dqz = qz - tz; - FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) + - CGAL_NTS square (dqz) - qwt + twt; - Comparison_result cmp; - - - cmp = CGAL_NTS Static_Filtered_compare_2::epsilon_variant(px, qx, - epsilon_0); - if (cmp != EQUAL) - return Oriented_side(cmp * Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(dpx, dpt, dqx, dqt, - epsilon_1)); - - - cmp = CGAL_NTS Static_Filtered_compare_2::epsilon_variant(py, qy, - epsilon_2); - if (cmp != EQUAL) - return Oriented_side(cmp * Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(dpy, dpt, dqy, dqt, - epsilon_3)); - - - cmp = CGAL_NTS Static_Filtered_compare_2::epsilon_variant(pz, qz, - epsilon_4); - return Oriented_side(cmp * Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(dpz, dpt, dqz, dqt, - epsilon_5)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &pwt, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &qwt, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz, - const Filtered_exact &twt) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_power_testC3_12::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(pwt.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - NEW_bound = max(NEW_bound, fabs(qwt.to_double())); - NEW_bound = max(NEW_bound, fabs(tx.to_double())); - NEW_bound = max(NEW_bound, fabs(ty.to_double())); - NEW_bound = max(NEW_bound, fabs(tz.to_double())); - NEW_bound = max(NEW_bound, fabs(twt.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA power_testC3 updates"); - ++updates; -#endif - Static_Filtered_power_testC3_12::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA power_testC3 calls"); - ++calls; -#endif - return Static_Filtered_power_testC3_12::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - pwt.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - qwt.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - twt.dbl(), - Static_Filtered_power_testC3_12::_epsilon_0, - Static_Filtered_power_testC3_12::_epsilon_1, - Static_Filtered_power_testC3_12::_epsilon_2, - Static_Filtered_power_testC3_12::_epsilon_3, - Static_Filtered_power_testC3_12::_epsilon_4, - Static_Filtered_power_testC3_12::_epsilon_5); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA power_testC3 failures"); - ++failures; -#endif - return power_testC3( - px.exact(), - py.exact(), - pz.exact(), - pwt.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - qwt.exact(), - tx.exact(), - ty.exact(), - tz.exact(), - twt.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &pwt, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &qwt, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz, - const Filtered_exact &twt) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_power_testC3_12::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST power_testC3 calls"); - ++calls; -#endif - return Static_Filtered_power_testC3_12::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - pwt.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - qwt.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - twt.dbl(), - Static_Filtered_power_testC3_12::_epsilon_0, - Static_Filtered_power_testC3_12::_epsilon_1, - Static_Filtered_power_testC3_12::_epsilon_2, - Static_Filtered_power_testC3_12::_epsilon_3, - Static_Filtered_power_testC3_12::_epsilon_4, - Static_Filtered_power_testC3_12::_epsilon_5); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST power_testC3 failures"); - ++failures; -#endif - return power_testC3( - px.exact(), - py.exact(), - pz.exact(), - pwt.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - qwt.exact(), - tx.exact(), - ty.exact(), - tz.exact(), - twt.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - CGAL_END_NAMESPACE #endif // CGAL_ARITHMETIC_FILTER_REGULAR_TRIANGULATION_FTC3_H diff --git a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_rtH2.h b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_rtH2.h index ebc5b309dcb..6534f1cea12 100644 --- a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_rtH2.h +++ b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_rtH2.h @@ -106,347 +106,6 @@ power_testH2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_power_testH2_16 -{ - static double _bound; - static double _epsilon_0; - - static Oriented_side update_epsilon( - const Static_filter_error &phx, - const Static_filter_error &phy, - const Static_filter_error &phw, - const Static_filter_error &pwt, - const Static_filter_error &qhx, - const Static_filter_error &qhy, - const Static_filter_error &qhw, - const Static_filter_error &qwt, - const Static_filter_error &rhx, - const Static_filter_error &rhy, - const Static_filter_error &rhw, - const Static_filter_error &rwt, - const Static_filter_error &thx, - const Static_filter_error &thy, - const Static_filter_error &thw, - const Static_filter_error &twt, - double & epsilon_0) - { - typedef Static_filter_error RT; - - RT dphx = phx*phw; - RT dphy = phy*phw; - RT dphw = CGAL_NTS square(phw); - RT dpz = CGAL_NTS square(phx) + CGAL_NTS square(phy) - pwt*dphw; - - RT dqhx = qhx*qhw; - RT dqhy = qhy*qhw; - RT dqhw = CGAL_NTS square(qhw); - RT dqz = CGAL_NTS square(qhx) + CGAL_NTS square(qhy) - qwt*dqhw; - - RT drhx = rhx*rhw; - RT drhy = rhy*rhw; - RT drhw = CGAL_NTS square(rhw); - RT drz = CGAL_NTS square(rhx) + CGAL_NTS square(rhy) - rwt*drhw; - - RT dthx = thx*thw; - RT dthy = thy*thw; - RT dthw = CGAL_NTS square(thw); - RT dtz = CGAL_NTS square(thx) + CGAL_NTS square(thy) - twt*dthw; - - return Oriented_side(Static_Filtered_sign_of_determinant4x4_16::update_epsilon(dphx, dphy, dpz, dphw, - dqhx, dqhy, dqz, dqhw, - drhx, drhy, drz, drhw, - dthx, dthy, dtz, dthw, - epsilon_0)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Oriented_side epsilon_variant( - const Restricted_double &phx, - const Restricted_double &phy, - const Restricted_double &phw, - const Restricted_double &pwt, - const Restricted_double &qhx, - const Restricted_double &qhy, - const Restricted_double &qhw, - const Restricted_double &qwt, - const Restricted_double &rhx, - const Restricted_double &rhy, - const Restricted_double &rhw, - const Restricted_double &rwt, - const Restricted_double &thx, - const Restricted_double &thy, - const Restricted_double &thw, - const Restricted_double &twt, - const double & epsilon_0) - { - typedef Restricted_double RT; - - RT dphx = phx*phw; - RT dphy = phy*phw; - RT dphw = CGAL_NTS square(phw); - RT dpz = CGAL_NTS square(phx) + CGAL_NTS square(phy) - pwt*dphw; - - RT dqhx = qhx*qhw; - RT dqhy = qhy*qhw; - RT dqhw = CGAL_NTS square(qhw); - RT dqz = CGAL_NTS square(qhx) + CGAL_NTS square(qhy) - qwt*dqhw; - - RT drhx = rhx*rhw; - RT drhy = rhy*rhw; - RT drhw = CGAL_NTS square(rhw); - RT drz = CGAL_NTS square(rhx) + CGAL_NTS square(rhy) - rwt*drhw; - - RT dthx = thx*thw; - RT dthy = thy*thw; - RT dthw = CGAL_NTS square(thw); - RT dtz = CGAL_NTS square(thx) + CGAL_NTS square(thy) - twt*dthw; - - return Oriented_side(Static_Filtered_sign_of_determinant4x4_16::epsilon_variant(dphx, dphy, dpz, dphw, - dqhx, dqhy, dqz, dqhw, - drhx, drhy, drz, drhw, - dthx, dthy, dtz, dthw, - epsilon_0)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testH2( - const Filtered_exact &phx, - const Filtered_exact &phy, - const Filtered_exact &phw, - const Filtered_exact &pwt, - const Filtered_exact &qhx, - const Filtered_exact &qhy, - const Filtered_exact &qhw, - const Filtered_exact &qwt, - const Filtered_exact &rhx, - const Filtered_exact &rhy, - const Filtered_exact &rhw, - const Filtered_exact &rwt, - const Filtered_exact &thx, - const Filtered_exact &thy, - const Filtered_exact &thw, - const Filtered_exact &twt) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_power_testH2_16::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(phx.to_double()) > SAF_bound || - fabs(phy.to_double()) > SAF_bound || - fabs(phw.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qhx.to_double()) > SAF_bound || - fabs(qhy.to_double()) > SAF_bound || - fabs(qhw.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(rhx.to_double()) > SAF_bound || - fabs(rhy.to_double()) > SAF_bound || - fabs(rhw.to_double()) > SAF_bound || - fabs(rwt.to_double()) > SAF_bound || - fabs(thx.to_double()) > SAF_bound || - fabs(thy.to_double()) > SAF_bound || - fabs(thw.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(phx.to_double())); - NEW_bound = max(NEW_bound, fabs(phy.to_double())); - NEW_bound = max(NEW_bound, fabs(phw.to_double())); - NEW_bound = max(NEW_bound, fabs(pwt.to_double())); - NEW_bound = max(NEW_bound, fabs(qhx.to_double())); - NEW_bound = max(NEW_bound, fabs(qhy.to_double())); - NEW_bound = max(NEW_bound, fabs(qhw.to_double())); - NEW_bound = max(NEW_bound, fabs(qwt.to_double())); - NEW_bound = max(NEW_bound, fabs(rhx.to_double())); - NEW_bound = max(NEW_bound, fabs(rhy.to_double())); - NEW_bound = max(NEW_bound, fabs(rhw.to_double())); - NEW_bound = max(NEW_bound, fabs(rwt.to_double())); - NEW_bound = max(NEW_bound, fabs(thx.to_double())); - NEW_bound = max(NEW_bound, fabs(thy.to_double())); - NEW_bound = max(NEW_bound, fabs(thw.to_double())); - NEW_bound = max(NEW_bound, fabs(twt.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA power_testH2 updates"); - ++updates; -#endif - Static_Filtered_power_testH2_16::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA power_testH2 calls"); - ++calls; -#endif - return Static_Filtered_power_testH2_16::epsilon_variant( - phx.dbl(), - phy.dbl(), - phw.dbl(), - pwt.dbl(), - qhx.dbl(), - qhy.dbl(), - qhw.dbl(), - qwt.dbl(), - rhx.dbl(), - rhy.dbl(), - rhw.dbl(), - rwt.dbl(), - thx.dbl(), - thy.dbl(), - thw.dbl(), - twt.dbl(), - Static_Filtered_power_testH2_16::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA power_testH2 failures"); - ++failures; -#endif - return power_testH2( - phx.exact(), - phy.exact(), - phw.exact(), - pwt.exact(), - qhx.exact(), - qhy.exact(), - qhw.exact(), - qwt.exact(), - rhx.exact(), - rhy.exact(), - rhw.exact(), - rwt.exact(), - thx.exact(), - thy.exact(), - thw.exact(), - twt.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testH2( - const Filtered_exact &phx, - const Filtered_exact &phy, - const Filtered_exact &phw, - const Filtered_exact &pwt, - const Filtered_exact &qhx, - const Filtered_exact &qhy, - const Filtered_exact &qhw, - const Filtered_exact &qwt, - const Filtered_exact &rhx, - const Filtered_exact &rhy, - const Filtered_exact &rhw, - const Filtered_exact &rwt, - const Filtered_exact &thx, - const Filtered_exact &thy, - const Filtered_exact &thw, - const Filtered_exact &twt) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_power_testH2_16::_bound; ) - CGAL_assertion(!( - fabs(phx.to_double()) > SAF_bound || - fabs(phy.to_double()) > SAF_bound || - fabs(phw.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qhx.to_double()) > SAF_bound || - fabs(qhy.to_double()) > SAF_bound || - fabs(qhw.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(rhx.to_double()) > SAF_bound || - fabs(rhy.to_double()) > SAF_bound || - fabs(rhw.to_double()) > SAF_bound || - fabs(rwt.to_double()) > SAF_bound || - fabs(thx.to_double()) > SAF_bound || - fabs(thy.to_double()) > SAF_bound || - fabs(thw.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST power_testH2 calls"); - ++calls; -#endif - return Static_Filtered_power_testH2_16::epsilon_variant( - phx.dbl(), - phy.dbl(), - phw.dbl(), - pwt.dbl(), - qhx.dbl(), - qhy.dbl(), - qhw.dbl(), - qwt.dbl(), - rhx.dbl(), - rhy.dbl(), - rhw.dbl(), - rwt.dbl(), - thx.dbl(), - thy.dbl(), - thw.dbl(), - twt.dbl(), - Static_Filtered_power_testH2_16::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST power_testH2 failures"); - ++failures; -#endif - return power_testH2( - phx.exact(), - phy.exact(), - phw.exact(), - pwt.exact(), - qhx.exact(), - qhy.exact(), - qhw.exact(), - qwt.exact(), - rhx.exact(), - rhy.exact(), - rhw.exact(), - rwt.exact(), - thx.exact(), - thy.exact(), - thw.exact(), - twt.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -513,321 +172,6 @@ power_testH2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_power_testH2_12 -{ - static double _bound; - static double _epsilon_0,_epsilon_1; - - static Oriented_side update_epsilon( - const Static_filter_error &phx, - const Static_filter_error &phy, - const Static_filter_error &phw, - const Static_filter_error &pwt, - const Static_filter_error &qhx, - const Static_filter_error &qhy, - const Static_filter_error &qhw, - const Static_filter_error &qwt, - const Static_filter_error &thx, - const Static_filter_error &thy, - const Static_filter_error &thw, - const Static_filter_error &twt, - double & epsilon_0, - double & epsilon_1) - { - typedef Static_filter_error RT; - - - - RT pa, qa, ta; - - if (phx * qhw != qhx * phw ) - { - pa = phx*phw; - qa = qhx*qhw; - ta = thx*thw; - } - else - { - pa = phy*phw; - qa = qhy*qhw; - ta = thy*thw; - } - - RT dphw = CGAL_NTS square(phw); - RT dpz = CGAL_NTS square(phx) + CGAL_NTS square(phy) - pwt*dphw; - - RT dqhw = CGAL_NTS square(qhw); - RT dqz = CGAL_NTS square(qhx) + CGAL_NTS square(qhy) - qwt*dqhw; - - RT dthw = CGAL_NTS square(thw); - RT dtz = CGAL_NTS square(thx) + CGAL_NTS square(thy) - twt*dthw; - - return Oriented_side(CGAL_NTS Static_Filtered_compare_2::update_epsilon(pa, qa, - epsilon_0) * - Static_Filtered_sign_of_determinant3x3_9::update_epsilon(pa, dpz, dphw, - qa, dqz, dqhw, - ta, dtz, dthw, - epsilon_1)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0,_epsilon_1); - // TODO: We should verify that all epsilons have really been updated. - } - - static Oriented_side epsilon_variant( - const Restricted_double &phx, - const Restricted_double &phy, - const Restricted_double &phw, - const Restricted_double &pwt, - const Restricted_double &qhx, - const Restricted_double &qhy, - const Restricted_double &qhw, - const Restricted_double &qwt, - const Restricted_double &thx, - const Restricted_double &thy, - const Restricted_double &thw, - const Restricted_double &twt, - const double & epsilon_0, - const double & epsilon_1) - { - typedef Restricted_double RT; - - - - RT pa, qa, ta; - - if (phx * qhw != qhx * phw ) - { - pa = phx*phw; - qa = qhx*qhw; - ta = thx*thw; - } - else - { - pa = phy*phw; - qa = qhy*qhw; - ta = thy*thw; - } - - RT dphw = CGAL_NTS square(phw); - RT dpz = CGAL_NTS square(phx) + CGAL_NTS square(phy) - pwt*dphw; - - RT dqhw = CGAL_NTS square(qhw); - RT dqz = CGAL_NTS square(qhx) + CGAL_NTS square(qhy) - qwt*dqhw; - - RT dthw = CGAL_NTS square(thw); - RT dtz = CGAL_NTS square(thx) + CGAL_NTS square(thy) - twt*dthw; - - return Oriented_side(CGAL_NTS Static_Filtered_compare_2::epsilon_variant(pa, qa, - epsilon_0) * - Static_Filtered_sign_of_determinant3x3_9::epsilon_variant(pa, dpz, dphw, - qa, dqz, dqhw, - ta, dtz, dthw, - epsilon_1)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testH2( - const Filtered_exact &phx, - const Filtered_exact &phy, - const Filtered_exact &phw, - const Filtered_exact &pwt, - const Filtered_exact &qhx, - const Filtered_exact &qhy, - const Filtered_exact &qhw, - const Filtered_exact &qwt, - const Filtered_exact &thx, - const Filtered_exact &thy, - const Filtered_exact &thw, - const Filtered_exact &twt) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_power_testH2_12::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(phx.to_double()) > SAF_bound || - fabs(phy.to_double()) > SAF_bound || - fabs(phw.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qhx.to_double()) > SAF_bound || - fabs(qhy.to_double()) > SAF_bound || - fabs(qhw.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(thx.to_double()) > SAF_bound || - fabs(thy.to_double()) > SAF_bound || - fabs(thw.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(phx.to_double())); - NEW_bound = max(NEW_bound, fabs(phy.to_double())); - NEW_bound = max(NEW_bound, fabs(phw.to_double())); - NEW_bound = max(NEW_bound, fabs(pwt.to_double())); - NEW_bound = max(NEW_bound, fabs(qhx.to_double())); - NEW_bound = max(NEW_bound, fabs(qhy.to_double())); - NEW_bound = max(NEW_bound, fabs(qhw.to_double())); - NEW_bound = max(NEW_bound, fabs(qwt.to_double())); - NEW_bound = max(NEW_bound, fabs(thx.to_double())); - NEW_bound = max(NEW_bound, fabs(thy.to_double())); - NEW_bound = max(NEW_bound, fabs(thw.to_double())); - NEW_bound = max(NEW_bound, fabs(twt.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA power_testH2 updates"); - ++updates; -#endif - Static_Filtered_power_testH2_12::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA power_testH2 calls"); - ++calls; -#endif - return Static_Filtered_power_testH2_12::epsilon_variant( - phx.dbl(), - phy.dbl(), - phw.dbl(), - pwt.dbl(), - qhx.dbl(), - qhy.dbl(), - qhw.dbl(), - qwt.dbl(), - thx.dbl(), - thy.dbl(), - thw.dbl(), - twt.dbl(), - Static_Filtered_power_testH2_12::_epsilon_0, - Static_Filtered_power_testH2_12::_epsilon_1); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA power_testH2 failures"); - ++failures; -#endif - return power_testH2( - phx.exact(), - phy.exact(), - phw.exact(), - pwt.exact(), - qhx.exact(), - qhy.exact(), - qhw.exact(), - qwt.exact(), - thx.exact(), - thy.exact(), - thw.exact(), - twt.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testH2( - const Filtered_exact &phx, - const Filtered_exact &phy, - const Filtered_exact &phw, - const Filtered_exact &pwt, - const Filtered_exact &qhx, - const Filtered_exact &qhy, - const Filtered_exact &qhw, - const Filtered_exact &qwt, - const Filtered_exact &thx, - const Filtered_exact &thy, - const Filtered_exact &thw, - const Filtered_exact &twt) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_power_testH2_12::_bound; ) - CGAL_assertion(!( - fabs(phx.to_double()) > SAF_bound || - fabs(phy.to_double()) > SAF_bound || - fabs(phw.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qhx.to_double()) > SAF_bound || - fabs(qhy.to_double()) > SAF_bound || - fabs(qhw.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(thx.to_double()) > SAF_bound || - fabs(thy.to_double()) > SAF_bound || - fabs(thw.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST power_testH2 calls"); - ++calls; -#endif - return Static_Filtered_power_testH2_12::epsilon_variant( - phx.dbl(), - phy.dbl(), - phw.dbl(), - pwt.dbl(), - qhx.dbl(), - qhy.dbl(), - qhw.dbl(), - qwt.dbl(), - thx.dbl(), - thy.dbl(), - thw.dbl(), - twt.dbl(), - Static_Filtered_power_testH2_12::_epsilon_0, - Static_Filtered_power_testH2_12::_epsilon_1); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST power_testH2 failures"); - ++failures; -#endif - return power_testH2( - phx.exact(), - phy.exact(), - phw.exact(), - pwt.exact(), - qhx.exact(), - qhy.exact(), - qhw.exact(), - qwt.exact(), - thx.exact(), - thy.exact(), - thw.exact(), - twt.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - CGAL_END_NAMESPACE #endif // CGAL_ARITHMETIC_FILTER_REGULAR_TRIANGULATION_RTH2_H diff --git a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_rtH3.h b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_rtH3.h index d79bb6893d3..a4b721b83ea 100644 --- a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_rtH3.h +++ b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/Regular_triangulation_rtH3.h @@ -133,478 +133,6 @@ power_testH3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_power_testH3_25 -{ - static double _bound; - static double _epsilon_0; - - static Oriented_side update_epsilon( - const Static_filter_error &phx, - const Static_filter_error &phy, - const Static_filter_error &phz, - const Static_filter_error &phw, - const Static_filter_error &pwt, - const Static_filter_error &qhx, - const Static_filter_error &qhy, - const Static_filter_error &qhz, - const Static_filter_error &qhw, - const Static_filter_error &qwt, - const Static_filter_error &rhx, - const Static_filter_error &rhy, - const Static_filter_error &rhz, - const Static_filter_error &rhw, - const Static_filter_error &rwt, - const Static_filter_error &shx, - const Static_filter_error ­, - const Static_filter_error &shz, - const Static_filter_error &shw, - const Static_filter_error &swt, - const Static_filter_error &thx, - const Static_filter_error &thy, - const Static_filter_error &thz, - const Static_filter_error &thw, - const Static_filter_error &twt, - double & epsilon_0) - { - typedef Static_filter_error RT; - - RT dphx = phx*phw; - RT dphy = phy*phw; - RT dphz = phz*phw; - RT dphw = CGAL_NTS square(phw); - RT dpz = CGAL_NTS square(phx) + CGAL_NTS square(phy) + - CGAL_NTS square(phz) - pwt*dphw; - - RT dqhx = qhx*qhw; - RT dqhy = qhy*qhw; - RT dqhz = qhz*qhw; - RT dqhw = CGAL_NTS square(qhw); - RT dqz = CGAL_NTS square(qhx) + CGAL_NTS square(qhy) + - CGAL_NTS square(qhz) - qwt*dqhw; - - RT drhx = rhx*rhw; - RT drhy = rhy*rhw; - RT drhz = rhz*rhw; - RT drhw = CGAL_NTS square(rhw); - RT drz = CGAL_NTS square(rhx) + CGAL_NTS square(rhy) + - CGAL_NTS square(rhz) - rwt*drhw; - - RT dshx = shx*shw; - RT dshy = shy*shw; - RT dshz = shz*shw; - RT dshw = CGAL_NTS square(shw); - RT dsz = CGAL_NTS square(shx) + CGAL_NTS square(shy) + - CGAL_NTS square(shz) - swt*dshw; - - RT dthx = thx*thw; - RT dthy = thy*thw; - RT dthz = thz*thw; - RT dthw = CGAL_NTS square(thw); - RT dtz = CGAL_NTS square(thx) + CGAL_NTS square(thy) + - CGAL_NTS square(thz) - twt*dthw; - - return Oriented_side(- Static_Filtered_sign_of_determinant5x5_25::update_epsilon(dphx, dphy, dphz, dpz, dphw, - dqhx, dqhy, dqhz, dqz, dqhw, - drhx, drhy, drhz, drz, drhw, - dshx, dshy, dshz, dsz, dshw, - dthx, dthy, dthz, dtz, dthw, - epsilon_0)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Oriented_side epsilon_variant( - const Restricted_double &phx, - const Restricted_double &phy, - const Restricted_double &phz, - const Restricted_double &phw, - const Restricted_double &pwt, - const Restricted_double &qhx, - const Restricted_double &qhy, - const Restricted_double &qhz, - const Restricted_double &qhw, - const Restricted_double &qwt, - const Restricted_double &rhx, - const Restricted_double &rhy, - const Restricted_double &rhz, - const Restricted_double &rhw, - const Restricted_double &rwt, - const Restricted_double &shx, - const Restricted_double ­, - const Restricted_double &shz, - const Restricted_double &shw, - const Restricted_double &swt, - const Restricted_double &thx, - const Restricted_double &thy, - const Restricted_double &thz, - const Restricted_double &thw, - const Restricted_double &twt, - const double & epsilon_0) - { - typedef Restricted_double RT; - - RT dphx = phx*phw; - RT dphy = phy*phw; - RT dphz = phz*phw; - RT dphw = CGAL_NTS square(phw); - RT dpz = CGAL_NTS square(phx) + CGAL_NTS square(phy) + - CGAL_NTS square(phz) - pwt*dphw; - - RT dqhx = qhx*qhw; - RT dqhy = qhy*qhw; - RT dqhz = qhz*qhw; - RT dqhw = CGAL_NTS square(qhw); - RT dqz = CGAL_NTS square(qhx) + CGAL_NTS square(qhy) + - CGAL_NTS square(qhz) - qwt*dqhw; - - RT drhx = rhx*rhw; - RT drhy = rhy*rhw; - RT drhz = rhz*rhw; - RT drhw = CGAL_NTS square(rhw); - RT drz = CGAL_NTS square(rhx) + CGAL_NTS square(rhy) + - CGAL_NTS square(rhz) - rwt*drhw; - - RT dshx = shx*shw; - RT dshy = shy*shw; - RT dshz = shz*shw; - RT dshw = CGAL_NTS square(shw); - RT dsz = CGAL_NTS square(shx) + CGAL_NTS square(shy) + - CGAL_NTS square(shz) - swt*dshw; - - RT dthx = thx*thw; - RT dthy = thy*thw; - RT dthz = thz*thw; - RT dthw = CGAL_NTS square(thw); - RT dtz = CGAL_NTS square(thx) + CGAL_NTS square(thy) + - CGAL_NTS square(thz) - twt*dthw; - - return Oriented_side(- Static_Filtered_sign_of_determinant5x5_25::epsilon_variant(dphx, dphy, dphz, dpz, dphw, - dqhx, dqhy, dqhz, dqz, dqhw, - drhx, drhy, drhz, drz, drhw, - dshx, dshy, dshz, dsz, dshw, - dthx, dthy, dthz, dtz, dthw, - epsilon_0)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testH3( - const Filtered_exact &phx, - const Filtered_exact &phy, - const Filtered_exact &phz, - const Filtered_exact &phw, - const Filtered_exact &pwt, - const Filtered_exact &qhx, - const Filtered_exact &qhy, - const Filtered_exact &qhz, - const Filtered_exact &qhw, - const Filtered_exact &qwt, - const Filtered_exact &rhx, - const Filtered_exact &rhy, - const Filtered_exact &rhz, - const Filtered_exact &rhw, - const Filtered_exact &rwt, - const Filtered_exact &shx, - const Filtered_exact ­, - const Filtered_exact &shz, - const Filtered_exact &shw, - const Filtered_exact &swt, - const Filtered_exact &thx, - const Filtered_exact &thy, - const Filtered_exact &thz, - const Filtered_exact &thw, - const Filtered_exact &twt) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_power_testH3_25::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(phx.to_double()) > SAF_bound || - fabs(phy.to_double()) > SAF_bound || - fabs(phz.to_double()) > SAF_bound || - fabs(phw.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qhx.to_double()) > SAF_bound || - fabs(qhy.to_double()) > SAF_bound || - fabs(qhz.to_double()) > SAF_bound || - fabs(qhw.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(rhx.to_double()) > SAF_bound || - fabs(rhy.to_double()) > SAF_bound || - fabs(rhz.to_double()) > SAF_bound || - fabs(rhw.to_double()) > SAF_bound || - fabs(rwt.to_double()) > SAF_bound || - fabs(shx.to_double()) > SAF_bound || - fabs(shy.to_double()) > SAF_bound || - fabs(shz.to_double()) > SAF_bound || - fabs(shw.to_double()) > SAF_bound || - fabs(swt.to_double()) > SAF_bound || - fabs(thx.to_double()) > SAF_bound || - fabs(thy.to_double()) > SAF_bound || - fabs(thz.to_double()) > SAF_bound || - fabs(thw.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(phx.to_double())); - NEW_bound = max(NEW_bound, fabs(phy.to_double())); - NEW_bound = max(NEW_bound, fabs(phz.to_double())); - NEW_bound = max(NEW_bound, fabs(phw.to_double())); - NEW_bound = max(NEW_bound, fabs(pwt.to_double())); - NEW_bound = max(NEW_bound, fabs(qhx.to_double())); - NEW_bound = max(NEW_bound, fabs(qhy.to_double())); - NEW_bound = max(NEW_bound, fabs(qhz.to_double())); - NEW_bound = max(NEW_bound, fabs(qhw.to_double())); - NEW_bound = max(NEW_bound, fabs(qwt.to_double())); - NEW_bound = max(NEW_bound, fabs(rhx.to_double())); - NEW_bound = max(NEW_bound, fabs(rhy.to_double())); - NEW_bound = max(NEW_bound, fabs(rhz.to_double())); - NEW_bound = max(NEW_bound, fabs(rhw.to_double())); - NEW_bound = max(NEW_bound, fabs(rwt.to_double())); - NEW_bound = max(NEW_bound, fabs(shx.to_double())); - NEW_bound = max(NEW_bound, fabs(shy.to_double())); - NEW_bound = max(NEW_bound, fabs(shz.to_double())); - NEW_bound = max(NEW_bound, fabs(shw.to_double())); - NEW_bound = max(NEW_bound, fabs(swt.to_double())); - NEW_bound = max(NEW_bound, fabs(thx.to_double())); - NEW_bound = max(NEW_bound, fabs(thy.to_double())); - NEW_bound = max(NEW_bound, fabs(thz.to_double())); - NEW_bound = max(NEW_bound, fabs(thw.to_double())); - NEW_bound = max(NEW_bound, fabs(twt.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA power_testH3 updates"); - ++updates; -#endif - Static_Filtered_power_testH3_25::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA power_testH3 calls"); - ++calls; -#endif - return Static_Filtered_power_testH3_25::epsilon_variant( - phx.dbl(), - phy.dbl(), - phz.dbl(), - phw.dbl(), - pwt.dbl(), - qhx.dbl(), - qhy.dbl(), - qhz.dbl(), - qhw.dbl(), - qwt.dbl(), - rhx.dbl(), - rhy.dbl(), - rhz.dbl(), - rhw.dbl(), - rwt.dbl(), - shx.dbl(), - shy.dbl(), - shz.dbl(), - shw.dbl(), - swt.dbl(), - thx.dbl(), - thy.dbl(), - thz.dbl(), - thw.dbl(), - twt.dbl(), - Static_Filtered_power_testH3_25::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA power_testH3 failures"); - ++failures; -#endif - return power_testH3( - phx.exact(), - phy.exact(), - phz.exact(), - phw.exact(), - pwt.exact(), - qhx.exact(), - qhy.exact(), - qhz.exact(), - qhw.exact(), - qwt.exact(), - rhx.exact(), - rhy.exact(), - rhz.exact(), - rhw.exact(), - rwt.exact(), - shx.exact(), - shy.exact(), - shz.exact(), - shw.exact(), - swt.exact(), - thx.exact(), - thy.exact(), - thz.exact(), - thw.exact(), - twt.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* */ -Oriented_side -power_testH3( - const Filtered_exact &phx, - const Filtered_exact &phy, - const Filtered_exact &phz, - const Filtered_exact &phw, - const Filtered_exact &pwt, - const Filtered_exact &qhx, - const Filtered_exact &qhy, - const Filtered_exact &qhz, - const Filtered_exact &qhw, - const Filtered_exact &qwt, - const Filtered_exact &rhx, - const Filtered_exact &rhy, - const Filtered_exact &rhz, - const Filtered_exact &rhw, - const Filtered_exact &rwt, - const Filtered_exact &shx, - const Filtered_exact ­, - const Filtered_exact &shz, - const Filtered_exact &shw, - const Filtered_exact &swt, - const Filtered_exact &thx, - const Filtered_exact &thy, - const Filtered_exact &thz, - const Filtered_exact &thw, - const Filtered_exact &twt) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_power_testH3_25::_bound; ) - CGAL_assertion(!( - fabs(phx.to_double()) > SAF_bound || - fabs(phy.to_double()) > SAF_bound || - fabs(phz.to_double()) > SAF_bound || - fabs(phw.to_double()) > SAF_bound || - fabs(pwt.to_double()) > SAF_bound || - fabs(qhx.to_double()) > SAF_bound || - fabs(qhy.to_double()) > SAF_bound || - fabs(qhz.to_double()) > SAF_bound || - fabs(qhw.to_double()) > SAF_bound || - fabs(qwt.to_double()) > SAF_bound || - fabs(rhx.to_double()) > SAF_bound || - fabs(rhy.to_double()) > SAF_bound || - fabs(rhz.to_double()) > SAF_bound || - fabs(rhw.to_double()) > SAF_bound || - fabs(rwt.to_double()) > SAF_bound || - fabs(shx.to_double()) > SAF_bound || - fabs(shy.to_double()) > SAF_bound || - fabs(shz.to_double()) > SAF_bound || - fabs(shw.to_double()) > SAF_bound || - fabs(swt.to_double()) > SAF_bound || - fabs(thx.to_double()) > SAF_bound || - fabs(thy.to_double()) > SAF_bound || - fabs(thz.to_double()) > SAF_bound || - fabs(thw.to_double()) > SAF_bound || - fabs(twt.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST power_testH3 calls"); - ++calls; -#endif - return Static_Filtered_power_testH3_25::epsilon_variant( - phx.dbl(), - phy.dbl(), - phz.dbl(), - phw.dbl(), - pwt.dbl(), - qhx.dbl(), - qhy.dbl(), - qhz.dbl(), - qhw.dbl(), - qwt.dbl(), - rhx.dbl(), - rhy.dbl(), - rhz.dbl(), - rhw.dbl(), - rwt.dbl(), - shx.dbl(), - shy.dbl(), - shz.dbl(), - shw.dbl(), - swt.dbl(), - thx.dbl(), - thy.dbl(), - thz.dbl(), - thw.dbl(), - twt.dbl(), - Static_Filtered_power_testH3_25::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST power_testH3 failures"); - ++failures; -#endif - return power_testH3( - phx.exact(), - phy.exact(), - phz.exact(), - phw.exact(), - pwt.exact(), - qhx.exact(), - qhy.exact(), - qhz.exact(), - qhw.exact(), - qwt.exact(), - rhx.exact(), - rhy.exact(), - rhz.exact(), - rhw.exact(), - rwt.exact(), - shx.exact(), - shy.exact(), - shz.exact(), - shw.exact(), - swt.exact(), - thx.exact(), - thy.exact(), - thz.exact(), - thw.exact(), - twt.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - CGAL_END_NAMESPACE #endif // CGAL_ARITHMETIC_FILTER_REGULAR_TRIANGULATION_RTH3_H diff --git a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/in_smallest_orthogonalcircle_ftC2.h b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/in_smallest_orthogonalcircle_ftC2.h index 89a8f0926e6..4965ee32e01 100644 --- a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/in_smallest_orthogonalcircle_ftC2.h +++ b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/in_smallest_orthogonalcircle_ftC2.h @@ -85,240 +85,6 @@ in_smallest_orthogonalcircleC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_in_smallest_orthogonalcircleC2_9 -{ - static double _bound; - static double _epsilon_0; - - static Bounded_side update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pw, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qw, - const Static_filter_error &tx, - const Static_filter_error &ty, - const Static_filter_error &tw, - double & epsilon_0) - { - typedef Static_filter_error FT; - - FT dpx = px-qx; - FT dpy = py-qy; - FT dtx = tx-qx; - FT dty = ty-qy; - FT dpz = CGAL_NTS square(dpx)+CGAL_NTS square(dpy); - - return Bounded_side - (CGAL_NTS Static_Filtered_sign_1::update_epsilon(-(CGAL_NTS square(dtx)+CGAL_NTS square(dty)-tw+qw)*dpz - +(dpz-pw+qw)*(dpx*dtx+dpy*dty), - epsilon_0)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Bounded_side epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pw, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qw, - const Restricted_double &tx, - const Restricted_double &ty, - const Restricted_double &tw, - const double & epsilon_0) - { - typedef Restricted_double FT; - - FT dpx = px-qx; - FT dpy = py-qy; - FT dtx = tx-qx; - FT dty = ty-qy; - FT dpz = CGAL_NTS square(dpx)+CGAL_NTS square(dpy); - - return Bounded_side - (CGAL_NTS Static_Filtered_sign_1::epsilon_variant(-(CGAL_NTS square(dtx)+CGAL_NTS square(dty)-tw+qw)*dpz - +(dpz-pw+qw)*(dpx*dtx+dpy*dty), - epsilon_0)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_MEDIUM_INLINE */ -Bounded_side -in_smallest_orthogonalcircleC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pw, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qw, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tw) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_in_smallest_orthogonalcircleC2_9::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pw.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qw.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tw.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pw.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qw.to_double())); - NEW_bound = max(NEW_bound, fabs(tx.to_double())); - NEW_bound = max(NEW_bound, fabs(ty.to_double())); - NEW_bound = max(NEW_bound, fabs(tw.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA in_smallest_orthogonalcircleC2 updates"); - ++updates; -#endif - Static_Filtered_in_smallest_orthogonalcircleC2_9::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA in_smallest_orthogonalcircleC2 calls"); - ++calls; -#endif - return Static_Filtered_in_smallest_orthogonalcircleC2_9::epsilon_variant( - px.dbl(), - py.dbl(), - pw.dbl(), - qx.dbl(), - qy.dbl(), - qw.dbl(), - tx.dbl(), - ty.dbl(), - tw.dbl(), - Static_Filtered_in_smallest_orthogonalcircleC2_9::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA in_smallest_orthogonalcircleC2 failures"); - ++failures; -#endif - return in_smallest_orthogonalcircleC2( - px.exact(), - py.exact(), - pw.exact(), - qx.exact(), - qy.exact(), - qw.exact(), - tx.exact(), - ty.exact(), - tw.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_MEDIUM_INLINE */ -Bounded_side -in_smallest_orthogonalcircleC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pw, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qw, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tw) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_in_smallest_orthogonalcircleC2_9::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pw.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qw.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tw.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST in_smallest_orthogonalcircleC2 calls"); - ++calls; -#endif - return Static_Filtered_in_smallest_orthogonalcircleC2_9::epsilon_variant( - px.dbl(), - py.dbl(), - pw.dbl(), - qx.dbl(), - qy.dbl(), - qw.dbl(), - tx.dbl(), - ty.dbl(), - tw.dbl(), - Static_Filtered_in_smallest_orthogonalcircleC2_9::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST in_smallest_orthogonalcircleC2 failures"); - ++failures; -#endif - return in_smallest_orthogonalcircleC2( - px.exact(), - py.exact(), - pw.exact(), - qx.exact(), - qy.exact(), - qw.exact(), - tx.exact(), - ty.exact(), - tw.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - CGAL_END_NAMESPACE #endif // CGAL_ARITHMETIC_FILTER_IN_SMALLEST_ORTHOGONALCIRCLE_FTC2_H diff --git a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/kernel_ftC2.h b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/kernel_ftC2.h index d7a17430cca..4cd491224a5 100644 --- a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/kernel_ftC2.h +++ b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/kernel_ftC2.h @@ -76,241 +76,6 @@ equal_lineC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_equal_lineC2_6 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4,_epsilon_5,_epsilon_6; - - static bool update_epsilon( - const Static_filter_error &l1a, - const Static_filter_error &l1b, - const Static_filter_error &l1c, - const Static_filter_error &l2a, - const Static_filter_error &l2b, - const Static_filter_error &l2c, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2, - double & epsilon_3, - double & epsilon_4, - double & epsilon_5, - double & epsilon_6) - { - typedef Static_filter_error FT; - - if (Static_Filtered_sign_of_determinant2x2_4::update_epsilon(l1a, l1b, l2a, l2b, - epsilon_0) != ZERO) - return false; - CGAL::Sign s1a = CGAL_NTS Static_Filtered_sign_1::update_epsilon(l1a, - epsilon_1); - if (s1a != ZERO) - return s1a == CGAL_NTS Static_Filtered_sign_1::update_epsilon(l2a, - epsilon_2) - && Static_Filtered_sign_of_determinant2x2_4::update_epsilon(l1a, l1c, l2a, l2c, - epsilon_3) == ZERO; - return CGAL_NTS Static_Filtered_sign_1::update_epsilon(l1b, - epsilon_4) == CGAL_NTS Static_Filtered_sign_1::update_epsilon(l2b, - epsilon_5) - && Static_Filtered_sign_of_determinant2x2_4::update_epsilon(l1b, l1c, l2b, l2c, - epsilon_6) == ZERO; - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4,_epsilon_5,_epsilon_6); - // TODO: We should verify that all epsilons have really been updated. - } - - static bool epsilon_variant( - const Restricted_double &l1a, - const Restricted_double &l1b, - const Restricted_double &l1c, - const Restricted_double &l2a, - const Restricted_double &l2b, - const Restricted_double &l2c, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2, - const double & epsilon_3, - const double & epsilon_4, - const double & epsilon_5, - const double & epsilon_6) - { - typedef Restricted_double FT; - - if (Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(l1a, l1b, l2a, l2b, - epsilon_0) != ZERO) - return false; - CGAL::Sign s1a = CGAL_NTS Static_Filtered_sign_1::epsilon_variant(l1a, - epsilon_1); - if (s1a != ZERO) - return s1a == CGAL_NTS Static_Filtered_sign_1::epsilon_variant(l2a, - epsilon_2) - && Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(l1a, l1c, l2a, l2c, - epsilon_3) == ZERO; - return CGAL_NTS Static_Filtered_sign_1::epsilon_variant(l1b, - epsilon_4) == CGAL_NTS Static_Filtered_sign_1::epsilon_variant(l2b, - epsilon_5) - && Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(l1b, l1c, l2b, l2c, - epsilon_6) == ZERO; - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -bool -equal_lineC2( - const Filtered_exact &l1a, - const Filtered_exact &l1b, - const Filtered_exact &l1c, - const Filtered_exact &l2a, - const Filtered_exact &l2b, - const Filtered_exact &l2c) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_equal_lineC2_6::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(l1a.to_double()) > SAF_bound || - fabs(l1b.to_double()) > SAF_bound || - fabs(l1c.to_double()) > SAF_bound || - fabs(l2a.to_double()) > SAF_bound || - fabs(l2b.to_double()) > SAF_bound || - fabs(l2c.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(l1a.to_double())); - NEW_bound = max(NEW_bound, fabs(l1b.to_double())); - NEW_bound = max(NEW_bound, fabs(l1c.to_double())); - NEW_bound = max(NEW_bound, fabs(l2a.to_double())); - NEW_bound = max(NEW_bound, fabs(l2b.to_double())); - NEW_bound = max(NEW_bound, fabs(l2c.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA equal_lineC2 updates"); - ++updates; -#endif - Static_Filtered_equal_lineC2_6::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA equal_lineC2 calls"); - ++calls; -#endif - return Static_Filtered_equal_lineC2_6::epsilon_variant( - l1a.dbl(), - l1b.dbl(), - l1c.dbl(), - l2a.dbl(), - l2b.dbl(), - l2c.dbl(), - Static_Filtered_equal_lineC2_6::_epsilon_0, - Static_Filtered_equal_lineC2_6::_epsilon_1, - Static_Filtered_equal_lineC2_6::_epsilon_2, - Static_Filtered_equal_lineC2_6::_epsilon_3, - Static_Filtered_equal_lineC2_6::_epsilon_4, - Static_Filtered_equal_lineC2_6::_epsilon_5, - Static_Filtered_equal_lineC2_6::_epsilon_6); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA equal_lineC2 failures"); - ++failures; -#endif - return equal_lineC2( - l1a.exact(), - l1b.exact(), - l1c.exact(), - l2a.exact(), - l2b.exact(), - l2c.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -bool -equal_lineC2( - const Filtered_exact &l1a, - const Filtered_exact &l1b, - const Filtered_exact &l1c, - const Filtered_exact &l2a, - const Filtered_exact &l2b, - const Filtered_exact &l2c) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_equal_lineC2_6::_bound; ) - CGAL_assertion(!( - fabs(l1a.to_double()) > SAF_bound || - fabs(l1b.to_double()) > SAF_bound || - fabs(l1c.to_double()) > SAF_bound || - fabs(l2a.to_double()) > SAF_bound || - fabs(l2b.to_double()) > SAF_bound || - fabs(l2c.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST equal_lineC2 calls"); - ++calls; -#endif - return Static_Filtered_equal_lineC2_6::epsilon_variant( - l1a.dbl(), - l1b.dbl(), - l1c.dbl(), - l2a.dbl(), - l2b.dbl(), - l2c.dbl(), - Static_Filtered_equal_lineC2_6::_epsilon_0, - Static_Filtered_equal_lineC2_6::_epsilon_1, - Static_Filtered_equal_lineC2_6::_epsilon_2, - Static_Filtered_equal_lineC2_6::_epsilon_3, - Static_Filtered_equal_lineC2_6::_epsilon_4, - Static_Filtered_equal_lineC2_6::_epsilon_5, - Static_Filtered_equal_lineC2_6::_epsilon_6); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST equal_lineC2 failures"); - ++failures; -#endif - return equal_lineC2( - l1a.exact(), - l1b.exact(), - l1c.exact(), - l2a.exact(), - l2b.exact(), - l2c.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -362,218 +127,6 @@ compare_xC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_compare_xC2_7 -{ - static double _bound; - static double _epsilon_0,_epsilon_1; - - static Comparison_result update_epsilon( - const Static_filter_error &px, - const Static_filter_error &la, - const Static_filter_error &lb, - const Static_filter_error &lc, - const Static_filter_error &ha, - const Static_filter_error &hb, - const Static_filter_error &hc, - double & epsilon_0, - double & epsilon_1) - { - typedef Static_filter_error FT; - - - FT num = det2x2_by_formula( lb, lc, hb, hc); - FT den = det2x2_by_formula( la, lb, ha, hb); - Sign s = CGAL_NTS Static_Filtered_sign_1::update_epsilon(den, - epsilon_0); - CGAL_kernel_assertion( s != ZERO ); - return Comparison_result( s * CGAL_NTS Static_Filtered_compare_2::update_epsilon( px * den, num, - epsilon_1) ); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,_epsilon_0,_epsilon_1); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &px, - const Restricted_double &la, - const Restricted_double &lb, - const Restricted_double &lc, - const Restricted_double &ha, - const Restricted_double &hb, - const Restricted_double &hc, - const double & epsilon_0, - const double & epsilon_1) - { - typedef Restricted_double FT; - - - FT num = det2x2_by_formula( lb, lc, hb, hc); - FT den = det2x2_by_formula( la, lb, ha, hb); - Sign s = CGAL_NTS Static_Filtered_sign_1::epsilon_variant(den, - epsilon_0); - CGAL_kernel_assertion( s != ZERO ); - return Comparison_result( s * CGAL_NTS Static_Filtered_compare_2::epsilon_variant( px * den, num, - epsilon_1) ); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -compare_xC2( - const Filtered_exact &px, - const Filtered_exact &la, - const Filtered_exact &lb, - const Filtered_exact &lc, - const Filtered_exact &ha, - const Filtered_exact &hb, - const Filtered_exact &hc) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_compare_xC2_7::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(la.to_double()) > SAF_bound || - fabs(lb.to_double()) > SAF_bound || - fabs(lc.to_double()) > SAF_bound || - fabs(ha.to_double()) > SAF_bound || - fabs(hb.to_double()) > SAF_bound || - fabs(hc.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(la.to_double())); - NEW_bound = max(NEW_bound, fabs(lb.to_double())); - NEW_bound = max(NEW_bound, fabs(lc.to_double())); - NEW_bound = max(NEW_bound, fabs(ha.to_double())); - NEW_bound = max(NEW_bound, fabs(hb.to_double())); - NEW_bound = max(NEW_bound, fabs(hc.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA compare_xC2 updates"); - ++updates; -#endif - Static_Filtered_compare_xC2_7::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA compare_xC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_xC2_7::epsilon_variant( - px.dbl(), - la.dbl(), - lb.dbl(), - lc.dbl(), - ha.dbl(), - hb.dbl(), - hc.dbl(), - Static_Filtered_compare_xC2_7::_epsilon_0, - Static_Filtered_compare_xC2_7::_epsilon_1); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA compare_xC2 failures"); - ++failures; -#endif - return compare_xC2( - px.exact(), - la.exact(), - lb.exact(), - lc.exact(), - ha.exact(), - hb.exact(), - hc.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -compare_xC2( - const Filtered_exact &px, - const Filtered_exact &la, - const Filtered_exact &lb, - const Filtered_exact &lc, - const Filtered_exact &ha, - const Filtered_exact &hb, - const Filtered_exact &hc) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_compare_xC2_7::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(la.to_double()) > SAF_bound || - fabs(lb.to_double()) > SAF_bound || - fabs(lc.to_double()) > SAF_bound || - fabs(ha.to_double()) > SAF_bound || - fabs(hb.to_double()) > SAF_bound || - fabs(hc.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST compare_xC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_xC2_7::epsilon_variant( - px.dbl(), - la.dbl(), - lb.dbl(), - lc.dbl(), - ha.dbl(), - hb.dbl(), - hc.dbl(), - Static_Filtered_compare_xC2_7::_epsilon_0, - Static_Filtered_compare_xC2_7::_epsilon_1); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST compare_xC2 failures"); - ++failures; -#endif - return compare_xC2( - px.exact(), - la.exact(), - lb.exact(), - lc.exact(), - ha.exact(), - hb.exact(), - hc.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -631,258 +184,6 @@ compare_xC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_compare_xC2_9 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3; - - static Comparison_result update_epsilon( - const Static_filter_error &la, - const Static_filter_error &lb, - const Static_filter_error &lc, - const Static_filter_error &h1a, - const Static_filter_error &h1b, - const Static_filter_error &h1c, - const Static_filter_error &h2a, - const Static_filter_error &h2b, - const Static_filter_error &h2c, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2, - double & epsilon_3) - { - typedef Static_filter_error FT; - - - FT num1 = det2x2_by_formula( la, lc, h1a, h1c); - FT num2 = det2x2_by_formula( la, lc, h2a, h2c); - FT num = det2x2_by_formula(h1a,h1c,h2a,h2c)*lb - + det2x2_by_formula(num1,num2,h1b,h2b); - FT den1 = det2x2_by_formula( la, lb, h1a, h1b); - FT den2 = det2x2_by_formula( la, lb, h2a, h2b); - return Comparison_result( CGAL_NTS Static_Filtered_sign_1::update_epsilon(lb, - epsilon_0) * CGAL_NTS Static_Filtered_sign_1::update_epsilon(num, - epsilon_1) * - CGAL_NTS Static_Filtered_sign_1::update_epsilon(den1, - epsilon_2) * CGAL_NTS Static_Filtered_sign_1::update_epsilon(den2, - epsilon_3)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &la, - const Restricted_double &lb, - const Restricted_double &lc, - const Restricted_double &h1a, - const Restricted_double &h1b, - const Restricted_double &h1c, - const Restricted_double &h2a, - const Restricted_double &h2b, - const Restricted_double &h2c, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2, - const double & epsilon_3) - { - typedef Restricted_double FT; - - - FT num1 = det2x2_by_formula( la, lc, h1a, h1c); - FT num2 = det2x2_by_formula( la, lc, h2a, h2c); - FT num = det2x2_by_formula(h1a,h1c,h2a,h2c)*lb - + det2x2_by_formula(num1,num2,h1b,h2b); - FT den1 = det2x2_by_formula( la, lb, h1a, h1b); - FT den2 = det2x2_by_formula( la, lb, h2a, h2b); - return Comparison_result( CGAL_NTS Static_Filtered_sign_1::epsilon_variant(lb, - epsilon_0) * CGAL_NTS Static_Filtered_sign_1::epsilon_variant(num, - epsilon_1) * - CGAL_NTS Static_Filtered_sign_1::epsilon_variant(den1, - epsilon_2) * CGAL_NTS Static_Filtered_sign_1::epsilon_variant(den2, - epsilon_3)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -compare_xC2( - const Filtered_exact &la, - const Filtered_exact &lb, - const Filtered_exact &lc, - const Filtered_exact &h1a, - const Filtered_exact &h1b, - const Filtered_exact &h1c, - const Filtered_exact &h2a, - const Filtered_exact &h2b, - const Filtered_exact &h2c) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_compare_xC2_9::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(la.to_double()) > SAF_bound || - fabs(lb.to_double()) > SAF_bound || - fabs(lc.to_double()) > SAF_bound || - fabs(h1a.to_double()) > SAF_bound || - fabs(h1b.to_double()) > SAF_bound || - fabs(h1c.to_double()) > SAF_bound || - fabs(h2a.to_double()) > SAF_bound || - fabs(h2b.to_double()) > SAF_bound || - fabs(h2c.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(la.to_double())); - NEW_bound = max(NEW_bound, fabs(lb.to_double())); - NEW_bound = max(NEW_bound, fabs(lc.to_double())); - NEW_bound = max(NEW_bound, fabs(h1a.to_double())); - NEW_bound = max(NEW_bound, fabs(h1b.to_double())); - NEW_bound = max(NEW_bound, fabs(h1c.to_double())); - NEW_bound = max(NEW_bound, fabs(h2a.to_double())); - NEW_bound = max(NEW_bound, fabs(h2b.to_double())); - NEW_bound = max(NEW_bound, fabs(h2c.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA compare_xC2 updates"); - ++updates; -#endif - Static_Filtered_compare_xC2_9::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA compare_xC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_xC2_9::epsilon_variant( - la.dbl(), - lb.dbl(), - lc.dbl(), - h1a.dbl(), - h1b.dbl(), - h1c.dbl(), - h2a.dbl(), - h2b.dbl(), - h2c.dbl(), - Static_Filtered_compare_xC2_9::_epsilon_0, - Static_Filtered_compare_xC2_9::_epsilon_1, - Static_Filtered_compare_xC2_9::_epsilon_2, - Static_Filtered_compare_xC2_9::_epsilon_3); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA compare_xC2 failures"); - ++failures; -#endif - return compare_xC2( - la.exact(), - lb.exact(), - lc.exact(), - h1a.exact(), - h1b.exact(), - h1c.exact(), - h2a.exact(), - h2b.exact(), - h2c.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -compare_xC2( - const Filtered_exact &la, - const Filtered_exact &lb, - const Filtered_exact &lc, - const Filtered_exact &h1a, - const Filtered_exact &h1b, - const Filtered_exact &h1c, - const Filtered_exact &h2a, - const Filtered_exact &h2b, - const Filtered_exact &h2c) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_compare_xC2_9::_bound; ) - CGAL_assertion(!( - fabs(la.to_double()) > SAF_bound || - fabs(lb.to_double()) > SAF_bound || - fabs(lc.to_double()) > SAF_bound || - fabs(h1a.to_double()) > SAF_bound || - fabs(h1b.to_double()) > SAF_bound || - fabs(h1c.to_double()) > SAF_bound || - fabs(h2a.to_double()) > SAF_bound || - fabs(h2b.to_double()) > SAF_bound || - fabs(h2c.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST compare_xC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_xC2_9::epsilon_variant( - la.dbl(), - lb.dbl(), - lc.dbl(), - h1a.dbl(), - h1b.dbl(), - h1c.dbl(), - h2a.dbl(), - h2b.dbl(), - h2c.dbl(), - Static_Filtered_compare_xC2_9::_epsilon_0, - Static_Filtered_compare_xC2_9::_epsilon_1, - Static_Filtered_compare_xC2_9::_epsilon_2, - Static_Filtered_compare_xC2_9::_epsilon_3); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST compare_xC2 failures"); - ++failures; -#endif - return compare_xC2( - la.exact(), - lb.exact(), - lc.exact(), - h1a.exact(), - h1b.exact(), - h1c.exact(), - h2a.exact(), - h2b.exact(), - h2c.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -949,283 +250,6 @@ compare_xC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_compare_xC2_12 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2; - - static Comparison_result update_epsilon( - const Static_filter_error &l1a, - const Static_filter_error &l1b, - const Static_filter_error &l1c, - const Static_filter_error &h1a, - const Static_filter_error &h1b, - const Static_filter_error &h1c, - const Static_filter_error &l2a, - const Static_filter_error &l2b, - const Static_filter_error &l2c, - const Static_filter_error &h2a, - const Static_filter_error &h2b, - const Static_filter_error &h2c, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2) - { - typedef Static_filter_error FT; - - FT num1 = det2x2_by_formula( l1b, l1c, h1b, h1c); - FT den1 = det2x2_by_formula( l1a, l1b, h1a, h1b); - FT num2 = det2x2_by_formula( l2b, l2c, h2b, h2c); - FT den2 = det2x2_by_formula( l2a, l2b, h2a, h2b); - Sign s = Sign (CGAL_NTS Static_Filtered_sign_1::update_epsilon(den1, - epsilon_0) * CGAL_NTS Static_Filtered_sign_1::update_epsilon(den2, - epsilon_1)); - CGAL_kernel_assertion( s != ZERO ); - return Comparison_result( s * Static_Filtered_sign_of_determinant2x2_4::update_epsilon(num1, num2, - den1, den2, - epsilon_2)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &l1a, - const Restricted_double &l1b, - const Restricted_double &l1c, - const Restricted_double &h1a, - const Restricted_double &h1b, - const Restricted_double &h1c, - const Restricted_double &l2a, - const Restricted_double &l2b, - const Restricted_double &l2c, - const Restricted_double &h2a, - const Restricted_double &h2b, - const Restricted_double &h2c, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2) - { - typedef Restricted_double FT; - - FT num1 = det2x2_by_formula( l1b, l1c, h1b, h1c); - FT den1 = det2x2_by_formula( l1a, l1b, h1a, h1b); - FT num2 = det2x2_by_formula( l2b, l2c, h2b, h2c); - FT den2 = det2x2_by_formula( l2a, l2b, h2a, h2b); - Sign s = Sign (CGAL_NTS Static_Filtered_sign_1::epsilon_variant(den1, - epsilon_0) * CGAL_NTS Static_Filtered_sign_1::epsilon_variant(den2, - epsilon_1)); - CGAL_kernel_assertion( s != ZERO ); - return Comparison_result( s * Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(num1, num2, - den1, den2, - epsilon_2)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -compare_xC2( - const Filtered_exact &l1a, - const Filtered_exact &l1b, - const Filtered_exact &l1c, - const Filtered_exact &h1a, - const Filtered_exact &h1b, - const Filtered_exact &h1c, - const Filtered_exact &l2a, - const Filtered_exact &l2b, - const Filtered_exact &l2c, - const Filtered_exact &h2a, - const Filtered_exact &h2b, - const Filtered_exact &h2c) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_compare_xC2_12::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(l1a.to_double()) > SAF_bound || - fabs(l1b.to_double()) > SAF_bound || - fabs(l1c.to_double()) > SAF_bound || - fabs(h1a.to_double()) > SAF_bound || - fabs(h1b.to_double()) > SAF_bound || - fabs(h1c.to_double()) > SAF_bound || - fabs(l2a.to_double()) > SAF_bound || - fabs(l2b.to_double()) > SAF_bound || - fabs(l2c.to_double()) > SAF_bound || - fabs(h2a.to_double()) > SAF_bound || - fabs(h2b.to_double()) > SAF_bound || - fabs(h2c.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(l1a.to_double())); - NEW_bound = max(NEW_bound, fabs(l1b.to_double())); - NEW_bound = max(NEW_bound, fabs(l1c.to_double())); - NEW_bound = max(NEW_bound, fabs(h1a.to_double())); - NEW_bound = max(NEW_bound, fabs(h1b.to_double())); - NEW_bound = max(NEW_bound, fabs(h1c.to_double())); - NEW_bound = max(NEW_bound, fabs(l2a.to_double())); - NEW_bound = max(NEW_bound, fabs(l2b.to_double())); - NEW_bound = max(NEW_bound, fabs(l2c.to_double())); - NEW_bound = max(NEW_bound, fabs(h2a.to_double())); - NEW_bound = max(NEW_bound, fabs(h2b.to_double())); - NEW_bound = max(NEW_bound, fabs(h2c.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA compare_xC2 updates"); - ++updates; -#endif - Static_Filtered_compare_xC2_12::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA compare_xC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_xC2_12::epsilon_variant( - l1a.dbl(), - l1b.dbl(), - l1c.dbl(), - h1a.dbl(), - h1b.dbl(), - h1c.dbl(), - l2a.dbl(), - l2b.dbl(), - l2c.dbl(), - h2a.dbl(), - h2b.dbl(), - h2c.dbl(), - Static_Filtered_compare_xC2_12::_epsilon_0, - Static_Filtered_compare_xC2_12::_epsilon_1, - Static_Filtered_compare_xC2_12::_epsilon_2); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA compare_xC2 failures"); - ++failures; -#endif - return compare_xC2( - l1a.exact(), - l1b.exact(), - l1c.exact(), - h1a.exact(), - h1b.exact(), - h1c.exact(), - l2a.exact(), - l2b.exact(), - l2c.exact(), - h2a.exact(), - h2b.exact(), - h2c.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -compare_xC2( - const Filtered_exact &l1a, - const Filtered_exact &l1b, - const Filtered_exact &l1c, - const Filtered_exact &h1a, - const Filtered_exact &h1b, - const Filtered_exact &h1c, - const Filtered_exact &l2a, - const Filtered_exact &l2b, - const Filtered_exact &l2c, - const Filtered_exact &h2a, - const Filtered_exact &h2b, - const Filtered_exact &h2c) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_compare_xC2_12::_bound; ) - CGAL_assertion(!( - fabs(l1a.to_double()) > SAF_bound || - fabs(l1b.to_double()) > SAF_bound || - fabs(l1c.to_double()) > SAF_bound || - fabs(h1a.to_double()) > SAF_bound || - fabs(h1b.to_double()) > SAF_bound || - fabs(h1c.to_double()) > SAF_bound || - fabs(l2a.to_double()) > SAF_bound || - fabs(l2b.to_double()) > SAF_bound || - fabs(l2c.to_double()) > SAF_bound || - fabs(h2a.to_double()) > SAF_bound || - fabs(h2b.to_double()) > SAF_bound || - fabs(h2c.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST compare_xC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_xC2_12::epsilon_variant( - l1a.dbl(), - l1b.dbl(), - l1c.dbl(), - h1a.dbl(), - h1b.dbl(), - h1c.dbl(), - l2a.dbl(), - l2b.dbl(), - l2c.dbl(), - h2a.dbl(), - h2b.dbl(), - h2c.dbl(), - Static_Filtered_compare_xC2_12::_epsilon_0, - Static_Filtered_compare_xC2_12::_epsilon_1, - Static_Filtered_compare_xC2_12::_epsilon_2); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST compare_xC2 failures"); - ++failures; -#endif - return compare_xC2( - l1a.exact(), - l1b.exact(), - l1c.exact(), - h1a.exact(), - h1b.exact(), - h1c.exact(), - l2a.exact(), - l2b.exact(), - l2c.exact(), - h2a.exact(), - h2b.exact(), - h2c.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -1271,190 +295,6 @@ compare_y_at_xC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_compare_y_at_xC2_5 -{ - static double _bound; - static double _epsilon_0,_epsilon_1; - - static Comparison_result update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &la, - const Static_filter_error &lb, - const Static_filter_error &lc, - double & epsilon_0, - double & epsilon_1) - { - typedef Static_filter_error FT; - - Sign s = CGAL_NTS Static_Filtered_sign_1::update_epsilon(lb, - epsilon_0); - CGAL_kernel_assertion( s != ZERO ); - return Comparison_result (s * CGAL_NTS Static_Filtered_sign_1::update_epsilon(la*px + lb*py + lc, - epsilon_1)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,_epsilon_0,_epsilon_1); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &la, - const Restricted_double &lb, - const Restricted_double &lc, - const double & epsilon_0, - const double & epsilon_1) - { - typedef Restricted_double FT; - - Sign s = CGAL_NTS Static_Filtered_sign_1::epsilon_variant(lb, - epsilon_0); - CGAL_kernel_assertion( s != ZERO ); - return Comparison_result (s * CGAL_NTS Static_Filtered_sign_1::epsilon_variant(la*px + lb*py + lc, - epsilon_1)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -compare_y_at_xC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &la, - const Filtered_exact &lb, - const Filtered_exact &lc) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_compare_y_at_xC2_5::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(la.to_double()) > SAF_bound || - fabs(lb.to_double()) > SAF_bound || - fabs(lc.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(la.to_double())); - NEW_bound = max(NEW_bound, fabs(lb.to_double())); - NEW_bound = max(NEW_bound, fabs(lc.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA compare_y_at_xC2 updates"); - ++updates; -#endif - Static_Filtered_compare_y_at_xC2_5::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA compare_y_at_xC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_y_at_xC2_5::epsilon_variant( - px.dbl(), - py.dbl(), - la.dbl(), - lb.dbl(), - lc.dbl(), - Static_Filtered_compare_y_at_xC2_5::_epsilon_0, - Static_Filtered_compare_y_at_xC2_5::_epsilon_1); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA compare_y_at_xC2 failures"); - ++failures; -#endif - return compare_y_at_xC2( - px.exact(), - py.exact(), - la.exact(), - lb.exact(), - lc.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -compare_y_at_xC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &la, - const Filtered_exact &lb, - const Filtered_exact &lc) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_compare_y_at_xC2_5::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(la.to_double()) > SAF_bound || - fabs(lb.to_double()) > SAF_bound || - fabs(lc.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST compare_y_at_xC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_y_at_xC2_5::epsilon_variant( - px.dbl(), - py.dbl(), - la.dbl(), - lb.dbl(), - lc.dbl(), - Static_Filtered_compare_y_at_xC2_5::_epsilon_0, - Static_Filtered_compare_y_at_xC2_5::_epsilon_1); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST compare_y_at_xC2 failures"); - ++failures; -#endif - return compare_y_at_xC2( - px.exact(), - py.exact(), - la.exact(), - lb.exact(), - lc.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -1506,220 +346,6 @@ compare_y_at_xC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_compare_y_at_xC2_7 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2; - - static Comparison_result update_epsilon( - const Static_filter_error &px, - const Static_filter_error &l1a, - const Static_filter_error &l1b, - const Static_filter_error &l1c, - const Static_filter_error &l2a, - const Static_filter_error &l2b, - const Static_filter_error &l2c, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2) - { - typedef Static_filter_error FT; - - Sign s = Sign (CGAL_NTS Static_Filtered_sign_1::update_epsilon(l1b, - epsilon_0) * CGAL_NTS Static_Filtered_sign_1::update_epsilon(l2b, - epsilon_1)); - CGAL_kernel_assertion( s != ZERO ); - return Comparison_result ( s * Static_Filtered_sign_of_determinant2x2_4::update_epsilon(l2a*px+l2c, l2b, - l1a*px+l1c, l1b, - epsilon_2)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &px, - const Restricted_double &l1a, - const Restricted_double &l1b, - const Restricted_double &l1c, - const Restricted_double &l2a, - const Restricted_double &l2b, - const Restricted_double &l2c, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2) - { - typedef Restricted_double FT; - - Sign s = Sign (CGAL_NTS Static_Filtered_sign_1::epsilon_variant(l1b, - epsilon_0) * CGAL_NTS Static_Filtered_sign_1::epsilon_variant(l2b, - epsilon_1)); - CGAL_kernel_assertion( s != ZERO ); - return Comparison_result ( s * Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(l2a*px+l2c, l2b, - l1a*px+l1c, l1b, - epsilon_2)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -compare_y_at_xC2( - const Filtered_exact &px, - const Filtered_exact &l1a, - const Filtered_exact &l1b, - const Filtered_exact &l1c, - const Filtered_exact &l2a, - const Filtered_exact &l2b, - const Filtered_exact &l2c) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_compare_y_at_xC2_7::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(l1a.to_double()) > SAF_bound || - fabs(l1b.to_double()) > SAF_bound || - fabs(l1c.to_double()) > SAF_bound || - fabs(l2a.to_double()) > SAF_bound || - fabs(l2b.to_double()) > SAF_bound || - fabs(l2c.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(l1a.to_double())); - NEW_bound = max(NEW_bound, fabs(l1b.to_double())); - NEW_bound = max(NEW_bound, fabs(l1c.to_double())); - NEW_bound = max(NEW_bound, fabs(l2a.to_double())); - NEW_bound = max(NEW_bound, fabs(l2b.to_double())); - NEW_bound = max(NEW_bound, fabs(l2c.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA compare_y_at_xC2 updates"); - ++updates; -#endif - Static_Filtered_compare_y_at_xC2_7::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA compare_y_at_xC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_y_at_xC2_7::epsilon_variant( - px.dbl(), - l1a.dbl(), - l1b.dbl(), - l1c.dbl(), - l2a.dbl(), - l2b.dbl(), - l2c.dbl(), - Static_Filtered_compare_y_at_xC2_7::_epsilon_0, - Static_Filtered_compare_y_at_xC2_7::_epsilon_1, - Static_Filtered_compare_y_at_xC2_7::_epsilon_2); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA compare_y_at_xC2 failures"); - ++failures; -#endif - return compare_y_at_xC2( - px.exact(), - l1a.exact(), - l1b.exact(), - l1c.exact(), - l2a.exact(), - l2b.exact(), - l2c.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -compare_y_at_xC2( - const Filtered_exact &px, - const Filtered_exact &l1a, - const Filtered_exact &l1b, - const Filtered_exact &l1c, - const Filtered_exact &l2a, - const Filtered_exact &l2b, - const Filtered_exact &l2c) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_compare_y_at_xC2_7::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(l1a.to_double()) > SAF_bound || - fabs(l1b.to_double()) > SAF_bound || - fabs(l1c.to_double()) > SAF_bound || - fabs(l2a.to_double()) > SAF_bound || - fabs(l2b.to_double()) > SAF_bound || - fabs(l2c.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST compare_y_at_xC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_y_at_xC2_7::epsilon_variant( - px.dbl(), - l1a.dbl(), - l1b.dbl(), - l1c.dbl(), - l2a.dbl(), - l2b.dbl(), - l2c.dbl(), - Static_Filtered_compare_y_at_xC2_7::_epsilon_0, - Static_Filtered_compare_y_at_xC2_7::_epsilon_1, - Static_Filtered_compare_y_at_xC2_7::_epsilon_2); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST compare_y_at_xC2 failures"); - ++failures; -#endif - return compare_y_at_xC2( - px.exact(), - l1a.exact(), - l1b.exact(), - l1c.exact(), - l2a.exact(), - l2b.exact(), - l2c.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -1777,246 +403,6 @@ compare_y_at_xC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_compare_y_at_xC2_9 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2; - - static Comparison_result update_epsilon( - const Static_filter_error &l1a, - const Static_filter_error &l1b, - const Static_filter_error &l1c, - const Static_filter_error &l2a, - const Static_filter_error &l2b, - const Static_filter_error &l2c, - const Static_filter_error &ha, - const Static_filter_error &hb, - const Static_filter_error &hc, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2) - { - typedef Static_filter_error FT; - - Sign s = Sign (Static_Filtered_sign_of_determinant2x2_4::update_epsilon(l1a, l1b, l2a, l2b, - epsilon_0) * - CGAL_NTS Static_Filtered_sign_1::update_epsilon(hb, - epsilon_1)); - CGAL_kernel_assertion( s != ZERO ); - return Comparison_result( s * Static_Filtered_sign_of_determinant3x3_9::update_epsilon(l1a, l1b, l1c, - l2a, l2b, l2c, - ha, hb, hc, - epsilon_2)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &l1a, - const Restricted_double &l1b, - const Restricted_double &l1c, - const Restricted_double &l2a, - const Restricted_double &l2b, - const Restricted_double &l2c, - const Restricted_double &ha, - const Restricted_double &hb, - const Restricted_double &hc, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2) - { - typedef Restricted_double FT; - - Sign s = Sign (Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(l1a, l1b, l2a, l2b, - epsilon_0) * - CGAL_NTS Static_Filtered_sign_1::epsilon_variant(hb, - epsilon_1)); - CGAL_kernel_assertion( s != ZERO ); - return Comparison_result( s * Static_Filtered_sign_of_determinant3x3_9::epsilon_variant(l1a, l1b, l1c, - l2a, l2b, l2c, - ha, hb, hc, - epsilon_2)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Comparison_result -compare_y_at_xC2( - const Filtered_exact &l1a, - const Filtered_exact &l1b, - const Filtered_exact &l1c, - const Filtered_exact &l2a, - const Filtered_exact &l2b, - const Filtered_exact &l2c, - const Filtered_exact &ha, - const Filtered_exact &hb, - const Filtered_exact &hc) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_compare_y_at_xC2_9::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(l1a.to_double()) > SAF_bound || - fabs(l1b.to_double()) > SAF_bound || - fabs(l1c.to_double()) > SAF_bound || - fabs(l2a.to_double()) > SAF_bound || - fabs(l2b.to_double()) > SAF_bound || - fabs(l2c.to_double()) > SAF_bound || - fabs(ha.to_double()) > SAF_bound || - fabs(hb.to_double()) > SAF_bound || - fabs(hc.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(l1a.to_double())); - NEW_bound = max(NEW_bound, fabs(l1b.to_double())); - NEW_bound = max(NEW_bound, fabs(l1c.to_double())); - NEW_bound = max(NEW_bound, fabs(l2a.to_double())); - NEW_bound = max(NEW_bound, fabs(l2b.to_double())); - NEW_bound = max(NEW_bound, fabs(l2c.to_double())); - NEW_bound = max(NEW_bound, fabs(ha.to_double())); - NEW_bound = max(NEW_bound, fabs(hb.to_double())); - NEW_bound = max(NEW_bound, fabs(hc.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA compare_y_at_xC2 updates"); - ++updates; -#endif - Static_Filtered_compare_y_at_xC2_9::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA compare_y_at_xC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_y_at_xC2_9::epsilon_variant( - l1a.dbl(), - l1b.dbl(), - l1c.dbl(), - l2a.dbl(), - l2b.dbl(), - l2c.dbl(), - ha.dbl(), - hb.dbl(), - hc.dbl(), - Static_Filtered_compare_y_at_xC2_9::_epsilon_0, - Static_Filtered_compare_y_at_xC2_9::_epsilon_1, - Static_Filtered_compare_y_at_xC2_9::_epsilon_2); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA compare_y_at_xC2 failures"); - ++failures; -#endif - return compare_y_at_xC2( - l1a.exact(), - l1b.exact(), - l1c.exact(), - l2a.exact(), - l2b.exact(), - l2c.exact(), - ha.exact(), - hb.exact(), - hc.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Comparison_result -compare_y_at_xC2( - const Filtered_exact &l1a, - const Filtered_exact &l1b, - const Filtered_exact &l1c, - const Filtered_exact &l2a, - const Filtered_exact &l2b, - const Filtered_exact &l2c, - const Filtered_exact &ha, - const Filtered_exact &hb, - const Filtered_exact &hc) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_compare_y_at_xC2_9::_bound; ) - CGAL_assertion(!( - fabs(l1a.to_double()) > SAF_bound || - fabs(l1b.to_double()) > SAF_bound || - fabs(l1c.to_double()) > SAF_bound || - fabs(l2a.to_double()) > SAF_bound || - fabs(l2b.to_double()) > SAF_bound || - fabs(l2c.to_double()) > SAF_bound || - fabs(ha.to_double()) > SAF_bound || - fabs(hb.to_double()) > SAF_bound || - fabs(hc.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST compare_y_at_xC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_y_at_xC2_9::epsilon_variant( - l1a.dbl(), - l1b.dbl(), - l1c.dbl(), - l2a.dbl(), - l2b.dbl(), - l2c.dbl(), - ha.dbl(), - hb.dbl(), - hc.dbl(), - Static_Filtered_compare_y_at_xC2_9::_epsilon_0, - Static_Filtered_compare_y_at_xC2_9::_epsilon_1, - Static_Filtered_compare_y_at_xC2_9::_epsilon_2); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST compare_y_at_xC2 failures"); - ++failures; -#endif - return compare_y_at_xC2( - l1a.exact(), - l1b.exact(), - l1c.exact(), - l2a.exact(), - l2b.exact(), - l2c.exact(), - ha.exact(), - hb.exact(), - hc.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -2083,287 +469,6 @@ compare_y_at_xC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_compare_y_at_xC2_12 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3; - - static Comparison_result update_epsilon( - const Static_filter_error &l1a, - const Static_filter_error &l1b, - const Static_filter_error &l1c, - const Static_filter_error &l2a, - const Static_filter_error &l2b, - const Static_filter_error &l2c, - const Static_filter_error &h1a, - const Static_filter_error &h1b, - const Static_filter_error &h1c, - const Static_filter_error &h2a, - const Static_filter_error &h2b, - const Static_filter_error &h2c, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2, - double & epsilon_3) - { - typedef Static_filter_error FT; - - - FT num = det2x2_by_formula( l1b, l1c, l2b, l2c); - FT den = det2x2_by_formula( l1a, l1b, l2a, l2b); - Sign s = Sign (CGAL_NTS Static_Filtered_sign_1::update_epsilon(h1b, - epsilon_0) * CGAL_NTS Static_Filtered_sign_1::update_epsilon(h2b, - epsilon_1) * CGAL_NTS Static_Filtered_sign_1::update_epsilon(den, - epsilon_2)); - CGAL_kernel_assertion( s != ZERO ); - return Comparison_result ( s * Static_Filtered_sign_of_determinant2x2_4::update_epsilon(h2a*num+h2c*den, h2b, - h1a*num+h1c*den, h1b, - epsilon_3)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &l1a, - const Restricted_double &l1b, - const Restricted_double &l1c, - const Restricted_double &l2a, - const Restricted_double &l2b, - const Restricted_double &l2c, - const Restricted_double &h1a, - const Restricted_double &h1b, - const Restricted_double &h1c, - const Restricted_double &h2a, - const Restricted_double &h2b, - const Restricted_double &h2c, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2, - const double & epsilon_3) - { - typedef Restricted_double FT; - - - FT num = det2x2_by_formula( l1b, l1c, l2b, l2c); - FT den = det2x2_by_formula( l1a, l1b, l2a, l2b); - Sign s = Sign (CGAL_NTS Static_Filtered_sign_1::epsilon_variant(h1b, - epsilon_0) * CGAL_NTS Static_Filtered_sign_1::epsilon_variant(h2b, - epsilon_1) * CGAL_NTS Static_Filtered_sign_1::epsilon_variant(den, - epsilon_2)); - CGAL_kernel_assertion( s != ZERO ); - return Comparison_result ( s * Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(h2a*num+h2c*den, h2b, - h1a*num+h1c*den, h1b, - epsilon_3)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Comparison_result -compare_y_at_xC2( - const Filtered_exact &l1a, - const Filtered_exact &l1b, - const Filtered_exact &l1c, - const Filtered_exact &l2a, - const Filtered_exact &l2b, - const Filtered_exact &l2c, - const Filtered_exact &h1a, - const Filtered_exact &h1b, - const Filtered_exact &h1c, - const Filtered_exact &h2a, - const Filtered_exact &h2b, - const Filtered_exact &h2c) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_compare_y_at_xC2_12::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(l1a.to_double()) > SAF_bound || - fabs(l1b.to_double()) > SAF_bound || - fabs(l1c.to_double()) > SAF_bound || - fabs(l2a.to_double()) > SAF_bound || - fabs(l2b.to_double()) > SAF_bound || - fabs(l2c.to_double()) > SAF_bound || - fabs(h1a.to_double()) > SAF_bound || - fabs(h1b.to_double()) > SAF_bound || - fabs(h1c.to_double()) > SAF_bound || - fabs(h2a.to_double()) > SAF_bound || - fabs(h2b.to_double()) > SAF_bound || - fabs(h2c.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(l1a.to_double())); - NEW_bound = max(NEW_bound, fabs(l1b.to_double())); - NEW_bound = max(NEW_bound, fabs(l1c.to_double())); - NEW_bound = max(NEW_bound, fabs(l2a.to_double())); - NEW_bound = max(NEW_bound, fabs(l2b.to_double())); - NEW_bound = max(NEW_bound, fabs(l2c.to_double())); - NEW_bound = max(NEW_bound, fabs(h1a.to_double())); - NEW_bound = max(NEW_bound, fabs(h1b.to_double())); - NEW_bound = max(NEW_bound, fabs(h1c.to_double())); - NEW_bound = max(NEW_bound, fabs(h2a.to_double())); - NEW_bound = max(NEW_bound, fabs(h2b.to_double())); - NEW_bound = max(NEW_bound, fabs(h2c.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA compare_y_at_xC2 updates"); - ++updates; -#endif - Static_Filtered_compare_y_at_xC2_12::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA compare_y_at_xC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_y_at_xC2_12::epsilon_variant( - l1a.dbl(), - l1b.dbl(), - l1c.dbl(), - l2a.dbl(), - l2b.dbl(), - l2c.dbl(), - h1a.dbl(), - h1b.dbl(), - h1c.dbl(), - h2a.dbl(), - h2b.dbl(), - h2c.dbl(), - Static_Filtered_compare_y_at_xC2_12::_epsilon_0, - Static_Filtered_compare_y_at_xC2_12::_epsilon_1, - Static_Filtered_compare_y_at_xC2_12::_epsilon_2, - Static_Filtered_compare_y_at_xC2_12::_epsilon_3); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA compare_y_at_xC2 failures"); - ++failures; -#endif - return compare_y_at_xC2( - l1a.exact(), - l1b.exact(), - l1c.exact(), - l2a.exact(), - l2b.exact(), - l2c.exact(), - h1a.exact(), - h1b.exact(), - h1c.exact(), - h2a.exact(), - h2b.exact(), - h2c.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Comparison_result -compare_y_at_xC2( - const Filtered_exact &l1a, - const Filtered_exact &l1b, - const Filtered_exact &l1c, - const Filtered_exact &l2a, - const Filtered_exact &l2b, - const Filtered_exact &l2c, - const Filtered_exact &h1a, - const Filtered_exact &h1b, - const Filtered_exact &h1c, - const Filtered_exact &h2a, - const Filtered_exact &h2b, - const Filtered_exact &h2c) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_compare_y_at_xC2_12::_bound; ) - CGAL_assertion(!( - fabs(l1a.to_double()) > SAF_bound || - fabs(l1b.to_double()) > SAF_bound || - fabs(l1c.to_double()) > SAF_bound || - fabs(l2a.to_double()) > SAF_bound || - fabs(l2b.to_double()) > SAF_bound || - fabs(l2c.to_double()) > SAF_bound || - fabs(h1a.to_double()) > SAF_bound || - fabs(h1b.to_double()) > SAF_bound || - fabs(h1c.to_double()) > SAF_bound || - fabs(h2a.to_double()) > SAF_bound || - fabs(h2b.to_double()) > SAF_bound || - fabs(h2c.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST compare_y_at_xC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_y_at_xC2_12::epsilon_variant( - l1a.dbl(), - l1b.dbl(), - l1c.dbl(), - l2a.dbl(), - l2b.dbl(), - l2c.dbl(), - h1a.dbl(), - h1b.dbl(), - h1c.dbl(), - h2a.dbl(), - h2b.dbl(), - h2c.dbl(), - Static_Filtered_compare_y_at_xC2_12::_epsilon_0, - Static_Filtered_compare_y_at_xC2_12::_epsilon_1, - Static_Filtered_compare_y_at_xC2_12::_epsilon_2, - Static_Filtered_compare_y_at_xC2_12::_epsilon_3); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST compare_y_at_xC2 failures"); - ++failures; -#endif - return compare_y_at_xC2( - l1a.exact(), - l1b.exact(), - l1c.exact(), - l2a.exact(), - l2b.exact(), - l2c.exact(), - h1a.exact(), - h1b.exact(), - h1c.exact(), - h2a.exact(), - h2b.exact(), - h2c.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -2421,304 +526,6 @@ compare_y_at_x_segment_C2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_compare_y_at_x_segment_C2_9 -{ - static double _bound; - static double ; - - static Comparison_result update_epsilon( - const Static_filter_error &px, - const Static_filter_error &s1sx, - const Static_filter_error &s1sy, - const Static_filter_error &s1tx, - const Static_filter_error &s1ty, - const Static_filter_error &s2sx, - const Static_filter_error &s2sy, - const Static_filter_error &s2tx, - const Static_filter_error &s2ty,) - { - typedef Static_filter_error FT; - - - - - - - - CGAL_kernel_precondition(px >= min(s1sx, s1tx) && px <= max(s1sx, s1tx)); - CGAL_kernel_precondition(px >= min(s2sx, s2tx) && px <= max(s2sx, s2tx)); - - if (s1sx != s1tx && s2sx != s2tx) { - FT s1stx = s1sx-s1tx; - FT s2stx = s2sx-s2tx; - - return Comparison_result( - CGAL_NTS Static_Filtered_compare_2::update_epsilon(s1sx, s1tx, - epsilon_0) * - CGAL_NTS Static_Filtered_compare_2::update_epsilon(s2sx, s2tx, - epsilon_1) * - CGAL_NTS Static_Filtered_compare_2::update_epsilon(-(s1sx-px)*(s1sy-s1ty)*s2stx, - (s2sy-s1sy)*s2stx*s1stx - -(s2sx-px)*(s2sy-s2ty)*s1stx , - epsilon_2)); - } - else { - if (s1sx == s1tx) { - Comparison_result c1, c2; - c1 = Static_Filtered_compare_y_at_xC2_6::update_epsilon(px, s1sy, s2sx, s2sy, s2tx, s2ty, - epsilon_); - c2 = Static_Filtered_compare_y_at_xC2_6::update_epsilon(px, s1ty, s2sx, s2sy, s2tx, s2ty, - epsilon_); - if (c1 == c2) - return c1; - return EQUAL; - } - - Comparison_result c3, c4; - c3 = Static_Filtered_compare_y_at_xC2_6::update_epsilon(px, s2sy, s1sx, s1sy, s1tx, s1ty, - epsilon_); - c4 = Static_Filtered_compare_y_at_xC2_6::update_epsilon(px, s2ty, s1sx, s1sy, s1tx, s1ty, - epsilon_); - if (c3 == c4) - return opposite(c3); - return EQUAL; - } - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &px, - const Restricted_double &s1sx, - const Restricted_double &s1sy, - const Restricted_double &s1tx, - const Restricted_double &s1ty, - const Restricted_double &s2sx, - const Restricted_double &s2sy, - const Restricted_double &s2tx, - const Restricted_double &s2ty,) - { - typedef Restricted_double FT; - - - - - - - - CGAL_kernel_precondition(px >= min(s1sx, s1tx) && px <= max(s1sx, s1tx)); - CGAL_kernel_precondition(px >= min(s2sx, s2tx) && px <= max(s2sx, s2tx)); - - if (s1sx != s1tx && s2sx != s2tx) { - FT s1stx = s1sx-s1tx; - FT s2stx = s2sx-s2tx; - - return Comparison_result( - CGAL_NTS Static_Filtered_compare_2::epsilon_variant(s1sx, s1tx, - epsilon_0) * - CGAL_NTS Static_Filtered_compare_2::epsilon_variant(s2sx, s2tx, - epsilon_1) * - CGAL_NTS Static_Filtered_compare_2::epsilon_variant(-(s1sx-px)*(s1sy-s1ty)*s2stx, - (s2sy-s1sy)*s2stx*s1stx - -(s2sx-px)*(s2sy-s2ty)*s1stx , - epsilon_2)); - } - else { - if (s1sx == s1tx) { - Comparison_result c1, c2; - c1 = Static_Filtered_compare_y_at_xC2_6::epsilon_variant(px, s1sy, s2sx, s2sy, s2tx, s2ty, - epsilon_); - c2 = Static_Filtered_compare_y_at_xC2_6::epsilon_variant(px, s1ty, s2sx, s2sy, s2tx, s2ty, - epsilon_); - if (c1 == c2) - return c1; - return EQUAL; - } - - Comparison_result c3, c4; - c3 = Static_Filtered_compare_y_at_xC2_6::epsilon_variant(px, s2sy, s1sx, s1sy, s1tx, s1ty, - epsilon_); - c4 = Static_Filtered_compare_y_at_xC2_6::epsilon_variant(px, s2ty, s1sx, s1sy, s1tx, s1ty, - epsilon_); - if (c3 == c4) - return opposite(c3); - return EQUAL; - } - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Comparison_result -compare_y_at_x_segment_C2( - const Filtered_exact &px, - const Filtered_exact &s1sx, - const Filtered_exact &s1sy, - const Filtered_exact &s1tx, - const Filtered_exact &s1ty, - const Filtered_exact &s2sx, - const Filtered_exact &s2sy, - const Filtered_exact &s2tx, - const Filtered_exact &s2ty) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_compare_y_at_x_segment_C2_9::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(s1sx.to_double()) > SAF_bound || - fabs(s1sy.to_double()) > SAF_bound || - fabs(s1tx.to_double()) > SAF_bound || - fabs(s1ty.to_double()) > SAF_bound || - fabs(s2sx.to_double()) > SAF_bound || - fabs(s2sy.to_double()) > SAF_bound || - fabs(s2tx.to_double()) > SAF_bound || - fabs(s2ty.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(s1sx.to_double())); - NEW_bound = max(NEW_bound, fabs(s1sy.to_double())); - NEW_bound = max(NEW_bound, fabs(s1tx.to_double())); - NEW_bound = max(NEW_bound, fabs(s1ty.to_double())); - NEW_bound = max(NEW_bound, fabs(s2sx.to_double())); - NEW_bound = max(NEW_bound, fabs(s2sy.to_double())); - NEW_bound = max(NEW_bound, fabs(s2tx.to_double())); - NEW_bound = max(NEW_bound, fabs(s2ty.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA compare_y_at_x_segment_C2 updates"); - ++updates; -#endif - Static_Filtered_compare_y_at_x_segment_C2_9::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA compare_y_at_x_segment_C2 calls"); - ++calls; -#endif - return Static_Filtered_compare_y_at_x_segment_C2_9::epsilon_variant( - px.dbl(), - s1sx.dbl(), - s1sy.dbl(), - s1tx.dbl(), - s1ty.dbl(), - s2sx.dbl(), - s2sy.dbl(), - s2tx.dbl(), - s2ty.dbl(),); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA compare_y_at_x_segment_C2 failures"); - ++failures; -#endif - return compare_y_at_x_segment_C2( - px.exact(), - s1sx.exact(), - s1sy.exact(), - s1tx.exact(), - s1ty.exact(), - s2sx.exact(), - s2sy.exact(), - s2tx.exact(), - s2ty.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Comparison_result -compare_y_at_x_segment_C2( - const Filtered_exact &px, - const Filtered_exact &s1sx, - const Filtered_exact &s1sy, - const Filtered_exact &s1tx, - const Filtered_exact &s1ty, - const Filtered_exact &s2sx, - const Filtered_exact &s2sy, - const Filtered_exact &s2tx, - const Filtered_exact &s2ty) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_compare_y_at_x_segment_C2_9::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(s1sx.to_double()) > SAF_bound || - fabs(s1sy.to_double()) > SAF_bound || - fabs(s1tx.to_double()) > SAF_bound || - fabs(s1ty.to_double()) > SAF_bound || - fabs(s2sx.to_double()) > SAF_bound || - fabs(s2sy.to_double()) > SAF_bound || - fabs(s2tx.to_double()) > SAF_bound || - fabs(s2ty.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST compare_y_at_x_segment_C2 calls"); - ++calls; -#endif - return Static_Filtered_compare_y_at_x_segment_C2_9::epsilon_variant( - px.dbl(), - s1sx.dbl(), - s1sy.dbl(), - s1tx.dbl(), - s1ty.dbl(), - s2sx.dbl(), - s2sy.dbl(), - s2tx.dbl(), - s2ty.dbl(),); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST compare_y_at_x_segment_C2 failures"); - ++failures; -#endif - return compare_y_at_x_segment_C2( - px.exact(), - s1sx.exact(), - s1sy.exact(), - s1tx.exact(), - s1ty.exact(), - s2sx.exact(), - s2sy.exact(), - s2tx.exact(), - s2ty.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -2761,197 +568,6 @@ equal_directionC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_equal_directionC2_4 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4; - - static bool update_epsilon( - const Static_filter_error &dx1, - const Static_filter_error &dy1, - const Static_filter_error &dx2, - const Static_filter_error &dy2, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2, - double & epsilon_3, - double & epsilon_4) - { - typedef Static_filter_error FT; - - return CGAL_NTS Static_Filtered_sign_1::update_epsilon(dx1, - epsilon_0) == CGAL_NTS Static_Filtered_sign_1::update_epsilon(dx2, - epsilon_1) - && CGAL_NTS Static_Filtered_sign_1::update_epsilon(dy1, - epsilon_2) == CGAL_NTS Static_Filtered_sign_1::update_epsilon(dy2, - epsilon_3) - && Static_Filtered_sign_of_determinant2x2_4::update_epsilon(dx1, dy1, dx2, dy2, - epsilon_4) == ZERO; - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4); - // TODO: We should verify that all epsilons have really been updated. - } - - static bool epsilon_variant( - const Restricted_double &dx1, - const Restricted_double &dy1, - const Restricted_double &dx2, - const Restricted_double &dy2, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2, - const double & epsilon_3, - const double & epsilon_4) - { - typedef Restricted_double FT; - - return CGAL_NTS Static_Filtered_sign_1::epsilon_variant(dx1, - epsilon_0) == CGAL_NTS Static_Filtered_sign_1::epsilon_variant(dx2, - epsilon_1) - && CGAL_NTS Static_Filtered_sign_1::epsilon_variant(dy1, - epsilon_2) == CGAL_NTS Static_Filtered_sign_1::epsilon_variant(dy2, - epsilon_3) - && Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(dx1, dy1, dx2, dy2, - epsilon_4) == ZERO; - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -bool -equal_directionC2( - const Filtered_exact &dx1, - const Filtered_exact &dy1, - const Filtered_exact &dx2, - const Filtered_exact &dy2) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_equal_directionC2_4::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(dx1.to_double()) > SAF_bound || - fabs(dy1.to_double()) > SAF_bound || - fabs(dx2.to_double()) > SAF_bound || - fabs(dy2.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(dx1.to_double())); - NEW_bound = max(NEW_bound, fabs(dy1.to_double())); - NEW_bound = max(NEW_bound, fabs(dx2.to_double())); - NEW_bound = max(NEW_bound, fabs(dy2.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA equal_directionC2 updates"); - ++updates; -#endif - Static_Filtered_equal_directionC2_4::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA equal_directionC2 calls"); - ++calls; -#endif - return Static_Filtered_equal_directionC2_4::epsilon_variant( - dx1.dbl(), - dy1.dbl(), - dx2.dbl(), - dy2.dbl(), - Static_Filtered_equal_directionC2_4::_epsilon_0, - Static_Filtered_equal_directionC2_4::_epsilon_1, - Static_Filtered_equal_directionC2_4::_epsilon_2, - Static_Filtered_equal_directionC2_4::_epsilon_3, - Static_Filtered_equal_directionC2_4::_epsilon_4); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA equal_directionC2 failures"); - ++failures; -#endif - return equal_directionC2( - dx1.exact(), - dy1.exact(), - dx2.exact(), - dy2.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -bool -equal_directionC2( - const Filtered_exact &dx1, - const Filtered_exact &dy1, - const Filtered_exact &dx2, - const Filtered_exact &dy2) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_equal_directionC2_4::_bound; ) - CGAL_assertion(!( - fabs(dx1.to_double()) > SAF_bound || - fabs(dy1.to_double()) > SAF_bound || - fabs(dx2.to_double()) > SAF_bound || - fabs(dy2.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST equal_directionC2 calls"); - ++calls; -#endif - return Static_Filtered_equal_directionC2_4::epsilon_variant( - dx1.dbl(), - dy1.dbl(), - dx2.dbl(), - dy2.dbl(), - Static_Filtered_equal_directionC2_4::_epsilon_0, - Static_Filtered_equal_directionC2_4::_epsilon_1, - Static_Filtered_equal_directionC2_4::_epsilon_2, - Static_Filtered_equal_directionC2_4::_epsilon_3, - Static_Filtered_equal_directionC2_4::_epsilon_4); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST equal_directionC2 failures"); - ++failures; -#endif - return equal_directionC2( - dx1.exact(), - dy1.exact(), - dx2.exact(), - dy2.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -2994,233 +610,6 @@ compare_slopesC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_compare_slopesC2_4 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4,_epsilon_5; - - static Comparison_result update_epsilon( - const Static_filter_error &l1a, - const Static_filter_error &l1b, - const Static_filter_error &l2a, - const Static_filter_error &l2b, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2, - double & epsilon_3, - double & epsilon_4, - double & epsilon_5) - { - typedef Static_filter_error FT; - - if (l1a == FT(0)) - return l2b == FT(0) ? SMALLER : Comparison_result(CGAL_NTS Static_Filtered_sign_1::update_epsilon(l2a*l2b, - epsilon_0)); - if (l2a == FT(0)) - return l1b == FT(0) ? LARGER : Comparison_result(-CGAL_NTS Static_Filtered_sign_1::update_epsilon(l1a*l1b, - epsilon_1)); - if (l1b == FT(0)) return l2b == FT(0) ? EQUAL : LARGER; - if (l2b == FT(0)) return SMALLER; - int l1_sign = CGAL_NTS Static_Filtered_sign_1::update_epsilon(-l1a * l1b, - epsilon_2); - int l2_sign = CGAL_NTS Static_Filtered_sign_1::update_epsilon(-l2a * l2b, - epsilon_3); - - if (l1_sign < l2_sign) return SMALLER; - if (l1_sign > l2_sign) return LARGER; - - if (l1_sign > 0) - return Comparison_result( CGAL_NTS Static_Filtered_sign_1::update_epsilon( CGAL_NTS abs(l1a * l2b) - - CGAL_NTS abs(l2a * l1b) , - epsilon_4) ); - - return Comparison_result( CGAL_NTS Static_Filtered_sign_1::update_epsilon( CGAL_NTS abs(l2a * l1b) - - CGAL_NTS abs(l1a * l2b) , - epsilon_5) ); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4,_epsilon_5); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &l1a, - const Restricted_double &l1b, - const Restricted_double &l2a, - const Restricted_double &l2b, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2, - const double & epsilon_3, - const double & epsilon_4, - const double & epsilon_5) - { - typedef Restricted_double FT; - - if (l1a == FT(0)) - return l2b == FT(0) ? SMALLER : Comparison_result(CGAL_NTS Static_Filtered_sign_1::epsilon_variant(l2a*l2b, - epsilon_0)); - if (l2a == FT(0)) - return l1b == FT(0) ? LARGER : Comparison_result(-CGAL_NTS Static_Filtered_sign_1::epsilon_variant(l1a*l1b, - epsilon_1)); - if (l1b == FT(0)) return l2b == FT(0) ? EQUAL : LARGER; - if (l2b == FT(0)) return SMALLER; - int l1_sign = CGAL_NTS Static_Filtered_sign_1::epsilon_variant(-l1a * l1b, - epsilon_2); - int l2_sign = CGAL_NTS Static_Filtered_sign_1::epsilon_variant(-l2a * l2b, - epsilon_3); - - if (l1_sign < l2_sign) return SMALLER; - if (l1_sign > l2_sign) return LARGER; - - if (l1_sign > 0) - return Comparison_result( CGAL_NTS Static_Filtered_sign_1::epsilon_variant( CGAL_NTS abs(l1a * l2b) - - CGAL_NTS abs(l2a * l1b) , - epsilon_4) ); - - return Comparison_result( CGAL_NTS Static_Filtered_sign_1::epsilon_variant( CGAL_NTS abs(l2a * l1b) - - CGAL_NTS abs(l1a * l2b) , - epsilon_5) ); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -compare_slopesC2( - const Filtered_exact &l1a, - const Filtered_exact &l1b, - const Filtered_exact &l2a, - const Filtered_exact &l2b) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_compare_slopesC2_4::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(l1a.to_double()) > SAF_bound || - fabs(l1b.to_double()) > SAF_bound || - fabs(l2a.to_double()) > SAF_bound || - fabs(l2b.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(l1a.to_double())); - NEW_bound = max(NEW_bound, fabs(l1b.to_double())); - NEW_bound = max(NEW_bound, fabs(l2a.to_double())); - NEW_bound = max(NEW_bound, fabs(l2b.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA compare_slopesC2 updates"); - ++updates; -#endif - Static_Filtered_compare_slopesC2_4::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA compare_slopesC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_slopesC2_4::epsilon_variant( - l1a.dbl(), - l1b.dbl(), - l2a.dbl(), - l2b.dbl(), - Static_Filtered_compare_slopesC2_4::_epsilon_0, - Static_Filtered_compare_slopesC2_4::_epsilon_1, - Static_Filtered_compare_slopesC2_4::_epsilon_2, - Static_Filtered_compare_slopesC2_4::_epsilon_3, - Static_Filtered_compare_slopesC2_4::_epsilon_4, - Static_Filtered_compare_slopesC2_4::_epsilon_5); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA compare_slopesC2 failures"); - ++failures; -#endif - return compare_slopesC2( - l1a.exact(), - l1b.exact(), - l2a.exact(), - l2b.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -compare_slopesC2( - const Filtered_exact &l1a, - const Filtered_exact &l1b, - const Filtered_exact &l2a, - const Filtered_exact &l2b) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_compare_slopesC2_4::_bound; ) - CGAL_assertion(!( - fabs(l1a.to_double()) > SAF_bound || - fabs(l1b.to_double()) > SAF_bound || - fabs(l2a.to_double()) > SAF_bound || - fabs(l2b.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST compare_slopesC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_slopesC2_4::epsilon_variant( - l1a.dbl(), - l1b.dbl(), - l2a.dbl(), - l2b.dbl(), - Static_Filtered_compare_slopesC2_4::_epsilon_0, - Static_Filtered_compare_slopesC2_4::_epsilon_1, - Static_Filtered_compare_slopesC2_4::_epsilon_2, - Static_Filtered_compare_slopesC2_4::_epsilon_3, - Static_Filtered_compare_slopesC2_4::_epsilon_4, - Static_Filtered_compare_slopesC2_4::_epsilon_5); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST compare_slopesC2 failures"); - ++failures; -#endif - return compare_slopesC2( - l1a.exact(), - l1b.exact(), - l2a.exact(), - l2b.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -3275,367 +664,6 @@ compare_slopesC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_compare_slopesC2_8 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4,_epsilon_5,_epsilon_6,_epsilon_7,_epsilon_8,_epsilon_9,_epsilon_10,_epsilon_11; - - static Comparison_result update_epsilon( - const Static_filter_error &s1_src_x, - const Static_filter_error &s1_src_y, - const Static_filter_error &s1_tgt_x, - const Static_filter_error &s1_tgt_y, - const Static_filter_error &s2_src_x, - const Static_filter_error &s2_src_y, - const Static_filter_error &s2_tgt_x, - const Static_filter_error &s2_tgt_y, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2, - double & epsilon_3, - double & epsilon_4, - double & epsilon_5, - double & epsilon_6, - double & epsilon_7, - double & epsilon_8, - double & epsilon_9, - double & epsilon_10, - double & epsilon_11) - { - typedef Static_filter_error FT; - - Comparison_result cmp_y1 = CGAL_NTS Static_Filtered_compare_2::update_epsilon(s1_src_y, s1_tgt_y, - epsilon_0); - if (cmp_y1 == EQUAL) - { - Comparison_result cmp_x2 = CGAL_NTS Static_Filtered_compare_2::update_epsilon(s2_src_x, s2_tgt_x, - epsilon_1); - - if (cmp_x2 == EQUAL) return SMALLER; - return Comparison_result (- CGAL_NTS Static_Filtered_sign_1::update_epsilon((s2_src_y - s2_tgt_y) * - (s2_src_x - s2_tgt_x), - epsilon_2) ); - } - - Comparison_result cmp_y2 = CGAL_NTS Static_Filtered_compare_2::update_epsilon(s2_src_y, s2_tgt_y, - epsilon_3); - if (cmp_y2 == EQUAL) - { - Comparison_result cmp_x1 = CGAL_NTS Static_Filtered_compare_2::update_epsilon(s1_src_x, s1_tgt_x, - epsilon_4); - - if (cmp_x1 == EQUAL) return LARGER; - return Comparison_result ( CGAL_NTS Static_Filtered_sign_1::update_epsilon((s1_src_y - s1_tgt_y) * - (s1_src_x - s1_tgt_x), - epsilon_5) ); - } - - Comparison_result cmp_x1 = CGAL_NTS Static_Filtered_compare_2::update_epsilon(s1_src_x, s1_tgt_x, - epsilon_6); - Comparison_result cmp_x2 = CGAL_NTS Static_Filtered_compare_2::update_epsilon(s2_src_x, s2_tgt_x, - epsilon_7); - - if (cmp_x1 == EQUAL) return cmp_x2 == EQUAL ? EQUAL : LARGER; - - if (cmp_x2 == EQUAL) return SMALLER; - - FT s1_xdiff = s1_src_x - s1_tgt_x; - FT s1_ydiff = s1_src_y - s1_tgt_y; - FT s2_xdiff = s2_src_x - s2_tgt_x; - FT s2_ydiff = s2_src_y - s2_tgt_y; - Sign s1_sign = CGAL_NTS Static_Filtered_sign_1::update_epsilon(s1_ydiff * s1_xdiff, - epsilon_8); - Sign s2_sign = CGAL_NTS Static_Filtered_sign_1::update_epsilon(s2_ydiff * s2_xdiff, - epsilon_9); - - if (s1_sign < s2_sign) return SMALLER; - if (s1_sign > s2_sign) return LARGER; - - if (s1_sign > 0) - return Comparison_result( - CGAL_NTS Static_Filtered_sign_1::update_epsilon( CGAL_NTS abs(s1_ydiff * s2_xdiff) - - CGAL_NTS abs(s2_ydiff * s1_xdiff), - epsilon_10) ); - - return Comparison_result( - CGAL_NTS Static_Filtered_sign_1::update_epsilon( CGAL_NTS abs(s2_ydiff * s1_xdiff) - - CGAL_NTS abs(s1_ydiff * s2_xdiff), - epsilon_11) ); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4,_epsilon_5,_epsilon_6,_epsilon_7,_epsilon_8,_epsilon_9,_epsilon_10,_epsilon_11); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &s1_src_x, - const Restricted_double &s1_src_y, - const Restricted_double &s1_tgt_x, - const Restricted_double &s1_tgt_y, - const Restricted_double &s2_src_x, - const Restricted_double &s2_src_y, - const Restricted_double &s2_tgt_x, - const Restricted_double &s2_tgt_y, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2, - const double & epsilon_3, - const double & epsilon_4, - const double & epsilon_5, - const double & epsilon_6, - const double & epsilon_7, - const double & epsilon_8, - const double & epsilon_9, - const double & epsilon_10, - const double & epsilon_11) - { - typedef Restricted_double FT; - - Comparison_result cmp_y1 = CGAL_NTS Static_Filtered_compare_2::epsilon_variant(s1_src_y, s1_tgt_y, - epsilon_0); - if (cmp_y1 == EQUAL) - { - Comparison_result cmp_x2 = CGAL_NTS Static_Filtered_compare_2::epsilon_variant(s2_src_x, s2_tgt_x, - epsilon_1); - - if (cmp_x2 == EQUAL) return SMALLER; - return Comparison_result (- CGAL_NTS Static_Filtered_sign_1::epsilon_variant((s2_src_y - s2_tgt_y) * - (s2_src_x - s2_tgt_x), - epsilon_2) ); - } - - Comparison_result cmp_y2 = CGAL_NTS Static_Filtered_compare_2::epsilon_variant(s2_src_y, s2_tgt_y, - epsilon_3); - if (cmp_y2 == EQUAL) - { - Comparison_result cmp_x1 = CGAL_NTS Static_Filtered_compare_2::epsilon_variant(s1_src_x, s1_tgt_x, - epsilon_4); - - if (cmp_x1 == EQUAL) return LARGER; - return Comparison_result ( CGAL_NTS Static_Filtered_sign_1::epsilon_variant((s1_src_y - s1_tgt_y) * - (s1_src_x - s1_tgt_x), - epsilon_5) ); - } - - Comparison_result cmp_x1 = CGAL_NTS Static_Filtered_compare_2::epsilon_variant(s1_src_x, s1_tgt_x, - epsilon_6); - Comparison_result cmp_x2 = CGAL_NTS Static_Filtered_compare_2::epsilon_variant(s2_src_x, s2_tgt_x, - epsilon_7); - - if (cmp_x1 == EQUAL) return cmp_x2 == EQUAL ? EQUAL : LARGER; - - if (cmp_x2 == EQUAL) return SMALLER; - - FT s1_xdiff = s1_src_x - s1_tgt_x; - FT s1_ydiff = s1_src_y - s1_tgt_y; - FT s2_xdiff = s2_src_x - s2_tgt_x; - FT s2_ydiff = s2_src_y - s2_tgt_y; - Sign s1_sign = CGAL_NTS Static_Filtered_sign_1::epsilon_variant(s1_ydiff * s1_xdiff, - epsilon_8); - Sign s2_sign = CGAL_NTS Static_Filtered_sign_1::epsilon_variant(s2_ydiff * s2_xdiff, - epsilon_9); - - if (s1_sign < s2_sign) return SMALLER; - if (s1_sign > s2_sign) return LARGER; - - if (s1_sign > 0) - return Comparison_result( - CGAL_NTS Static_Filtered_sign_1::epsilon_variant( CGAL_NTS abs(s1_ydiff * s2_xdiff) - - CGAL_NTS abs(s2_ydiff * s1_xdiff), - epsilon_10) ); - - return Comparison_result( - CGAL_NTS Static_Filtered_sign_1::epsilon_variant( CGAL_NTS abs(s2_ydiff * s1_xdiff) - - CGAL_NTS abs(s1_ydiff * s2_xdiff), - epsilon_11) ); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -compare_slopesC2( - const Filtered_exact &s1_src_x, - const Filtered_exact &s1_src_y, - const Filtered_exact &s1_tgt_x, - const Filtered_exact &s1_tgt_y, - const Filtered_exact &s2_src_x, - const Filtered_exact &s2_src_y, - const Filtered_exact &s2_tgt_x, - const Filtered_exact &s2_tgt_y) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_compare_slopesC2_8::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(s1_src_x.to_double()) > SAF_bound || - fabs(s1_src_y.to_double()) > SAF_bound || - fabs(s1_tgt_x.to_double()) > SAF_bound || - fabs(s1_tgt_y.to_double()) > SAF_bound || - fabs(s2_src_x.to_double()) > SAF_bound || - fabs(s2_src_y.to_double()) > SAF_bound || - fabs(s2_tgt_x.to_double()) > SAF_bound || - fabs(s2_tgt_y.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(s1_src_x.to_double())); - NEW_bound = max(NEW_bound, fabs(s1_src_y.to_double())); - NEW_bound = max(NEW_bound, fabs(s1_tgt_x.to_double())); - NEW_bound = max(NEW_bound, fabs(s1_tgt_y.to_double())); - NEW_bound = max(NEW_bound, fabs(s2_src_x.to_double())); - NEW_bound = max(NEW_bound, fabs(s2_src_y.to_double())); - NEW_bound = max(NEW_bound, fabs(s2_tgt_x.to_double())); - NEW_bound = max(NEW_bound, fabs(s2_tgt_y.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA compare_slopesC2 updates"); - ++updates; -#endif - Static_Filtered_compare_slopesC2_8::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA compare_slopesC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_slopesC2_8::epsilon_variant( - s1_src_x.dbl(), - s1_src_y.dbl(), - s1_tgt_x.dbl(), - s1_tgt_y.dbl(), - s2_src_x.dbl(), - s2_src_y.dbl(), - s2_tgt_x.dbl(), - s2_tgt_y.dbl(), - Static_Filtered_compare_slopesC2_8::_epsilon_0, - Static_Filtered_compare_slopesC2_8::_epsilon_1, - Static_Filtered_compare_slopesC2_8::_epsilon_2, - Static_Filtered_compare_slopesC2_8::_epsilon_3, - Static_Filtered_compare_slopesC2_8::_epsilon_4, - Static_Filtered_compare_slopesC2_8::_epsilon_5, - Static_Filtered_compare_slopesC2_8::_epsilon_6, - Static_Filtered_compare_slopesC2_8::_epsilon_7, - Static_Filtered_compare_slopesC2_8::_epsilon_8, - Static_Filtered_compare_slopesC2_8::_epsilon_9, - Static_Filtered_compare_slopesC2_8::_epsilon_10, - Static_Filtered_compare_slopesC2_8::_epsilon_11); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA compare_slopesC2 failures"); - ++failures; -#endif - return compare_slopesC2( - s1_src_x.exact(), - s1_src_y.exact(), - s1_tgt_x.exact(), - s1_tgt_y.exact(), - s2_src_x.exact(), - s2_src_y.exact(), - s2_tgt_x.exact(), - s2_tgt_y.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -compare_slopesC2( - const Filtered_exact &s1_src_x, - const Filtered_exact &s1_src_y, - const Filtered_exact &s1_tgt_x, - const Filtered_exact &s1_tgt_y, - const Filtered_exact &s2_src_x, - const Filtered_exact &s2_src_y, - const Filtered_exact &s2_tgt_x, - const Filtered_exact &s2_tgt_y) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_compare_slopesC2_8::_bound; ) - CGAL_assertion(!( - fabs(s1_src_x.to_double()) > SAF_bound || - fabs(s1_src_y.to_double()) > SAF_bound || - fabs(s1_tgt_x.to_double()) > SAF_bound || - fabs(s1_tgt_y.to_double()) > SAF_bound || - fabs(s2_src_x.to_double()) > SAF_bound || - fabs(s2_src_y.to_double()) > SAF_bound || - fabs(s2_tgt_x.to_double()) > SAF_bound || - fabs(s2_tgt_y.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST compare_slopesC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_slopesC2_8::epsilon_variant( - s1_src_x.dbl(), - s1_src_y.dbl(), - s1_tgt_x.dbl(), - s1_tgt_y.dbl(), - s2_src_x.dbl(), - s2_src_y.dbl(), - s2_tgt_x.dbl(), - s2_tgt_y.dbl(), - Static_Filtered_compare_slopesC2_8::_epsilon_0, - Static_Filtered_compare_slopesC2_8::_epsilon_1, - Static_Filtered_compare_slopesC2_8::_epsilon_2, - Static_Filtered_compare_slopesC2_8::_epsilon_3, - Static_Filtered_compare_slopesC2_8::_epsilon_4, - Static_Filtered_compare_slopesC2_8::_epsilon_5, - Static_Filtered_compare_slopesC2_8::_epsilon_6, - Static_Filtered_compare_slopesC2_8::_epsilon_7, - Static_Filtered_compare_slopesC2_8::_epsilon_8, - Static_Filtered_compare_slopesC2_8::_epsilon_9, - Static_Filtered_compare_slopesC2_8::_epsilon_10, - Static_Filtered_compare_slopesC2_8::_epsilon_11); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST compare_slopesC2 failures"); - ++failures; -#endif - return compare_slopesC2( - s1_src_x.exact(), - s1_src_y.exact(), - s1_tgt_x.exact(), - s1_tgt_y.exact(), - s2_src_x.exact(), - s2_src_y.exact(), - s2_tgt_x.exact(), - s2_tgt_y.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -3678,169 +706,6 @@ compare_deltax_deltayC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_compare_deltax_deltayC2_4 -{ - static double _bound; - static double _epsilon_0; - - static Comparison_result update_epsilon( - const Static_filter_error &px, - const Static_filter_error &qx, - const Static_filter_error &ry, - const Static_filter_error &sy, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return CGAL_NTS Static_Filtered_compare_2::update_epsilon(CGAL_NTS abs(px-qx), CGAL_NTS abs(ry-sy), - epsilon_0); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &px, - const Restricted_double &qx, - const Restricted_double &ry, - const Restricted_double &sy, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return CGAL_NTS Static_Filtered_compare_2::epsilon_variant(CGAL_NTS abs(px-qx), CGAL_NTS abs(ry-sy), - epsilon_0); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Comparison_result -compare_deltax_deltayC2( - const Filtered_exact &px, - const Filtered_exact &qx, - const Filtered_exact &ry, - const Filtered_exact &sy) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_compare_deltax_deltayC2_4::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(sy.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - NEW_bound = max(NEW_bound, fabs(sy.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA compare_deltax_deltayC2 updates"); - ++updates; -#endif - Static_Filtered_compare_deltax_deltayC2_4::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA compare_deltax_deltayC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_deltax_deltayC2_4::epsilon_variant( - px.dbl(), - qx.dbl(), - ry.dbl(), - sy.dbl(), - Static_Filtered_compare_deltax_deltayC2_4::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA compare_deltax_deltayC2 failures"); - ++failures; -#endif - return compare_deltax_deltayC2( - px.exact(), - qx.exact(), - ry.exact(), - sy.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Comparison_result -compare_deltax_deltayC2( - const Filtered_exact &px, - const Filtered_exact &qx, - const Filtered_exact &ry, - const Filtered_exact &sy) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_compare_deltax_deltayC2_4::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(sy.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST compare_deltax_deltayC2 calls"); - ++calls; -#endif - return Static_Filtered_compare_deltax_deltayC2_4::epsilon_variant( - px.dbl(), - qx.dbl(), - ry.dbl(), - sy.dbl(), - Static_Filtered_compare_deltax_deltayC2_4::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST compare_deltax_deltayC2 failures"); - ++failures; -#endif - return compare_deltax_deltayC2( - px.exact(), - qx.exact(), - ry.exact(), - sy.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -3889,193 +754,6 @@ orientationC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_orientationC2_6 -{ - static double _bound; - static double _epsilon_0; - - static Orientation update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &rx, - const Static_filter_error &ry, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return Orientation (Static_Filtered_sign_of_determinant2x2_4::update_epsilon(qx-px, qy-py, - rx-px, ry-py, - epsilon_0)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Orientation epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &rx, - const Restricted_double &ry, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return Orientation (Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(qx-px, qy-py, - rx-px, ry-py, - epsilon_0)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Orientation -orientationC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &rx, - const Filtered_exact &ry) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_orientationC2_6::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA orientationC2 updates"); - ++updates; -#endif - Static_Filtered_orientationC2_6::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA orientationC2 calls"); - ++calls; -#endif - return Static_Filtered_orientationC2_6::epsilon_variant( - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - rx.dbl(), - ry.dbl(), - Static_Filtered_orientationC2_6::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA orientationC2 failures"); - ++failures; -#endif - return orientationC2( - px.exact(), - py.exact(), - qx.exact(), - qy.exact(), - rx.exact(), - ry.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Orientation -orientationC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &rx, - const Filtered_exact &ry) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_orientationC2_6::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST orientationC2 calls"); - ++calls; -#endif - return Static_Filtered_orientationC2_6::epsilon_variant( - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - rx.dbl(), - ry.dbl(), - Static_Filtered_orientationC2_6::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST orientationC2 failures"); - ++failures; -#endif - return orientationC2( - px.exact(), - py.exact(), - qx.exact(), - qy.exact(), - rx.exact(), - ry.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -4124,191 +802,6 @@ angleC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_angleC2_6 -{ - static double _bound; - static double _epsilon_0; - - static Angle update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &rx, - const Static_filter_error &ry, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return (Angle) CGAL_NTS Static_Filtered_sign_1::update_epsilon((px-qx)*(rx-qx)+(py-qy)*(ry-qy), - epsilon_0); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Angle epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &rx, - const Restricted_double &ry, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return (Angle) CGAL_NTS Static_Filtered_sign_1::epsilon_variant((px-qx)*(rx-qx)+(py-qy)*(ry-qy), - epsilon_0); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Angle -angleC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &rx, - const Filtered_exact &ry) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_angleC2_6::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA angleC2 updates"); - ++updates; -#endif - Static_Filtered_angleC2_6::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA angleC2 calls"); - ++calls; -#endif - return Static_Filtered_angleC2_6::epsilon_variant( - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - rx.dbl(), - ry.dbl(), - Static_Filtered_angleC2_6::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA angleC2 failures"); - ++failures; -#endif - return angleC2( - px.exact(), - py.exact(), - qx.exact(), - qy.exact(), - rx.exact(), - ry.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Angle -angleC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &rx, - const Filtered_exact &ry) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_angleC2_6::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST angleC2 calls"); - ++calls; -#endif - return Static_Filtered_angleC2_6::epsilon_variant( - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - rx.dbl(), - ry.dbl(), - Static_Filtered_angleC2_6::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST angleC2 failures"); - ++failures; -#endif - return angleC2( - px.exact(), - py.exact(), - qx.exact(), - qy.exact(), - rx.exact(), - ry.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -4363,249 +856,6 @@ side_of_oriented_circleC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_side_of_oriented_circleC2_8 -{ - static double _bound; - static double _epsilon_0; - - static Oriented_side update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &rx, - const Static_filter_error &ry, - const Static_filter_error &tx, - const Static_filter_error &ty, - double & epsilon_0) - { - typedef Static_filter_error FT; - - - - - - - - FT qpx = qx-px; - FT qpy = qy-py; - FT rpx = rx-px; - FT rpy = ry-py; - FT tpx = tx-px; - FT tpy = ty-py; - - - - - return Oriented_side(Static_Filtered_sign_of_determinant2x2_4::update_epsilon( - qpx*tpy - qpy*tpx, tpx*(tx-qx) + tpy*(ty-qy), - qpx*rpy - qpy*rpx, rpx*(rx-qx) + rpy*(ry-qy), - epsilon_0)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Oriented_side epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &rx, - const Restricted_double &ry, - const Restricted_double &tx, - const Restricted_double &ty, - const double & epsilon_0) - { - typedef Restricted_double FT; - - - - - - - - FT qpx = qx-px; - FT qpy = qy-py; - FT rpx = rx-px; - FT rpy = ry-py; - FT tpx = tx-px; - FT tpy = ty-py; - - - - - return Oriented_side(Static_Filtered_sign_of_determinant2x2_4::epsilon_variant( - qpx*tpy - qpy*tpx, tpx*(tx-qx) + tpy*(ty-qy), - qpx*rpy - qpy*rpx, rpx*(rx-qx) + rpy*(ry-qy), - epsilon_0)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Oriented_side -side_of_oriented_circleC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &tx, - const Filtered_exact &ty) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_side_of_oriented_circleC2_8::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - NEW_bound = max(NEW_bound, fabs(tx.to_double())); - NEW_bound = max(NEW_bound, fabs(ty.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA side_of_oriented_circleC2 updates"); - ++updates; -#endif - Static_Filtered_side_of_oriented_circleC2_8::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA side_of_oriented_circleC2 calls"); - ++calls; -#endif - return Static_Filtered_side_of_oriented_circleC2_8::epsilon_variant( - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - rx.dbl(), - ry.dbl(), - tx.dbl(), - ty.dbl(), - Static_Filtered_side_of_oriented_circleC2_8::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA side_of_oriented_circleC2 failures"); - ++failures; -#endif - return side_of_oriented_circleC2( - px.exact(), - py.exact(), - qx.exact(), - qy.exact(), - rx.exact(), - ry.exact(), - tx.exact(), - ty.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Oriented_side -side_of_oriented_circleC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &tx, - const Filtered_exact &ty) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_side_of_oriented_circleC2_8::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST side_of_oriented_circleC2 calls"); - ++calls; -#endif - return Static_Filtered_side_of_oriented_circleC2_8::epsilon_variant( - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - rx.dbl(), - ry.dbl(), - tx.dbl(), - ty.dbl(), - Static_Filtered_side_of_oriented_circleC2_8::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST side_of_oriented_circleC2 failures"); - ++failures; -#endif - return side_of_oriented_circleC2( - px.exact(), - py.exact(), - qx.exact(), - qy.exact(), - rx.exact(), - ry.exact(), - tx.exact(), - ty.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -4660,221 +910,6 @@ side_of_bounded_circleC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_side_of_bounded_circleC2_8 -{ - static double _bound; - static double _epsilon_0,_epsilon_1; - - static Bounded_side update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &rx, - const Static_filter_error &ry, - const Static_filter_error &tx, - const Static_filter_error &ty, - double & epsilon_0, - double & epsilon_1) - { - typedef Static_filter_error FT; - - return Bounded_side( Static_Filtered_side_of_oriented_circleC2_8::update_epsilon(px,py,qx,qy,rx,ry,tx,ty, - epsilon_0) - * Static_Filtered_orientationC2_6::update_epsilon(px,py,qx,qy,rx,ry, - epsilon_1) ); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,_epsilon_0,_epsilon_1); - // TODO: We should verify that all epsilons have really been updated. - } - - static Bounded_side epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &rx, - const Restricted_double &ry, - const Restricted_double &tx, - const Restricted_double &ty, - const double & epsilon_0, - const double & epsilon_1) - { - typedef Restricted_double FT; - - return Bounded_side( Static_Filtered_side_of_oriented_circleC2_8::epsilon_variant(px,py,qx,qy,rx,ry,tx,ty, - epsilon_0) - * Static_Filtered_orientationC2_6::epsilon_variant(px,py,qx,qy,rx,ry, - epsilon_1) ); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Bounded_side -side_of_bounded_circleC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &tx, - const Filtered_exact &ty) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_side_of_bounded_circleC2_8::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - NEW_bound = max(NEW_bound, fabs(tx.to_double())); - NEW_bound = max(NEW_bound, fabs(ty.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA side_of_bounded_circleC2 updates"); - ++updates; -#endif - Static_Filtered_side_of_bounded_circleC2_8::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA side_of_bounded_circleC2 calls"); - ++calls; -#endif - return Static_Filtered_side_of_bounded_circleC2_8::epsilon_variant( - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - rx.dbl(), - ry.dbl(), - tx.dbl(), - ty.dbl(), - Static_Filtered_side_of_bounded_circleC2_8::_epsilon_0, - Static_Filtered_side_of_bounded_circleC2_8::_epsilon_1); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA side_of_bounded_circleC2 failures"); - ++failures; -#endif - return side_of_bounded_circleC2( - px.exact(), - py.exact(), - qx.exact(), - qy.exact(), - rx.exact(), - ry.exact(), - tx.exact(), - ty.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Bounded_side -side_of_bounded_circleC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &tx, - const Filtered_exact &ty) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_side_of_bounded_circleC2_8::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST side_of_bounded_circleC2 calls"); - ++calls; -#endif - return Static_Filtered_side_of_bounded_circleC2_8::epsilon_variant( - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - rx.dbl(), - ry.dbl(), - tx.dbl(), - ty.dbl(), - Static_Filtered_side_of_bounded_circleC2_8::_epsilon_0, - Static_Filtered_side_of_bounded_circleC2_8::_epsilon_1); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST side_of_bounded_circleC2 failures"); - ++failures; -#endif - return side_of_bounded_circleC2( - px.exact(), - py.exact(), - qx.exact(), - qy.exact(), - rx.exact(), - ry.exact(), - tx.exact(), - ty.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -4923,193 +958,6 @@ side_of_bounded_circleC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_side_of_bounded_circleC2_6 -{ - static double _bound; - static double _epsilon_0; - - static Bounded_side update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &tx, - const Static_filter_error &ty, - double & epsilon_0) - { - typedef Static_filter_error FT; - - - return Bounded_side( CGAL_NTS Static_Filtered_compare_2::update_epsilon((tx-px)*(qx-tx), (ty-py)*(ty-qy), - epsilon_0) ); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Bounded_side epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &tx, - const Restricted_double &ty, - const double & epsilon_0) - { - typedef Restricted_double FT; - - - return Bounded_side( CGAL_NTS Static_Filtered_compare_2::epsilon_variant((tx-px)*(qx-tx), (ty-py)*(ty-qy), - epsilon_0) ); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Bounded_side -side_of_bounded_circleC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &tx, - const Filtered_exact &ty) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_side_of_bounded_circleC2_6::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(tx.to_double())); - NEW_bound = max(NEW_bound, fabs(ty.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA side_of_bounded_circleC2 updates"); - ++updates; -#endif - Static_Filtered_side_of_bounded_circleC2_6::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA side_of_bounded_circleC2 calls"); - ++calls; -#endif - return Static_Filtered_side_of_bounded_circleC2_6::epsilon_variant( - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - tx.dbl(), - ty.dbl(), - Static_Filtered_side_of_bounded_circleC2_6::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA side_of_bounded_circleC2 failures"); - ++failures; -#endif - return side_of_bounded_circleC2( - px.exact(), - py.exact(), - qx.exact(), - qy.exact(), - tx.exact(), - ty.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Bounded_side -side_of_bounded_circleC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &tx, - const Filtered_exact &ty) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_side_of_bounded_circleC2_6::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST side_of_bounded_circleC2 calls"); - ++calls; -#endif - return Static_Filtered_side_of_bounded_circleC2_6::epsilon_variant( - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - tx.dbl(), - ty.dbl(), - Static_Filtered_side_of_bounded_circleC2_6::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST side_of_bounded_circleC2 failures"); - ++failures; -#endif - return side_of_bounded_circleC2( - px.exact(), - py.exact(), - qx.exact(), - qy.exact(), - tx.exact(), - ty.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -5158,193 +1006,6 @@ cmp_dist_to_pointC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_cmp_dist_to_pointC2_6 -{ - static double _bound; - static double _epsilon_0; - - static Comparison_result update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &rx, - const Static_filter_error &ry, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return CGAL_NTS Static_Filtered_compare_2::update_epsilon(squared_distanceC2(px,py,qx,qy), - squared_distanceC2(px,py,rx,ry), - epsilon_0); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &rx, - const Restricted_double &ry, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return CGAL_NTS Static_Filtered_compare_2::epsilon_variant(squared_distanceC2(px,py,qx,qy), - squared_distanceC2(px,py,rx,ry), - epsilon_0); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Comparison_result -cmp_dist_to_pointC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &rx, - const Filtered_exact &ry) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_cmp_dist_to_pointC2_6::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA cmp_dist_to_pointC2 updates"); - ++updates; -#endif - Static_Filtered_cmp_dist_to_pointC2_6::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA cmp_dist_to_pointC2 calls"); - ++calls; -#endif - return Static_Filtered_cmp_dist_to_pointC2_6::epsilon_variant( - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - rx.dbl(), - ry.dbl(), - Static_Filtered_cmp_dist_to_pointC2_6::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA cmp_dist_to_pointC2 failures"); - ++failures; -#endif - return cmp_dist_to_pointC2( - px.exact(), - py.exact(), - qx.exact(), - qy.exact(), - rx.exact(), - ry.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Comparison_result -cmp_dist_to_pointC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &rx, - const Filtered_exact &ry) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_cmp_dist_to_pointC2_6::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST cmp_dist_to_pointC2 calls"); - ++calls; -#endif - return Static_Filtered_cmp_dist_to_pointC2_6::epsilon_variant( - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - rx.dbl(), - ry.dbl(), - Static_Filtered_cmp_dist_to_pointC2_6::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST cmp_dist_to_pointC2 failures"); - ++failures; -#endif - return cmp_dist_to_pointC2( - px.exact(), - py.exact(), - qx.exact(), - qy.exact(), - rx.exact(), - ry.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -5393,193 +1054,6 @@ cmp_signed_dist_to_directionC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_cmp_signed_dist_to_directionC2_6 -{ - static double _bound; - static double _epsilon_0; - - static Comparison_result update_epsilon( - const Static_filter_error &la, - const Static_filter_error &lb, - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &qx, - const Static_filter_error &qy, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return CGAL_NTS Static_Filtered_compare_2::update_epsilon(scaled_distance_to_directionC2(la,lb,px,py), - scaled_distance_to_directionC2(la,lb,qx,qy), - epsilon_0); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &la, - const Restricted_double &lb, - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &qx, - const Restricted_double &qy, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return CGAL_NTS Static_Filtered_compare_2::epsilon_variant(scaled_distance_to_directionC2(la,lb,px,py), - scaled_distance_to_directionC2(la,lb,qx,qy), - epsilon_0); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Comparison_result -cmp_signed_dist_to_directionC2( - const Filtered_exact &la, - const Filtered_exact &lb, - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_cmp_signed_dist_to_directionC2_6::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(la.to_double()) > SAF_bound || - fabs(lb.to_double()) > SAF_bound || - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(la.to_double())); - NEW_bound = max(NEW_bound, fabs(lb.to_double())); - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA cmp_signed_dist_to_directionC2 updates"); - ++updates; -#endif - Static_Filtered_cmp_signed_dist_to_directionC2_6::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA cmp_signed_dist_to_directionC2 calls"); - ++calls; -#endif - return Static_Filtered_cmp_signed_dist_to_directionC2_6::epsilon_variant( - la.dbl(), - lb.dbl(), - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - Static_Filtered_cmp_signed_dist_to_directionC2_6::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA cmp_signed_dist_to_directionC2 failures"); - ++failures; -#endif - return cmp_signed_dist_to_directionC2( - la.exact(), - lb.exact(), - px.exact(), - py.exact(), - qx.exact(), - qy.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Comparison_result -cmp_signed_dist_to_directionC2( - const Filtered_exact &la, - const Filtered_exact &lb, - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_cmp_signed_dist_to_directionC2_6::_bound; ) - CGAL_assertion(!( - fabs(la.to_double()) > SAF_bound || - fabs(lb.to_double()) > SAF_bound || - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST cmp_signed_dist_to_directionC2 calls"); - ++calls; -#endif - return Static_Filtered_cmp_signed_dist_to_directionC2_6::epsilon_variant( - la.dbl(), - lb.dbl(), - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - Static_Filtered_cmp_signed_dist_to_directionC2_6::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST cmp_signed_dist_to_directionC2 failures"); - ++failures; -#endif - return cmp_signed_dist_to_directionC2( - la.exact(), - lb.exact(), - px.exact(), - py.exact(), - qx.exact(), - qy.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -5634,215 +1108,6 @@ cmp_signed_dist_to_lineC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_cmp_signed_dist_to_lineC2_8 -{ - static double _bound; - static double _epsilon_0; - - static Comparison_result update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &rx, - const Static_filter_error &ry, - const Static_filter_error &sx, - const Static_filter_error &sy, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return CGAL_NTS Static_Filtered_compare_2::update_epsilon(scaled_distance_to_lineC2(px,py,qx,qy,rx,ry), - scaled_distance_to_lineC2(px,py,qx,qy,sx,sy), - epsilon_0); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &rx, - const Restricted_double &ry, - const Restricted_double &sx, - const Restricted_double &sy, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return CGAL_NTS Static_Filtered_compare_2::epsilon_variant(scaled_distance_to_lineC2(px,py,qx,qy,rx,ry), - scaled_distance_to_lineC2(px,py,qx,qy,sx,sy), - epsilon_0); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Comparison_result -cmp_signed_dist_to_lineC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &sx, - const Filtered_exact &sy) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_cmp_signed_dist_to_lineC2_8::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(sx.to_double()) > SAF_bound || - fabs(sy.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - NEW_bound = max(NEW_bound, fabs(sx.to_double())); - NEW_bound = max(NEW_bound, fabs(sy.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA cmp_signed_dist_to_lineC2 updates"); - ++updates; -#endif - Static_Filtered_cmp_signed_dist_to_lineC2_8::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA cmp_signed_dist_to_lineC2 calls"); - ++calls; -#endif - return Static_Filtered_cmp_signed_dist_to_lineC2_8::epsilon_variant( - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - rx.dbl(), - ry.dbl(), - sx.dbl(), - sy.dbl(), - Static_Filtered_cmp_signed_dist_to_lineC2_8::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA cmp_signed_dist_to_lineC2 failures"); - ++failures; -#endif - return cmp_signed_dist_to_lineC2( - px.exact(), - py.exact(), - qx.exact(), - qy.exact(), - rx.exact(), - ry.exact(), - sx.exact(), - sy.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Comparison_result -cmp_signed_dist_to_lineC2( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &sx, - const Filtered_exact &sy) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_cmp_signed_dist_to_lineC2_8::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(sx.to_double()) > SAF_bound || - fabs(sy.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST cmp_signed_dist_to_lineC2 calls"); - ++calls; -#endif - return Static_Filtered_cmp_signed_dist_to_lineC2_8::epsilon_variant( - px.dbl(), - py.dbl(), - qx.dbl(), - qy.dbl(), - rx.dbl(), - ry.dbl(), - sx.dbl(), - sy.dbl(), - Static_Filtered_cmp_signed_dist_to_lineC2_8::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST cmp_signed_dist_to_lineC2 failures"); - ++failures; -#endif - return cmp_signed_dist_to_lineC2( - px.exact(), - py.exact(), - qx.exact(), - qy.exact(), - rx.exact(), - ry.exact(), - sx.exact(), - sy.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -5888,180 +1153,6 @@ side_of_oriented_lineC2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_side_of_oriented_lineC2_5 -{ - static double _bound; - static double _epsilon_0; - - static Oriented_side update_epsilon( - const Static_filter_error &a, - const Static_filter_error &b, - const Static_filter_error &c, - const Static_filter_error &x, - const Static_filter_error &y, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return Oriented_side(CGAL_NTS Static_Filtered_sign_1::update_epsilon(a*x+b*y+c, - epsilon_0)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Oriented_side epsilon_variant( - const Restricted_double &a, - const Restricted_double &b, - const Restricted_double &c, - const Restricted_double &x, - const Restricted_double &y, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return Oriented_side(CGAL_NTS Static_Filtered_sign_1::epsilon_variant(a*x+b*y+c, - epsilon_0)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Oriented_side -side_of_oriented_lineC2( - const Filtered_exact &a, - const Filtered_exact &b, - const Filtered_exact &c, - const Filtered_exact &x, - const Filtered_exact &y) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_side_of_oriented_lineC2_5::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(a.to_double()) > SAF_bound || - fabs(b.to_double()) > SAF_bound || - fabs(c.to_double()) > SAF_bound || - fabs(x.to_double()) > SAF_bound || - fabs(y.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(a.to_double())); - NEW_bound = max(NEW_bound, fabs(b.to_double())); - NEW_bound = max(NEW_bound, fabs(c.to_double())); - NEW_bound = max(NEW_bound, fabs(x.to_double())); - NEW_bound = max(NEW_bound, fabs(y.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA side_of_oriented_lineC2 updates"); - ++updates; -#endif - Static_Filtered_side_of_oriented_lineC2_5::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA side_of_oriented_lineC2 calls"); - ++calls; -#endif - return Static_Filtered_side_of_oriented_lineC2_5::epsilon_variant( - a.dbl(), - b.dbl(), - c.dbl(), - x.dbl(), - y.dbl(), - Static_Filtered_side_of_oriented_lineC2_5::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA side_of_oriented_lineC2 failures"); - ++failures; -#endif - return side_of_oriented_lineC2( - a.exact(), - b.exact(), - c.exact(), - x.exact(), - y.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Oriented_side -side_of_oriented_lineC2( - const Filtered_exact &a, - const Filtered_exact &b, - const Filtered_exact &c, - const Filtered_exact &x, - const Filtered_exact &y) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_side_of_oriented_lineC2_5::_bound; ) - CGAL_assertion(!( - fabs(a.to_double()) > SAF_bound || - fabs(b.to_double()) > SAF_bound || - fabs(c.to_double()) > SAF_bound || - fabs(x.to_double()) > SAF_bound || - fabs(y.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST side_of_oriented_lineC2 calls"); - ++calls; -#endif - return Static_Filtered_side_of_oriented_lineC2_5::epsilon_variant( - a.dbl(), - b.dbl(), - c.dbl(), - x.dbl(), - y.dbl(), - Static_Filtered_side_of_oriented_lineC2_5::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST side_of_oriented_lineC2 failures"); - ++failures; -#endif - return side_of_oriented_lineC2( - a.exact(), - b.exact(), - c.exact(), - x.exact(), - y.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - CGAL_END_NAMESPACE #endif // CGAL_ARITHMETIC_FILTER_PREDICATES_KERNEL_FTC2_H diff --git a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/kernel_ftC3.h b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/kernel_ftC3.h index fbe4237c27d..aa188fc98b9 100644 --- a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/kernel_ftC3.h +++ b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/kernel_ftC3.h @@ -76,207 +76,6 @@ strict_dominanceC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_strict_dominanceC3_6 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2; - - static bool update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2) - { - typedef Static_filter_error FT; - - return CGAL_NTS Static_Filtered_compare_2::update_epsilon(px, qx, - epsilon_0) == LARGER && - CGAL_NTS Static_Filtered_compare_2::update_epsilon(py, qy, - epsilon_1) == LARGER && - CGAL_NTS Static_Filtered_compare_2::update_epsilon(pz, qz, - epsilon_2) == LARGER; - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2); - // TODO: We should verify that all epsilons have really been updated. - } - - static bool epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2) - { - typedef Restricted_double FT; - - return CGAL_NTS Static_Filtered_compare_2::epsilon_variant(px, qx, - epsilon_0) == LARGER && - CGAL_NTS Static_Filtered_compare_2::epsilon_variant(py, qy, - epsilon_1) == LARGER && - CGAL_NTS Static_Filtered_compare_2::epsilon_variant(pz, qz, - epsilon_2) == LARGER; - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -bool -strict_dominanceC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_strict_dominanceC3_6::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA strict_dominanceC3 updates"); - ++updates; -#endif - Static_Filtered_strict_dominanceC3_6::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA strict_dominanceC3 calls"); - ++calls; -#endif - return Static_Filtered_strict_dominanceC3_6::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - Static_Filtered_strict_dominanceC3_6::_epsilon_0, - Static_Filtered_strict_dominanceC3_6::_epsilon_1, - Static_Filtered_strict_dominanceC3_6::_epsilon_2); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA strict_dominanceC3 failures"); - ++failures; -#endif - return strict_dominanceC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -bool -strict_dominanceC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_strict_dominanceC3_6::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST strict_dominanceC3 calls"); - ++calls; -#endif - return Static_Filtered_strict_dominanceC3_6::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - Static_Filtered_strict_dominanceC3_6::_epsilon_0, - Static_Filtered_strict_dominanceC3_6::_epsilon_1, - Static_Filtered_strict_dominanceC3_6::_epsilon_2); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST strict_dominanceC3 failures"); - ++failures; -#endif - return strict_dominanceC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -325,207 +124,6 @@ dominanceC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_dominanceC3_6 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2; - - static bool update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2) - { - typedef Static_filter_error FT; - - return CGAL_NTS Static_Filtered_compare_2::update_epsilon(px, qx, - epsilon_0) != SMALLER && - CGAL_NTS Static_Filtered_compare_2::update_epsilon(py, qy, - epsilon_1) != SMALLER && - CGAL_NTS Static_Filtered_compare_2::update_epsilon(pz, qz, - epsilon_2) != SMALLER; - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2); - // TODO: We should verify that all epsilons have really been updated. - } - - static bool epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2) - { - typedef Restricted_double FT; - - return CGAL_NTS Static_Filtered_compare_2::epsilon_variant(px, qx, - epsilon_0) != SMALLER && - CGAL_NTS Static_Filtered_compare_2::epsilon_variant(py, qy, - epsilon_1) != SMALLER && - CGAL_NTS Static_Filtered_compare_2::epsilon_variant(pz, qz, - epsilon_2) != SMALLER; - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -bool -dominanceC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_dominanceC3_6::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA dominanceC3 updates"); - ++updates; -#endif - Static_Filtered_dominanceC3_6::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA dominanceC3 calls"); - ++calls; -#endif - return Static_Filtered_dominanceC3_6::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - Static_Filtered_dominanceC3_6::_epsilon_0, - Static_Filtered_dominanceC3_6::_epsilon_1, - Static_Filtered_dominanceC3_6::_epsilon_2); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA dominanceC3 failures"); - ++failures; -#endif - return dominanceC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -bool -dominanceC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_dominanceC3_6::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST dominanceC3 calls"); - ++calls; -#endif - return Static_Filtered_dominanceC3_6::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - Static_Filtered_dominanceC3_6::_epsilon_0, - Static_Filtered_dominanceC3_6::_epsilon_1, - Static_Filtered_dominanceC3_6::_epsilon_2); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST dominanceC3 failures"); - ++failures; -#endif - return dominanceC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -583,254 +181,6 @@ collinearC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_collinearC3_9 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2; - - static bool update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - const Static_filter_error &rx, - const Static_filter_error &ry, - const Static_filter_error &rz, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2) - { - typedef Static_filter_error FT; - - FT dpx = px-rx; - FT dqx = qx-rx; - FT dpy = py-ry; - FT dqy = qy-ry; - if (Static_Filtered_sign_of_determinant2x2_4::update_epsilon(dpx, dqx, dpy, dqy, - epsilon_0) != ZERO) - return false; - FT dpz = pz-rz; - FT dqz = qz-rz; - return Static_Filtered_sign_of_determinant2x2_4::update_epsilon(dpx, dqx, dpz, dqz, - epsilon_1) == ZERO - && Static_Filtered_sign_of_determinant2x2_4::update_epsilon(dpy, dqy, dpz, dqz, - epsilon_2) == ZERO; - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2); - // TODO: We should verify that all epsilons have really been updated. - } - - static bool epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const Restricted_double &rx, - const Restricted_double &ry, - const Restricted_double &rz, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2) - { - typedef Restricted_double FT; - - FT dpx = px-rx; - FT dqx = qx-rx; - FT dpy = py-ry; - FT dqy = qy-ry; - if (Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(dpx, dqx, dpy, dqy, - epsilon_0) != ZERO) - return false; - FT dpz = pz-rz; - FT dqz = qz-rz; - return Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(dpx, dqx, dpz, dqz, - epsilon_1) == ZERO - && Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(dpy, dqy, dpz, dqz, - epsilon_2) == ZERO; - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -bool -collinearC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_collinearC3_9::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - NEW_bound = max(NEW_bound, fabs(rz.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA collinearC3 updates"); - ++updates; -#endif - Static_Filtered_collinearC3_9::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA collinearC3 calls"); - ++calls; -#endif - return Static_Filtered_collinearC3_9::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - Static_Filtered_collinearC3_9::_epsilon_0, - Static_Filtered_collinearC3_9::_epsilon_1, - Static_Filtered_collinearC3_9::_epsilon_2); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA collinearC3 failures"); - ++failures; -#endif - return collinearC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - rx.exact(), - ry.exact(), - rz.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -bool -collinearC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_collinearC3_9::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST collinearC3 calls"); - ++calls; -#endif - return Static_Filtered_collinearC3_9::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - Static_Filtered_collinearC3_9::_epsilon_0, - Static_Filtered_collinearC3_9::_epsilon_1, - Static_Filtered_collinearC3_9::_epsilon_2); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST collinearC3 failures"); - ++failures; -#endif - return collinearC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - rx.exact(), - ry.exact(), - rz.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -897,261 +247,6 @@ orientationC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_orientationC3_12 -{ - static double _bound; - static double _epsilon_0; - - static Orientation update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - const Static_filter_error &rx, - const Static_filter_error &ry, - const Static_filter_error &rz, - const Static_filter_error &sx, - const Static_filter_error &sy, - const Static_filter_error &sz, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return Orientation(Static_Filtered_sign_of_determinant3x3_9::update_epsilon(qx-px,rx-px,sx-px, - qy-py,ry-py,sy-py, - qz-pz,rz-pz,sz-pz, - epsilon_0)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Orientation epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const Restricted_double &rx, - const Restricted_double &ry, - const Restricted_double &rz, - const Restricted_double &sx, - const Restricted_double &sy, - const Restricted_double &sz, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return Orientation(Static_Filtered_sign_of_determinant3x3_9::epsilon_variant(qx-px,rx-px,sx-px, - qy-py,ry-py,sy-py, - qz-pz,rz-pz,sz-pz, - epsilon_0)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Orientation -orientationC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz, - const Filtered_exact &sx, - const Filtered_exact &sy, - const Filtered_exact &sz) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_orientationC3_12::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound || - fabs(sx.to_double()) > SAF_bound || - fabs(sy.to_double()) > SAF_bound || - fabs(sz.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - NEW_bound = max(NEW_bound, fabs(rz.to_double())); - NEW_bound = max(NEW_bound, fabs(sx.to_double())); - NEW_bound = max(NEW_bound, fabs(sy.to_double())); - NEW_bound = max(NEW_bound, fabs(sz.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA orientationC3 updates"); - ++updates; -#endif - Static_Filtered_orientationC3_12::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA orientationC3 calls"); - ++calls; -#endif - return Static_Filtered_orientationC3_12::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - sx.dbl(), - sy.dbl(), - sz.dbl(), - Static_Filtered_orientationC3_12::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA orientationC3 failures"); - ++failures; -#endif - return orientationC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - rx.exact(), - ry.exact(), - rz.exact(), - sx.exact(), - sy.exact(), - sz.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Orientation -orientationC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz, - const Filtered_exact &sx, - const Filtered_exact &sy, - const Filtered_exact &sz) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_orientationC3_12::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound || - fabs(sx.to_double()) > SAF_bound || - fabs(sy.to_double()) > SAF_bound || - fabs(sz.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST orientationC3 calls"); - ++calls; -#endif - return Static_Filtered_orientationC3_12::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - sx.dbl(), - sy.dbl(), - sz.dbl(), - Static_Filtered_orientationC3_12::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST orientationC3 failures"); - ++failures; -#endif - return orientationC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - rx.exact(), - ry.exact(), - rz.exact(), - sx.exact(), - sy.exact(), - sz.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -1209,228 +304,6 @@ angleC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_angleC3_9 -{ - static double _bound; - static double _epsilon_0; - - static Angle update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - const Static_filter_error &rx, - const Static_filter_error &ry, - const Static_filter_error &rz, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return (Angle) CGAL_NTS Static_Filtered_sign_1::update_epsilon((px-qx)*(rx-qx)+ - (py-qy)*(ry-qy)+ - (pz-qz)*(rz-qz), - epsilon_0); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Angle epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const Restricted_double &rx, - const Restricted_double &ry, - const Restricted_double &rz, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return (Angle) CGAL_NTS Static_Filtered_sign_1::epsilon_variant((px-qx)*(rx-qx)+ - (py-qy)*(ry-qy)+ - (pz-qz)*(rz-qz), - epsilon_0); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Angle -angleC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_angleC3_9::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - NEW_bound = max(NEW_bound, fabs(rz.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA angleC3 updates"); - ++updates; -#endif - Static_Filtered_angleC3_9::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA angleC3 calls"); - ++calls; -#endif - return Static_Filtered_angleC3_9::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - Static_Filtered_angleC3_9::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA angleC3 failures"); - ++failures; -#endif - return angleC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - rx.exact(), - ry.exact(), - rz.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Angle -angleC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_angleC3_9::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST angleC3 calls"); - ++calls; -#endif - return Static_Filtered_angleC3_9::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - Static_Filtered_angleC3_9::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST angleC3 failures"); - ++failures; -#endif - return angleC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - rx.exact(), - ry.exact(), - rz.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -1497,315 +370,6 @@ coplanar_side_of_bounded_circleC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_coplanar_side_of_bounded_circleC3_12 -{ - static double _bound; - static double _epsilon_0; - - static Bounded_side update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - const Static_filter_error &rx, - const Static_filter_error &ry, - const Static_filter_error &rz, - const Static_filter_error &tx, - const Static_filter_error &ty, - const Static_filter_error &tz, - double & epsilon_0) - { - typedef Static_filter_error FT; - - - - - - FT ptx = px - tx; - FT pty = py - ty; - FT ptz = pz - tz; - FT pt2 = CGAL_NTS square(ptx) + CGAL_NTS square(pty) + CGAL_NTS square(ptz); - FT qtx = qx - tx; - FT qty = qy - ty; - FT qtz = qz - tz; - FT qt2 = CGAL_NTS square(qtx) + CGAL_NTS square(qty) + CGAL_NTS square(qtz); - FT rtx = rx - tx; - FT rty = ry - ty; - FT rtz = rz - tz; - FT rt2 = CGAL_NTS square(rtx) + CGAL_NTS square(rty) + CGAL_NTS square(rtz); - FT pqx = qx - px; - FT pqy = qy - py; - FT pqz = qz - pz; - FT prx = rx - px; - FT pry = ry - py; - FT prz = rz - pz; - FT vx = pqy*prz - pqz*pry; - FT vy = pqz*prx - pqx*prz; - FT vz = pqx*pry - pqy*prx; - FT v2 = CGAL_NTS square(vx) + CGAL_NTS square(vy) + CGAL_NTS square(vz); - return Bounded_side(Static_Filtered_sign_of_determinant4x4_16::update_epsilon(ptx,pty,ptz,pt2, - rtx,rty,rtz,rt2, - qtx,qty,qtz,qt2, - vx,vy,vz,v2, - epsilon_0)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Bounded_side epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const Restricted_double &rx, - const Restricted_double &ry, - const Restricted_double &rz, - const Restricted_double &tx, - const Restricted_double &ty, - const Restricted_double &tz, - const double & epsilon_0) - { - typedef Restricted_double FT; - - - - - - FT ptx = px - tx; - FT pty = py - ty; - FT ptz = pz - tz; - FT pt2 = CGAL_NTS square(ptx) + CGAL_NTS square(pty) + CGAL_NTS square(ptz); - FT qtx = qx - tx; - FT qty = qy - ty; - FT qtz = qz - tz; - FT qt2 = CGAL_NTS square(qtx) + CGAL_NTS square(qty) + CGAL_NTS square(qtz); - FT rtx = rx - tx; - FT rty = ry - ty; - FT rtz = rz - tz; - FT rt2 = CGAL_NTS square(rtx) + CGAL_NTS square(rty) + CGAL_NTS square(rtz); - FT pqx = qx - px; - FT pqy = qy - py; - FT pqz = qz - pz; - FT prx = rx - px; - FT pry = ry - py; - FT prz = rz - pz; - FT vx = pqy*prz - pqz*pry; - FT vy = pqz*prx - pqx*prz; - FT vz = pqx*pry - pqy*prx; - FT v2 = CGAL_NTS square(vx) + CGAL_NTS square(vy) + CGAL_NTS square(vz); - return Bounded_side(Static_Filtered_sign_of_determinant4x4_16::epsilon_variant(ptx,pty,ptz,pt2, - rtx,rty,rtz,rt2, - qtx,qty,qtz,qt2, - vx,vy,vz,v2, - epsilon_0)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Bounded_side -coplanar_side_of_bounded_circleC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_coplanar_side_of_bounded_circleC3_12::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - NEW_bound = max(NEW_bound, fabs(rz.to_double())); - NEW_bound = max(NEW_bound, fabs(tx.to_double())); - NEW_bound = max(NEW_bound, fabs(ty.to_double())); - NEW_bound = max(NEW_bound, fabs(tz.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA coplanar_side_of_bounded_circleC3 updates"); - ++updates; -#endif - Static_Filtered_coplanar_side_of_bounded_circleC3_12::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA coplanar_side_of_bounded_circleC3 calls"); - ++calls; -#endif - return Static_Filtered_coplanar_side_of_bounded_circleC3_12::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - Static_Filtered_coplanar_side_of_bounded_circleC3_12::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA coplanar_side_of_bounded_circleC3 failures"); - ++failures; -#endif - return coplanar_side_of_bounded_circleC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - rx.exact(), - ry.exact(), - rz.exact(), - tx.exact(), - ty.exact(), - tz.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Bounded_side -coplanar_side_of_bounded_circleC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_coplanar_side_of_bounded_circleC3_12::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST coplanar_side_of_bounded_circleC3 calls"); - ++calls; -#endif - return Static_Filtered_coplanar_side_of_bounded_circleC3_12::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - Static_Filtered_coplanar_side_of_bounded_circleC3_12::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST coplanar_side_of_bounded_circleC3 failures"); - ++failures; -#endif - return coplanar_side_of_bounded_circleC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - rx.exact(), - ry.exact(), - rz.exact(), - tx.exact(), - ty.exact(), - tz.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -1854,249 +418,6 @@ equal_directionC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_equal_directionC3_6 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4,_epsilon_5,_epsilon_6,_epsilon_7,_epsilon_8; - - static bool update_epsilon( - const Static_filter_error &dx1, - const Static_filter_error &dy1, - const Static_filter_error &dz1, - const Static_filter_error &dx2, - const Static_filter_error &dy2, - const Static_filter_error &dz2, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2, - double & epsilon_3, - double & epsilon_4, - double & epsilon_5, - double & epsilon_6, - double & epsilon_7, - double & epsilon_8) - { - typedef Static_filter_error FT; - - return Static_Filtered_sign_of_determinant2x2_4::update_epsilon(dx1, dy1, dx2, dy2, - epsilon_0) == ZERO - && Static_Filtered_sign_of_determinant2x2_4::update_epsilon(dx1, dz1, dx2, dz2, - epsilon_1) == ZERO - && Static_Filtered_sign_of_determinant2x2_4::update_epsilon(dy1, dz1, dy2, dz2, - epsilon_2) == ZERO - && CGAL_NTS Static_Filtered_sign_1::update_epsilon(dx1, - epsilon_3) == CGAL_NTS Static_Filtered_sign_1::update_epsilon(dx2, - epsilon_4) - && CGAL_NTS Static_Filtered_sign_1::update_epsilon(dy1, - epsilon_5) == CGAL_NTS Static_Filtered_sign_1::update_epsilon(dy2, - epsilon_6) - && CGAL_NTS Static_Filtered_sign_1::update_epsilon(dz1, - epsilon_7) == CGAL_NTS Static_Filtered_sign_1::update_epsilon(dz2, - epsilon_8); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4,_epsilon_5,_epsilon_6,_epsilon_7,_epsilon_8); - // TODO: We should verify that all epsilons have really been updated. - } - - static bool epsilon_variant( - const Restricted_double &dx1, - const Restricted_double &dy1, - const Restricted_double &dz1, - const Restricted_double &dx2, - const Restricted_double &dy2, - const Restricted_double &dz2, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2, - const double & epsilon_3, - const double & epsilon_4, - const double & epsilon_5, - const double & epsilon_6, - const double & epsilon_7, - const double & epsilon_8) - { - typedef Restricted_double FT; - - return Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(dx1, dy1, dx2, dy2, - epsilon_0) == ZERO - && Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(dx1, dz1, dx2, dz2, - epsilon_1) == ZERO - && Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(dy1, dz1, dy2, dz2, - epsilon_2) == ZERO - && CGAL_NTS Static_Filtered_sign_1::epsilon_variant(dx1, - epsilon_3) == CGAL_NTS Static_Filtered_sign_1::epsilon_variant(dx2, - epsilon_4) - && CGAL_NTS Static_Filtered_sign_1::epsilon_variant(dy1, - epsilon_5) == CGAL_NTS Static_Filtered_sign_1::epsilon_variant(dy2, - epsilon_6) - && CGAL_NTS Static_Filtered_sign_1::epsilon_variant(dz1, - epsilon_7) == CGAL_NTS Static_Filtered_sign_1::epsilon_variant(dz2, - epsilon_8); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -bool -equal_directionC3( - const Filtered_exact &dx1, - const Filtered_exact &dy1, - const Filtered_exact &dz1, - const Filtered_exact &dx2, - const Filtered_exact &dy2, - const Filtered_exact &dz2) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_equal_directionC3_6::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(dx1.to_double()) > SAF_bound || - fabs(dy1.to_double()) > SAF_bound || - fabs(dz1.to_double()) > SAF_bound || - fabs(dx2.to_double()) > SAF_bound || - fabs(dy2.to_double()) > SAF_bound || - fabs(dz2.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(dx1.to_double())); - NEW_bound = max(NEW_bound, fabs(dy1.to_double())); - NEW_bound = max(NEW_bound, fabs(dz1.to_double())); - NEW_bound = max(NEW_bound, fabs(dx2.to_double())); - NEW_bound = max(NEW_bound, fabs(dy2.to_double())); - NEW_bound = max(NEW_bound, fabs(dz2.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA equal_directionC3 updates"); - ++updates; -#endif - Static_Filtered_equal_directionC3_6::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA equal_directionC3 calls"); - ++calls; -#endif - return Static_Filtered_equal_directionC3_6::epsilon_variant( - dx1.dbl(), - dy1.dbl(), - dz1.dbl(), - dx2.dbl(), - dy2.dbl(), - dz2.dbl(), - Static_Filtered_equal_directionC3_6::_epsilon_0, - Static_Filtered_equal_directionC3_6::_epsilon_1, - Static_Filtered_equal_directionC3_6::_epsilon_2, - Static_Filtered_equal_directionC3_6::_epsilon_3, - Static_Filtered_equal_directionC3_6::_epsilon_4, - Static_Filtered_equal_directionC3_6::_epsilon_5, - Static_Filtered_equal_directionC3_6::_epsilon_6, - Static_Filtered_equal_directionC3_6::_epsilon_7, - Static_Filtered_equal_directionC3_6::_epsilon_8); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA equal_directionC3 failures"); - ++failures; -#endif - return equal_directionC3( - dx1.exact(), - dy1.exact(), - dz1.exact(), - dx2.exact(), - dy2.exact(), - dz2.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -bool -equal_directionC3( - const Filtered_exact &dx1, - const Filtered_exact &dy1, - const Filtered_exact &dz1, - const Filtered_exact &dx2, - const Filtered_exact &dy2, - const Filtered_exact &dz2) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_equal_directionC3_6::_bound; ) - CGAL_assertion(!( - fabs(dx1.to_double()) > SAF_bound || - fabs(dy1.to_double()) > SAF_bound || - fabs(dz1.to_double()) > SAF_bound || - fabs(dx2.to_double()) > SAF_bound || - fabs(dy2.to_double()) > SAF_bound || - fabs(dz2.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST equal_directionC3 calls"); - ++calls; -#endif - return Static_Filtered_equal_directionC3_6::epsilon_variant( - dx1.dbl(), - dy1.dbl(), - dz1.dbl(), - dx2.dbl(), - dy2.dbl(), - dz2.dbl(), - Static_Filtered_equal_directionC3_6::_epsilon_0, - Static_Filtered_equal_directionC3_6::_epsilon_1, - Static_Filtered_equal_directionC3_6::_epsilon_2, - Static_Filtered_equal_directionC3_6::_epsilon_3, - Static_Filtered_equal_directionC3_6::_epsilon_4, - Static_Filtered_equal_directionC3_6::_epsilon_5, - Static_Filtered_equal_directionC3_6::_epsilon_6, - Static_Filtered_equal_directionC3_6::_epsilon_7, - Static_Filtered_equal_directionC3_6::_epsilon_8); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST equal_directionC3 failures"); - ++failures; -#endif - return equal_directionC3( - dx1.exact(), - dy1.exact(), - dz1.exact(), - dx2.exact(), - dy2.exact(), - dz2.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -2151,339 +472,6 @@ equal_planeC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_equal_planeC3_8 -{ - static double _bound; - static double _epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4,_epsilon_5,_epsilon_6,_epsilon_7,_epsilon_8,_epsilon_9,_epsilon_10,_epsilon_11,_epsilon_12,_epsilon_13,_epsilon_14,_epsilon_15,_epsilon_16,_epsilon_17; - - static bool update_epsilon( - const Static_filter_error &ha, - const Static_filter_error &hb, - const Static_filter_error &hc, - const Static_filter_error &hd, - const Static_filter_error &pa, - const Static_filter_error &pb, - const Static_filter_error &pc, - const Static_filter_error &pd, - double & epsilon_0, - double & epsilon_1, - double & epsilon_2, - double & epsilon_3, - double & epsilon_4, - double & epsilon_5, - double & epsilon_6, - double & epsilon_7, - double & epsilon_8, - double & epsilon_9, - double & epsilon_10, - double & epsilon_11, - double & epsilon_12, - double & epsilon_13, - double & epsilon_14, - double & epsilon_15, - double & epsilon_16, - double & epsilon_17) - { - typedef Static_filter_error FT; - - if (!Static_Filtered_equal_directionC3_6::update_epsilon(ha, hb, hc, pa, pb, pc, - epsilon_0, - epsilon_1, - epsilon_2, - epsilon_3, - epsilon_4, - epsilon_5, - epsilon_6, - epsilon_7, - epsilon_8)) - return false; - - CGAL::Sign s1a = CGAL_NTS Static_Filtered_sign_1::update_epsilon(ha, - epsilon_9); - if (s1a != ZERO) - return s1a == CGAL_NTS Static_Filtered_sign_1::update_epsilon(pa, - epsilon_10) - && Static_Filtered_sign_of_determinant2x2_4::update_epsilon(pa, pd, ha, hd, - epsilon_11) == ZERO; - CGAL::Sign s1b = CGAL_NTS Static_Filtered_sign_1::update_epsilon(hb, - epsilon_12); - if (s1b != ZERO) - return s1b == CGAL_NTS Static_Filtered_sign_1::update_epsilon(pb, - epsilon_13) - && Static_Filtered_sign_of_determinant2x2_4::update_epsilon(pb, pd, hb, hd, - epsilon_14) == ZERO; - return CGAL_NTS Static_Filtered_sign_1::update_epsilon(pc, - epsilon_15) == CGAL_NTS Static_Filtered_sign_1::update_epsilon(hc, - epsilon_16) - && Static_Filtered_sign_of_determinant2x2_4::update_epsilon(pc, pd, hc, hd, - epsilon_17) == ZERO; - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,_epsilon_0,_epsilon_1,_epsilon_2,_epsilon_3,_epsilon_4,_epsilon_5,_epsilon_6,_epsilon_7,_epsilon_8,_epsilon_9,_epsilon_10,_epsilon_11,_epsilon_12,_epsilon_13,_epsilon_14,_epsilon_15,_epsilon_16,_epsilon_17); - // TODO: We should verify that all epsilons have really been updated. - } - - static bool epsilon_variant( - const Restricted_double &ha, - const Restricted_double &hb, - const Restricted_double &hc, - const Restricted_double &hd, - const Restricted_double &pa, - const Restricted_double &pb, - const Restricted_double &pc, - const Restricted_double &pd, - const double & epsilon_0, - const double & epsilon_1, - const double & epsilon_2, - const double & epsilon_3, - const double & epsilon_4, - const double & epsilon_5, - const double & epsilon_6, - const double & epsilon_7, - const double & epsilon_8, - const double & epsilon_9, - const double & epsilon_10, - const double & epsilon_11, - const double & epsilon_12, - const double & epsilon_13, - const double & epsilon_14, - const double & epsilon_15, - const double & epsilon_16, - const double & epsilon_17) - { - typedef Restricted_double FT; - - if (!Static_Filtered_equal_directionC3_6::epsilon_variant(ha, hb, hc, pa, pb, pc, - epsilon_0, - epsilon_1, - epsilon_2, - epsilon_3, - epsilon_4, - epsilon_5, - epsilon_6, - epsilon_7, - epsilon_8)) - return false; - - CGAL::Sign s1a = CGAL_NTS Static_Filtered_sign_1::epsilon_variant(ha, - epsilon_9); - if (s1a != ZERO) - return s1a == CGAL_NTS Static_Filtered_sign_1::epsilon_variant(pa, - epsilon_10) - && Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(pa, pd, ha, hd, - epsilon_11) == ZERO; - CGAL::Sign s1b = CGAL_NTS Static_Filtered_sign_1::epsilon_variant(hb, - epsilon_12); - if (s1b != ZERO) - return s1b == CGAL_NTS Static_Filtered_sign_1::epsilon_variant(pb, - epsilon_13) - && Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(pb, pd, hb, hd, - epsilon_14) == ZERO; - return CGAL_NTS Static_Filtered_sign_1::epsilon_variant(pc, - epsilon_15) == CGAL_NTS Static_Filtered_sign_1::epsilon_variant(hc, - epsilon_16) - && Static_Filtered_sign_of_determinant2x2_4::epsilon_variant(pc, pd, hc, hd, - epsilon_17) == ZERO; - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -bool -equal_planeC3( - const Filtered_exact &ha, - const Filtered_exact &hb, - const Filtered_exact &hc, - const Filtered_exact &hd, - const Filtered_exact &pa, - const Filtered_exact &pb, - const Filtered_exact &pc, - const Filtered_exact &pd) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_equal_planeC3_8::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(ha.to_double()) > SAF_bound || - fabs(hb.to_double()) > SAF_bound || - fabs(hc.to_double()) > SAF_bound || - fabs(hd.to_double()) > SAF_bound || - fabs(pa.to_double()) > SAF_bound || - fabs(pb.to_double()) > SAF_bound || - fabs(pc.to_double()) > SAF_bound || - fabs(pd.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(ha.to_double())); - NEW_bound = max(NEW_bound, fabs(hb.to_double())); - NEW_bound = max(NEW_bound, fabs(hc.to_double())); - NEW_bound = max(NEW_bound, fabs(hd.to_double())); - NEW_bound = max(NEW_bound, fabs(pa.to_double())); - NEW_bound = max(NEW_bound, fabs(pb.to_double())); - NEW_bound = max(NEW_bound, fabs(pc.to_double())); - NEW_bound = max(NEW_bound, fabs(pd.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA equal_planeC3 updates"); - ++updates; -#endif - Static_Filtered_equal_planeC3_8::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA equal_planeC3 calls"); - ++calls; -#endif - return Static_Filtered_equal_planeC3_8::epsilon_variant( - ha.dbl(), - hb.dbl(), - hc.dbl(), - hd.dbl(), - pa.dbl(), - pb.dbl(), - pc.dbl(), - pd.dbl(), - Static_Filtered_equal_planeC3_8::_epsilon_0, - Static_Filtered_equal_planeC3_8::_epsilon_1, - Static_Filtered_equal_planeC3_8::_epsilon_2, - Static_Filtered_equal_planeC3_8::_epsilon_3, - Static_Filtered_equal_planeC3_8::_epsilon_4, - Static_Filtered_equal_planeC3_8::_epsilon_5, - Static_Filtered_equal_planeC3_8::_epsilon_6, - Static_Filtered_equal_planeC3_8::_epsilon_7, - Static_Filtered_equal_planeC3_8::_epsilon_8, - Static_Filtered_equal_planeC3_8::_epsilon_9, - Static_Filtered_equal_planeC3_8::_epsilon_10, - Static_Filtered_equal_planeC3_8::_epsilon_11, - Static_Filtered_equal_planeC3_8::_epsilon_12, - Static_Filtered_equal_planeC3_8::_epsilon_13, - Static_Filtered_equal_planeC3_8::_epsilon_14, - Static_Filtered_equal_planeC3_8::_epsilon_15, - Static_Filtered_equal_planeC3_8::_epsilon_16, - Static_Filtered_equal_planeC3_8::_epsilon_17); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA equal_planeC3 failures"); - ++failures; -#endif - return equal_planeC3( - ha.exact(), - hb.exact(), - hc.exact(), - hd.exact(), - pa.exact(), - pb.exact(), - pc.exact(), - pd.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -bool -equal_planeC3( - const Filtered_exact &ha, - const Filtered_exact &hb, - const Filtered_exact &hc, - const Filtered_exact &hd, - const Filtered_exact &pa, - const Filtered_exact &pb, - const Filtered_exact &pc, - const Filtered_exact &pd) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_equal_planeC3_8::_bound; ) - CGAL_assertion(!( - fabs(ha.to_double()) > SAF_bound || - fabs(hb.to_double()) > SAF_bound || - fabs(hc.to_double()) > SAF_bound || - fabs(hd.to_double()) > SAF_bound || - fabs(pa.to_double()) > SAF_bound || - fabs(pb.to_double()) > SAF_bound || - fabs(pc.to_double()) > SAF_bound || - fabs(pd.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST equal_planeC3 calls"); - ++calls; -#endif - return Static_Filtered_equal_planeC3_8::epsilon_variant( - ha.dbl(), - hb.dbl(), - hc.dbl(), - hd.dbl(), - pa.dbl(), - pb.dbl(), - pc.dbl(), - pd.dbl(), - Static_Filtered_equal_planeC3_8::_epsilon_0, - Static_Filtered_equal_planeC3_8::_epsilon_1, - Static_Filtered_equal_planeC3_8::_epsilon_2, - Static_Filtered_equal_planeC3_8::_epsilon_3, - Static_Filtered_equal_planeC3_8::_epsilon_4, - Static_Filtered_equal_planeC3_8::_epsilon_5, - Static_Filtered_equal_planeC3_8::_epsilon_6, - Static_Filtered_equal_planeC3_8::_epsilon_7, - Static_Filtered_equal_planeC3_8::_epsilon_8, - Static_Filtered_equal_planeC3_8::_epsilon_9, - Static_Filtered_equal_planeC3_8::_epsilon_10, - Static_Filtered_equal_planeC3_8::_epsilon_11, - Static_Filtered_equal_planeC3_8::_epsilon_12, - Static_Filtered_equal_planeC3_8::_epsilon_13, - Static_Filtered_equal_planeC3_8::_epsilon_14, - Static_Filtered_equal_planeC3_8::_epsilon_15, - Static_Filtered_equal_planeC3_8::_epsilon_16, - Static_Filtered_equal_planeC3_8::_epsilon_17); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST equal_planeC3 failures"); - ++failures; -#endif - return equal_planeC3( - ha.exact(), - hb.exact(), - hc.exact(), - hd.exact(), - pa.exact(), - pb.exact(), - pc.exact(), - pd.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -2535,202 +523,6 @@ side_of_oriented_planeC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_side_of_oriented_planeC3_7 -{ - static double _bound; - static double _epsilon_0; - - static Oriented_side update_epsilon( - const Static_filter_error &a, - const Static_filter_error &b, - const Static_filter_error &c, - const Static_filter_error &d, - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return Oriented_side(CGAL_NTS Static_Filtered_sign_1::update_epsilon(a*px + b*py + c*pz +d, - epsilon_0)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Oriented_side epsilon_variant( - const Restricted_double &a, - const Restricted_double &b, - const Restricted_double &c, - const Restricted_double &d, - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return Oriented_side(CGAL_NTS Static_Filtered_sign_1::epsilon_variant(a*px + b*py + c*pz +d, - epsilon_0)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Oriented_side -side_of_oriented_planeC3( - const Filtered_exact &a, - const Filtered_exact &b, - const Filtered_exact &c, - const Filtered_exact &d, - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_side_of_oriented_planeC3_7::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(a.to_double()) > SAF_bound || - fabs(b.to_double()) > SAF_bound || - fabs(c.to_double()) > SAF_bound || - fabs(d.to_double()) > SAF_bound || - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(a.to_double())); - NEW_bound = max(NEW_bound, fabs(b.to_double())); - NEW_bound = max(NEW_bound, fabs(c.to_double())); - NEW_bound = max(NEW_bound, fabs(d.to_double())); - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA side_of_oriented_planeC3 updates"); - ++updates; -#endif - Static_Filtered_side_of_oriented_planeC3_7::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA side_of_oriented_planeC3 calls"); - ++calls; -#endif - return Static_Filtered_side_of_oriented_planeC3_7::epsilon_variant( - a.dbl(), - b.dbl(), - c.dbl(), - d.dbl(), - px.dbl(), - py.dbl(), - pz.dbl(), - Static_Filtered_side_of_oriented_planeC3_7::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA side_of_oriented_planeC3 failures"); - ++failures; -#endif - return side_of_oriented_planeC3( - a.exact(), - b.exact(), - c.exact(), - d.exact(), - px.exact(), - py.exact(), - pz.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Oriented_side -side_of_oriented_planeC3( - const Filtered_exact &a, - const Filtered_exact &b, - const Filtered_exact &c, - const Filtered_exact &d, - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_side_of_oriented_planeC3_7::_bound; ) - CGAL_assertion(!( - fabs(a.to_double()) > SAF_bound || - fabs(b.to_double()) > SAF_bound || - fabs(c.to_double()) > SAF_bound || - fabs(d.to_double()) > SAF_bound || - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST side_of_oriented_planeC3 calls"); - ++calls; -#endif - return Static_Filtered_side_of_oriented_planeC3_7::epsilon_variant( - a.dbl(), - b.dbl(), - c.dbl(), - d.dbl(), - px.dbl(), - py.dbl(), - pz.dbl(), - Static_Filtered_side_of_oriented_planeC3_7::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST side_of_oriented_planeC3 failures"); - ++failures; -#endif - return side_of_oriented_planeC3( - a.exact(), - b.exact(), - c.exact(), - d.exact(), - px.exact(), - py.exact(), - pz.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -2806,328 +598,6 @@ side_of_oriented_sphereC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_side_of_oriented_sphereC3_15 -{ - static double _bound; - static double _epsilon_0; - - static Oriented_side update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - const Static_filter_error &rx, - const Static_filter_error &ry, - const Static_filter_error &rz, - const Static_filter_error &sx, - const Static_filter_error &sy, - const Static_filter_error &sz, - const Static_filter_error &tx, - const Static_filter_error &ty, - const Static_filter_error &tz, - double & epsilon_0) - { - typedef Static_filter_error FT; - - FT ptx = px - tx; - FT pty = py - ty; - FT ptz = pz - tz; - FT pt2 = CGAL_NTS square(ptx) + CGAL_NTS square(pty) + CGAL_NTS square(ptz); - FT qtx = qx - tx; - FT qty = qy - ty; - FT qtz = qz - tz; - FT qt2 = CGAL_NTS square(qtx) + CGAL_NTS square(qty) + CGAL_NTS square(qtz); - FT rtx = rx - tx; - FT rty = ry - ty; - FT rtz = rz - tz; - FT rt2 = CGAL_NTS square(rtx) + CGAL_NTS square(rty) + CGAL_NTS square(rtz); - FT stx = sx - tx; - FT sty = sy - ty; - FT stz = sz - tz; - FT st2 = CGAL_NTS square(stx) + CGAL_NTS square(sty) + CGAL_NTS square(stz); - return Oriented_side(Static_Filtered_sign_of_determinant4x4_16::update_epsilon(ptx,pty,ptz,pt2, - rtx,rty,rtz,rt2, - qtx,qty,qtz,qt2, - stx,sty,stz,st2, - epsilon_0)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Oriented_side epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const Restricted_double &rx, - const Restricted_double &ry, - const Restricted_double &rz, - const Restricted_double &sx, - const Restricted_double &sy, - const Restricted_double &sz, - const Restricted_double &tx, - const Restricted_double &ty, - const Restricted_double &tz, - const double & epsilon_0) - { - typedef Restricted_double FT; - - FT ptx = px - tx; - FT pty = py - ty; - FT ptz = pz - tz; - FT pt2 = CGAL_NTS square(ptx) + CGAL_NTS square(pty) + CGAL_NTS square(ptz); - FT qtx = qx - tx; - FT qty = qy - ty; - FT qtz = qz - tz; - FT qt2 = CGAL_NTS square(qtx) + CGAL_NTS square(qty) + CGAL_NTS square(qtz); - FT rtx = rx - tx; - FT rty = ry - ty; - FT rtz = rz - tz; - FT rt2 = CGAL_NTS square(rtx) + CGAL_NTS square(rty) + CGAL_NTS square(rtz); - FT stx = sx - tx; - FT sty = sy - ty; - FT stz = sz - tz; - FT st2 = CGAL_NTS square(stx) + CGAL_NTS square(sty) + CGAL_NTS square(stz); - return Oriented_side(Static_Filtered_sign_of_determinant4x4_16::epsilon_variant(ptx,pty,ptz,pt2, - rtx,rty,rtz,rt2, - qtx,qty,qtz,qt2, - stx,sty,stz,st2, - epsilon_0)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Oriented_side -side_of_oriented_sphereC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz, - const Filtered_exact &sx, - const Filtered_exact &sy, - const Filtered_exact &sz, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_side_of_oriented_sphereC3_15::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound || - fabs(sx.to_double()) > SAF_bound || - fabs(sy.to_double()) > SAF_bound || - fabs(sz.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - NEW_bound = max(NEW_bound, fabs(rz.to_double())); - NEW_bound = max(NEW_bound, fabs(sx.to_double())); - NEW_bound = max(NEW_bound, fabs(sy.to_double())); - NEW_bound = max(NEW_bound, fabs(sz.to_double())); - NEW_bound = max(NEW_bound, fabs(tx.to_double())); - NEW_bound = max(NEW_bound, fabs(ty.to_double())); - NEW_bound = max(NEW_bound, fabs(tz.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA side_of_oriented_sphereC3 updates"); - ++updates; -#endif - Static_Filtered_side_of_oriented_sphereC3_15::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA side_of_oriented_sphereC3 calls"); - ++calls; -#endif - return Static_Filtered_side_of_oriented_sphereC3_15::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - sx.dbl(), - sy.dbl(), - sz.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - Static_Filtered_side_of_oriented_sphereC3_15::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA side_of_oriented_sphereC3 failures"); - ++failures; -#endif - return side_of_oriented_sphereC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - rx.exact(), - ry.exact(), - rz.exact(), - sx.exact(), - sy.exact(), - sz.exact(), - tx.exact(), - ty.exact(), - tz.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Oriented_side -side_of_oriented_sphereC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz, - const Filtered_exact &sx, - const Filtered_exact &sy, - const Filtered_exact &sz, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_side_of_oriented_sphereC3_15::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound || - fabs(sx.to_double()) > SAF_bound || - fabs(sy.to_double()) > SAF_bound || - fabs(sz.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST side_of_oriented_sphereC3 calls"); - ++calls; -#endif - return Static_Filtered_side_of_oriented_sphereC3_15::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - sx.dbl(), - sy.dbl(), - sz.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - Static_Filtered_side_of_oriented_sphereC3_15::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST side_of_oriented_sphereC3 failures"); - ++failures; -#endif - return side_of_oriented_sphereC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - rx.exact(), - ry.exact(), - rz.exact(), - sx.exact(), - sy.exact(), - sz.exact(), - tx.exact(), - ty.exact(), - tz.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -3203,314 +673,6 @@ side_of_bounded_sphereC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_side_of_bounded_sphereC3_15 -{ - static double _bound; - static double _epsilon_0,_epsilon_1; - - static Bounded_side update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - const Static_filter_error &rx, - const Static_filter_error &ry, - const Static_filter_error &rz, - const Static_filter_error &sx, - const Static_filter_error &sy, - const Static_filter_error &sz, - const Static_filter_error &tx, - const Static_filter_error &ty, - const Static_filter_error &tz, - double & epsilon_0, - double & epsilon_1) - { - typedef Static_filter_error FT; - - Oriented_side s = Static_Filtered_side_of_oriented_sphereC3_15::update_epsilon(px, py, pz, - qx, qy, qz, - rx, ry, rz, - sx, sy, sz, - tx, ty, tz, - epsilon_0); - Orientation o = Static_Filtered_orientationC3_12::update_epsilon(px, py, pz, - qx, qy, qz, - rx, ry, rz, - sx, sy, sz, - epsilon_1); - return Bounded_side(s * o); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0,_epsilon_1); - // TODO: We should verify that all epsilons have really been updated. - } - - static Bounded_side epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const Restricted_double &rx, - const Restricted_double &ry, - const Restricted_double &rz, - const Restricted_double &sx, - const Restricted_double &sy, - const Restricted_double &sz, - const Restricted_double &tx, - const Restricted_double &ty, - const Restricted_double &tz, - const double & epsilon_0, - const double & epsilon_1) - { - typedef Restricted_double FT; - - Oriented_side s = Static_Filtered_side_of_oriented_sphereC3_15::epsilon_variant(px, py, pz, - qx, qy, qz, - rx, ry, rz, - sx, sy, sz, - tx, ty, tz, - epsilon_0); - Orientation o = Static_Filtered_orientationC3_12::epsilon_variant(px, py, pz, - qx, qy, qz, - rx, ry, rz, - sx, sy, sz, - epsilon_1); - return Bounded_side(s * o); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Bounded_side -side_of_bounded_sphereC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz, - const Filtered_exact &sx, - const Filtered_exact &sy, - const Filtered_exact &sz, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_side_of_bounded_sphereC3_15::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound || - fabs(sx.to_double()) > SAF_bound || - fabs(sy.to_double()) > SAF_bound || - fabs(sz.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - NEW_bound = max(NEW_bound, fabs(rz.to_double())); - NEW_bound = max(NEW_bound, fabs(sx.to_double())); - NEW_bound = max(NEW_bound, fabs(sy.to_double())); - NEW_bound = max(NEW_bound, fabs(sz.to_double())); - NEW_bound = max(NEW_bound, fabs(tx.to_double())); - NEW_bound = max(NEW_bound, fabs(ty.to_double())); - NEW_bound = max(NEW_bound, fabs(tz.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA side_of_bounded_sphereC3 updates"); - ++updates; -#endif - Static_Filtered_side_of_bounded_sphereC3_15::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA side_of_bounded_sphereC3 calls"); - ++calls; -#endif - return Static_Filtered_side_of_bounded_sphereC3_15::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - sx.dbl(), - sy.dbl(), - sz.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - Static_Filtered_side_of_bounded_sphereC3_15::_epsilon_0, - Static_Filtered_side_of_bounded_sphereC3_15::_epsilon_1); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA side_of_bounded_sphereC3 failures"); - ++failures; -#endif - return side_of_bounded_sphereC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - rx.exact(), - ry.exact(), - rz.exact(), - sx.exact(), - sy.exact(), - sz.exact(), - tx.exact(), - ty.exact(), - tz.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Bounded_side -side_of_bounded_sphereC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz, - const Filtered_exact &sx, - const Filtered_exact &sy, - const Filtered_exact &sz, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_side_of_bounded_sphereC3_15::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound || - fabs(sx.to_double()) > SAF_bound || - fabs(sy.to_double()) > SAF_bound || - fabs(sz.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST side_of_bounded_sphereC3 calls"); - ++calls; -#endif - return Static_Filtered_side_of_bounded_sphereC3_15::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - sx.dbl(), - sy.dbl(), - sz.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - Static_Filtered_side_of_bounded_sphereC3_15::_epsilon_0, - Static_Filtered_side_of_bounded_sphereC3_15::_epsilon_1); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST side_of_bounded_sphereC3 failures"); - ++failures; -#endif - return side_of_bounded_sphereC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - rx.exact(), - ry.exact(), - rz.exact(), - sx.exact(), - sy.exact(), - sz.exact(), - tx.exact(), - ty.exact(), - tz.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -3568,230 +730,6 @@ side_of_bounded_sphereC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_side_of_bounded_sphereC3_9 -{ - static double _bound; - static double _epsilon_0; - - static Bounded_side update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - const Static_filter_error &tx, - const Static_filter_error &ty, - const Static_filter_error &tz, - double & epsilon_0) - { - typedef Static_filter_error FT; - - - return Bounded_side( CGAL_NTS Static_Filtered_sign_1::update_epsilon((tx-px)*(qx-tx) - + (ty-py)*(qy-ty) - + (tz-pz)*(qz-tz), - epsilon_0) ); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Bounded_side epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const Restricted_double &tx, - const Restricted_double &ty, - const Restricted_double &tz, - const double & epsilon_0) - { - typedef Restricted_double FT; - - - return Bounded_side( CGAL_NTS Static_Filtered_sign_1::epsilon_variant((tx-px)*(qx-tx) - + (ty-py)*(qy-ty) - + (tz-pz)*(qz-tz), - epsilon_0) ); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Bounded_side -side_of_bounded_sphereC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_side_of_bounded_sphereC3_9::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - NEW_bound = max(NEW_bound, fabs(tx.to_double())); - NEW_bound = max(NEW_bound, fabs(ty.to_double())); - NEW_bound = max(NEW_bound, fabs(tz.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA side_of_bounded_sphereC3 updates"); - ++updates; -#endif - Static_Filtered_side_of_bounded_sphereC3_9::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA side_of_bounded_sphereC3 calls"); - ++calls; -#endif - return Static_Filtered_side_of_bounded_sphereC3_9::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - Static_Filtered_side_of_bounded_sphereC3_9::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA side_of_bounded_sphereC3 failures"); - ++failures; -#endif - return side_of_bounded_sphereC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - tx.exact(), - ty.exact(), - tz.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Bounded_side -side_of_bounded_sphereC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_side_of_bounded_sphereC3_9::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST side_of_bounded_sphereC3 calls"); - ++calls; -#endif - return Static_Filtered_side_of_bounded_sphereC3_9::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - Static_Filtered_side_of_bounded_sphereC3_9::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST side_of_bounded_sphereC3 failures"); - ++failures; -#endif - return side_of_bounded_sphereC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - tx.exact(), - ty.exact(), - tz.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -3849,226 +787,6 @@ cmp_dist_to_pointC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_cmp_dist_to_pointC3_9 -{ - static double _bound; - static double _epsilon_0; - - static Comparison_result update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - const Static_filter_error &rx, - const Static_filter_error &ry, - const Static_filter_error &rz, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return CGAL_NTS Static_Filtered_compare_2::update_epsilon(squared_distanceC3(px,py,pz,qx,qy,qz), - squared_distanceC3(px,py,pz,rx,ry,rz), - epsilon_0); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const Restricted_double &rx, - const Restricted_double &ry, - const Restricted_double &rz, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return CGAL_NTS Static_Filtered_compare_2::epsilon_variant(squared_distanceC3(px,py,pz,qx,qy,qz), - squared_distanceC3(px,py,pz,rx,ry,rz), - epsilon_0); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_INLINE */ -Comparison_result -cmp_dist_to_pointC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_cmp_dist_to_pointC3_9::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - NEW_bound = max(NEW_bound, fabs(rx.to_double())); - NEW_bound = max(NEW_bound, fabs(ry.to_double())); - NEW_bound = max(NEW_bound, fabs(rz.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA cmp_dist_to_pointC3 updates"); - ++updates; -#endif - Static_Filtered_cmp_dist_to_pointC3_9::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA cmp_dist_to_pointC3 calls"); - ++calls; -#endif - return Static_Filtered_cmp_dist_to_pointC3_9::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - Static_Filtered_cmp_dist_to_pointC3_9::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA cmp_dist_to_pointC3 failures"); - ++failures; -#endif - return cmp_dist_to_pointC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - rx.exact(), - ry.exact(), - rz.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_INLINE */ -Comparison_result -cmp_dist_to_pointC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &rx, - const Filtered_exact &ry, - const Filtered_exact &rz) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_cmp_dist_to_pointC3_9::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(rx.to_double()) > SAF_bound || - fabs(ry.to_double()) > SAF_bound || - fabs(rz.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST cmp_dist_to_pointC3 calls"); - ++calls; -#endif - return Static_Filtered_cmp_dist_to_pointC3_9::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - rx.dbl(), - ry.dbl(), - rz.dbl(), - Static_Filtered_cmp_dist_to_pointC3_9::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST cmp_dist_to_pointC3 failures"); - ++failures; -#endif - return cmp_dist_to_pointC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - rx.exact(), - ry.exact(), - rz.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -4135,329 +853,6 @@ side_of_bounded_sphereC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_side_of_bounded_sphereC3_12 -{ - static double _bound; - static double _epsilon_0; - - static Bounded_side update_epsilon( - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - const Static_filter_error &sx, - const Static_filter_error &sy, - const Static_filter_error &sz, - const Static_filter_error &tx, - const Static_filter_error &ty, - const Static_filter_error &tz, - double & epsilon_0) - { - typedef Static_filter_error FT; - - - - - - - FT psx = px-sx; - FT psy = py-sy; - FT psz = pz-sz; - FT ps2 = CGAL_NTS square(psx) + CGAL_NTS square(psy) + CGAL_NTS square(psz); - FT qsx = qx-sx; - FT qsy = qy-sy; - FT qsz = qz-sz; - FT qs2 = CGAL_NTS square(qsx) + CGAL_NTS square(qsy) + CGAL_NTS square(qsz); - FT rsx = psy*qsz-psz*qsy; - FT rsy = psz*qsx-psx*qsz; - FT rsz = psx*qsy-psy*qsx; - FT tsx = tx-sx; - FT tsy = ty-sy; - FT tsz = tz-sz; - - FT num_x = ps2 * det2x2_by_formula(qsy,qsz,rsy,rsz) - - qs2 * det2x2_by_formula(psy,psz,rsy,rsz); - FT num_y = ps2 * det2x2_by_formula(qsx,qsz,rsx,rsz) - - qs2 * det2x2_by_formula(psx,psz,rsx,rsz); - FT num_z = ps2 * det2x2_by_formula(qsx,qsy,rsx,rsy) - - qs2 * det2x2_by_formula(psx,psy,rsx,rsy); - - FT den = det3x3_by_formula(psx,psy,psz, - qsx,qsy,qsz, - rsx,rsy,rsz); - - FT den2 = FT(2) * den; - - - return Bounded_side(Static_Filtered_cmp_dist_to_pointC3_9::update_epsilon(num_x, - num_y, num_z, - psx*den2, psy*den2, psz*den2, - tsx*den2, tsy*den2, tsz*den2, - epsilon_0) ); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Bounded_side epsilon_variant( - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const Restricted_double &sx, - const Restricted_double &sy, - const Restricted_double &sz, - const Restricted_double &tx, - const Restricted_double &ty, - const Restricted_double &tz, - const double & epsilon_0) - { - typedef Restricted_double FT; - - - - - - - FT psx = px-sx; - FT psy = py-sy; - FT psz = pz-sz; - FT ps2 = CGAL_NTS square(psx) + CGAL_NTS square(psy) + CGAL_NTS square(psz); - FT qsx = qx-sx; - FT qsy = qy-sy; - FT qsz = qz-sz; - FT qs2 = CGAL_NTS square(qsx) + CGAL_NTS square(qsy) + CGAL_NTS square(qsz); - FT rsx = psy*qsz-psz*qsy; - FT rsy = psz*qsx-psx*qsz; - FT rsz = psx*qsy-psy*qsx; - FT tsx = tx-sx; - FT tsy = ty-sy; - FT tsz = tz-sz; - - FT num_x = ps2 * det2x2_by_formula(qsy,qsz,rsy,rsz) - - qs2 * det2x2_by_formula(psy,psz,rsy,rsz); - FT num_y = ps2 * det2x2_by_formula(qsx,qsz,rsx,rsz) - - qs2 * det2x2_by_formula(psx,psz,rsx,rsz); - FT num_z = ps2 * det2x2_by_formula(qsx,qsy,rsx,rsy) - - qs2 * det2x2_by_formula(psx,psy,rsx,rsy); - - FT den = det3x3_by_formula(psx,psy,psz, - qsx,qsy,qsz, - rsx,rsy,rsz); - - FT den2 = FT(2) * den; - - - return Bounded_side(Static_Filtered_cmp_dist_to_pointC3_9::epsilon_variant(num_x, - num_y, num_z, - psx*den2, psy*den2, psz*den2, - tsx*den2, tsy*den2, tsz*den2, - epsilon_0) ); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Bounded_side -side_of_bounded_sphereC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &sx, - const Filtered_exact &sy, - const Filtered_exact &sz, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_side_of_bounded_sphereC3_12::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(sx.to_double()) > SAF_bound || - fabs(sy.to_double()) > SAF_bound || - fabs(sz.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - NEW_bound = max(NEW_bound, fabs(sx.to_double())); - NEW_bound = max(NEW_bound, fabs(sy.to_double())); - NEW_bound = max(NEW_bound, fabs(sz.to_double())); - NEW_bound = max(NEW_bound, fabs(tx.to_double())); - NEW_bound = max(NEW_bound, fabs(ty.to_double())); - NEW_bound = max(NEW_bound, fabs(tz.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA side_of_bounded_sphereC3 updates"); - ++updates; -#endif - Static_Filtered_side_of_bounded_sphereC3_12::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA side_of_bounded_sphereC3 calls"); - ++calls; -#endif - return Static_Filtered_side_of_bounded_sphereC3_12::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - sx.dbl(), - sy.dbl(), - sz.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - Static_Filtered_side_of_bounded_sphereC3_12::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA side_of_bounded_sphereC3 failures"); - ++failures; -#endif - return side_of_bounded_sphereC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - sx.exact(), - sy.exact(), - sz.exact(), - tx.exact(), - ty.exact(), - tz.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Bounded_side -side_of_bounded_sphereC3( - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz, - const Filtered_exact &sx, - const Filtered_exact &sy, - const Filtered_exact &sz, - const Filtered_exact &tx, - const Filtered_exact &ty, - const Filtered_exact &tz) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_side_of_bounded_sphereC3_12::_bound; ) - CGAL_assertion(!( - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound || - fabs(sx.to_double()) > SAF_bound || - fabs(sy.to_double()) > SAF_bound || - fabs(sz.to_double()) > SAF_bound || - fabs(tx.to_double()) > SAF_bound || - fabs(ty.to_double()) > SAF_bound || - fabs(tz.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST side_of_bounded_sphereC3 calls"); - ++calls; -#endif - return Static_Filtered_side_of_bounded_sphereC3_12::epsilon_variant( - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - sx.dbl(), - sy.dbl(), - sz.dbl(), - tx.dbl(), - ty.dbl(), - tz.dbl(), - Static_Filtered_side_of_bounded_sphereC3_12::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST side_of_bounded_sphereC3 failures"); - ++failures; -#endif - return side_of_bounded_sphereC3( - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact(), - sx.exact(), - sy.exact(), - sz.exact(), - tx.exact(), - ty.exact(), - tz.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -4515,226 +910,6 @@ cmp_signed_dist_to_directionC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_cmp_signed_dist_to_directionC3_9 -{ - static double _bound; - static double _epsilon_0; - - static Comparison_result update_epsilon( - const Static_filter_error &pa, - const Static_filter_error &pb, - const Static_filter_error &pc, - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return CGAL_NTS Static_Filtered_compare_2::update_epsilon(scaled_distance_to_directionC3(pa,pb,pc,px,py,pz), - scaled_distance_to_directionC3(pa,pb,pc,qx,qy,qz), - epsilon_0); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &pa, - const Restricted_double &pb, - const Restricted_double &pc, - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return CGAL_NTS Static_Filtered_compare_2::epsilon_variant(scaled_distance_to_directionC3(pa,pb,pc,px,py,pz), - scaled_distance_to_directionC3(pa,pb,pc,qx,qy,qz), - epsilon_0); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -cmp_signed_dist_to_directionC3( - const Filtered_exact &pa, - const Filtered_exact &pb, - const Filtered_exact &pc, - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_cmp_signed_dist_to_directionC3_9::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(pa.to_double()) > SAF_bound || - fabs(pb.to_double()) > SAF_bound || - fabs(pc.to_double()) > SAF_bound || - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(pa.to_double())); - NEW_bound = max(NEW_bound, fabs(pb.to_double())); - NEW_bound = max(NEW_bound, fabs(pc.to_double())); - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA cmp_signed_dist_to_directionC3 updates"); - ++updates; -#endif - Static_Filtered_cmp_signed_dist_to_directionC3_9::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA cmp_signed_dist_to_directionC3 calls"); - ++calls; -#endif - return Static_Filtered_cmp_signed_dist_to_directionC3_9::epsilon_variant( - pa.dbl(), - pb.dbl(), - pc.dbl(), - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - Static_Filtered_cmp_signed_dist_to_directionC3_9::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA cmp_signed_dist_to_directionC3 failures"); - ++failures; -#endif - return cmp_signed_dist_to_directionC3( - pa.exact(), - pb.exact(), - pc.exact(), - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -cmp_signed_dist_to_directionC3( - const Filtered_exact &pa, - const Filtered_exact &pb, - const Filtered_exact &pc, - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_cmp_signed_dist_to_directionC3_9::_bound; ) - CGAL_assertion(!( - fabs(pa.to_double()) > SAF_bound || - fabs(pb.to_double()) > SAF_bound || - fabs(pc.to_double()) > SAF_bound || - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST cmp_signed_dist_to_directionC3 calls"); - ++calls; -#endif - return Static_Filtered_cmp_signed_dist_to_directionC3_9::epsilon_variant( - pa.dbl(), - pb.dbl(), - pc.dbl(), - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - Static_Filtered_cmp_signed_dist_to_directionC3_9::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST cmp_signed_dist_to_directionC3 failures"); - ++failures; -#endif - return cmp_signed_dist_to_directionC3( - pa.exact(), - pb.exact(), - pc.exact(), - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -4810,296 +985,6 @@ cmp_signed_dist_to_planeC3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_cmp_signed_dist_to_planeC3_15 -{ - static double _bound; - static double _epsilon_0; - - static Comparison_result update_epsilon( - const Static_filter_error &ppx, - const Static_filter_error &ppy, - const Static_filter_error &ppz, - const Static_filter_error &pqx, - const Static_filter_error &pqy, - const Static_filter_error &pqz, - const Static_filter_error &prx, - const Static_filter_error &pry, - const Static_filter_error &prz, - const Static_filter_error &px, - const Static_filter_error &py, - const Static_filter_error &pz, - const Static_filter_error &qx, - const Static_filter_error &qy, - const Static_filter_error &qz, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return Comparison_result(Static_Filtered_sign_of_determinant3x3_9::update_epsilon( - pqx-ppx, pqy-ppy, pqz-ppz, - prx-ppx, pry-ppy, prz-ppz, - qx-px, qy-py, qz-pz, - epsilon_0)); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Comparison_result epsilon_variant( - const Restricted_double &ppx, - const Restricted_double &ppy, - const Restricted_double &ppz, - const Restricted_double &pqx, - const Restricted_double &pqy, - const Restricted_double &pqz, - const Restricted_double &prx, - const Restricted_double &pry, - const Restricted_double &prz, - const Restricted_double &px, - const Restricted_double &py, - const Restricted_double &pz, - const Restricted_double &qx, - const Restricted_double &qy, - const Restricted_double &qz, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return Comparison_result(Static_Filtered_sign_of_determinant3x3_9::epsilon_variant( - pqx-ppx, pqy-ppy, pqz-ppz, - prx-ppx, pry-ppy, prz-ppz, - qx-px, qy-py, qz-pz, - epsilon_0)); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -cmp_signed_dist_to_planeC3( - const Filtered_exact &ppx, - const Filtered_exact &ppy, - const Filtered_exact &ppz, - const Filtered_exact &pqx, - const Filtered_exact &pqy, - const Filtered_exact &pqz, - const Filtered_exact &prx, - const Filtered_exact &pry, - const Filtered_exact &prz, - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_cmp_signed_dist_to_planeC3_15::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(ppx.to_double()) > SAF_bound || - fabs(ppy.to_double()) > SAF_bound || - fabs(ppz.to_double()) > SAF_bound || - fabs(pqx.to_double()) > SAF_bound || - fabs(pqy.to_double()) > SAF_bound || - fabs(pqz.to_double()) > SAF_bound || - fabs(prx.to_double()) > SAF_bound || - fabs(pry.to_double()) > SAF_bound || - fabs(prz.to_double()) > SAF_bound || - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(ppx.to_double())); - NEW_bound = max(NEW_bound, fabs(ppy.to_double())); - NEW_bound = max(NEW_bound, fabs(ppz.to_double())); - NEW_bound = max(NEW_bound, fabs(pqx.to_double())); - NEW_bound = max(NEW_bound, fabs(pqy.to_double())); - NEW_bound = max(NEW_bound, fabs(pqz.to_double())); - NEW_bound = max(NEW_bound, fabs(prx.to_double())); - NEW_bound = max(NEW_bound, fabs(pry.to_double())); - NEW_bound = max(NEW_bound, fabs(prz.to_double())); - NEW_bound = max(NEW_bound, fabs(px.to_double())); - NEW_bound = max(NEW_bound, fabs(py.to_double())); - NEW_bound = max(NEW_bound, fabs(pz.to_double())); - NEW_bound = max(NEW_bound, fabs(qx.to_double())); - NEW_bound = max(NEW_bound, fabs(qy.to_double())); - NEW_bound = max(NEW_bound, fabs(qz.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA cmp_signed_dist_to_planeC3 updates"); - ++updates; -#endif - Static_Filtered_cmp_signed_dist_to_planeC3_15::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA cmp_signed_dist_to_planeC3 calls"); - ++calls; -#endif - return Static_Filtered_cmp_signed_dist_to_planeC3_15::epsilon_variant( - ppx.dbl(), - ppy.dbl(), - ppz.dbl(), - pqx.dbl(), - pqy.dbl(), - pqz.dbl(), - prx.dbl(), - pry.dbl(), - prz.dbl(), - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - Static_Filtered_cmp_signed_dist_to_planeC3_15::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA cmp_signed_dist_to_planeC3 failures"); - ++failures; -#endif - return cmp_signed_dist_to_planeC3( - ppx.exact(), - ppy.exact(), - ppz.exact(), - pqx.exact(), - pqy.exact(), - pqz.exact(), - prx.exact(), - pry.exact(), - prz.exact(), - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_MEDIUM_INLINE */ -Comparison_result -cmp_signed_dist_to_planeC3( - const Filtered_exact &ppx, - const Filtered_exact &ppy, - const Filtered_exact &ppz, - const Filtered_exact &pqx, - const Filtered_exact &pqy, - const Filtered_exact &pqz, - const Filtered_exact &prx, - const Filtered_exact &pry, - const Filtered_exact &prz, - const Filtered_exact &px, - const Filtered_exact &py, - const Filtered_exact &pz, - const Filtered_exact &qx, - const Filtered_exact &qy, - const Filtered_exact &qz) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_cmp_signed_dist_to_planeC3_15::_bound; ) - CGAL_assertion(!( - fabs(ppx.to_double()) > SAF_bound || - fabs(ppy.to_double()) > SAF_bound || - fabs(ppz.to_double()) > SAF_bound || - fabs(pqx.to_double()) > SAF_bound || - fabs(pqy.to_double()) > SAF_bound || - fabs(pqz.to_double()) > SAF_bound || - fabs(prx.to_double()) > SAF_bound || - fabs(pry.to_double()) > SAF_bound || - fabs(prz.to_double()) > SAF_bound || - fabs(px.to_double()) > SAF_bound || - fabs(py.to_double()) > SAF_bound || - fabs(pz.to_double()) > SAF_bound || - fabs(qx.to_double()) > SAF_bound || - fabs(qy.to_double()) > SAF_bound || - fabs(qz.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST cmp_signed_dist_to_planeC3 calls"); - ++calls; -#endif - return Static_Filtered_cmp_signed_dist_to_planeC3_15::epsilon_variant( - ppx.dbl(), - ppy.dbl(), - ppz.dbl(), - pqx.dbl(), - pqy.dbl(), - pqz.dbl(), - prx.dbl(), - pry.dbl(), - prz.dbl(), - px.dbl(), - py.dbl(), - pz.dbl(), - qx.dbl(), - qy.dbl(), - qz.dbl(), - Static_Filtered_cmp_signed_dist_to_planeC3_15::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST cmp_signed_dist_to_planeC3 failures"); - ++failures; -#endif - return cmp_signed_dist_to_planeC3( - ppx.exact(), - ppy.exact(), - ppz.exact(), - pqx.exact(), - pqy.exact(), - pqz.exact(), - prx.exact(), - pry.exact(), - prz.exact(), - px.exact(), - py.exact(), - pz.exact(), - qx.exact(), - qy.exact(), - qz.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - CGAL_END_NAMESPACE #endif // CGAL_ARITHMETIC_FILTER_PREDICATES_KERNEL_FTC3_H diff --git a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/sign_of_determinant.h b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/sign_of_determinant.h index 5bc3367f124..f7a4c880cea 100644 --- a/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/sign_of_determinant.h +++ b/Packages/Interval_arithmetic/include/CGAL/Arithmetic_filter/predicates/sign_of_determinant.h @@ -70,171 +70,6 @@ sign_of_determinant2x2( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_sign_of_determinant2x2_4 -{ - static double _bound; - static double _epsilon_0; - - static Sign update_epsilon( - const Static_filter_error &a00, - const Static_filter_error &a01, - const Static_filter_error &a10, - const Static_filter_error &a11, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return - static_cast(static_cast(CGAL_NTS Static_Filtered_compare_2::update_epsilon( a00*a11, a10*a01, - epsilon_0))); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Sign epsilon_variant( - const Restricted_double &a00, - const Restricted_double &a01, - const Restricted_double &a10, - const Restricted_double &a11, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return - static_cast(static_cast(CGAL_NTS Static_Filtered_compare_2::epsilon_variant( a00*a11, a10*a01, - epsilon_0))); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Sign -sign_of_determinant2x2( - const Filtered_exact &a00, - const Filtered_exact &a01, - const Filtered_exact &a10, - const Filtered_exact &a11) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_sign_of_determinant2x2_4::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(a00.to_double()) > SAF_bound || - fabs(a01.to_double()) > SAF_bound || - fabs(a10.to_double()) > SAF_bound || - fabs(a11.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(a00.to_double())); - NEW_bound = max(NEW_bound, fabs(a01.to_double())); - NEW_bound = max(NEW_bound, fabs(a10.to_double())); - NEW_bound = max(NEW_bound, fabs(a11.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA sign_of_determinant2x2 updates"); - ++updates; -#endif - Static_Filtered_sign_of_determinant2x2_4::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA sign_of_determinant2x2 calls"); - ++calls; -#endif - return Static_Filtered_sign_of_determinant2x2_4::epsilon_variant( - a00.dbl(), - a01.dbl(), - a10.dbl(), - a11.dbl(), - Static_Filtered_sign_of_determinant2x2_4::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA sign_of_determinant2x2 failures"); - ++failures; -#endif - return sign_of_determinant2x2( - a00.exact(), - a01.exact(), - a10.exact(), - a11.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Sign -sign_of_determinant2x2( - const Filtered_exact &a00, - const Filtered_exact &a01, - const Filtered_exact &a10, - const Filtered_exact &a11) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_sign_of_determinant2x2_4::_bound; ) - CGAL_assertion(!( - fabs(a00.to_double()) > SAF_bound || - fabs(a01.to_double()) > SAF_bound || - fabs(a10.to_double()) > SAF_bound || - fabs(a11.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST sign_of_determinant2x2 calls"); - ++calls; -#endif - return Static_Filtered_sign_of_determinant2x2_4::epsilon_variant( - a00.dbl(), - a01.dbl(), - a10.dbl(), - a11.dbl(), - Static_Filtered_sign_of_determinant2x2_4::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST sign_of_determinant2x2 failures"); - ++failures; -#endif - return sign_of_determinant2x2( - a00.exact(), - a01.exact(), - a10.exact(), - a11.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -292,228 +127,6 @@ sign_of_determinant3x3( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_sign_of_determinant3x3_9 -{ - static double _bound; - static double _epsilon_0; - - static Sign update_epsilon( - const Static_filter_error &a00, - const Static_filter_error &a01, - const Static_filter_error &a02, - const Static_filter_error &a10, - const Static_filter_error &a11, - const Static_filter_error &a12, - const Static_filter_error &a20, - const Static_filter_error &a21, - const Static_filter_error &a22, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return CGAL_NTS Static_Filtered_sign_1::update_epsilon(det3x3_by_formula(a00, a01, a02, - a10, a11, a12, - a20, a21, a22), - epsilon_0); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Sign epsilon_variant( - const Restricted_double &a00, - const Restricted_double &a01, - const Restricted_double &a02, - const Restricted_double &a10, - const Restricted_double &a11, - const Restricted_double &a12, - const Restricted_double &a20, - const Restricted_double &a21, - const Restricted_double &a22, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return CGAL_NTS Static_Filtered_sign_1::epsilon_variant(det3x3_by_formula(a00, a01, a02, - a10, a11, a12, - a20, a21, a22), - epsilon_0); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Sign -sign_of_determinant3x3( - const Filtered_exact &a00, - const Filtered_exact &a01, - const Filtered_exact &a02, - const Filtered_exact &a10, - const Filtered_exact &a11, - const Filtered_exact &a12, - const Filtered_exact &a20, - const Filtered_exact &a21, - const Filtered_exact &a22) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_sign_of_determinant3x3_9::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(a00.to_double()) > SAF_bound || - fabs(a01.to_double()) > SAF_bound || - fabs(a02.to_double()) > SAF_bound || - fabs(a10.to_double()) > SAF_bound || - fabs(a11.to_double()) > SAF_bound || - fabs(a12.to_double()) > SAF_bound || - fabs(a20.to_double()) > SAF_bound || - fabs(a21.to_double()) > SAF_bound || - fabs(a22.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(a00.to_double())); - NEW_bound = max(NEW_bound, fabs(a01.to_double())); - NEW_bound = max(NEW_bound, fabs(a02.to_double())); - NEW_bound = max(NEW_bound, fabs(a10.to_double())); - NEW_bound = max(NEW_bound, fabs(a11.to_double())); - NEW_bound = max(NEW_bound, fabs(a12.to_double())); - NEW_bound = max(NEW_bound, fabs(a20.to_double())); - NEW_bound = max(NEW_bound, fabs(a21.to_double())); - NEW_bound = max(NEW_bound, fabs(a22.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA sign_of_determinant3x3 updates"); - ++updates; -#endif - Static_Filtered_sign_of_determinant3x3_9::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA sign_of_determinant3x3 calls"); - ++calls; -#endif - return Static_Filtered_sign_of_determinant3x3_9::epsilon_variant( - a00.dbl(), - a01.dbl(), - a02.dbl(), - a10.dbl(), - a11.dbl(), - a12.dbl(), - a20.dbl(), - a21.dbl(), - a22.dbl(), - Static_Filtered_sign_of_determinant3x3_9::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA sign_of_determinant3x3 failures"); - ++failures; -#endif - return sign_of_determinant3x3( - a00.exact(), - a01.exact(), - a02.exact(), - a10.exact(), - a11.exact(), - a12.exact(), - a20.exact(), - a21.exact(), - a22.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Sign -sign_of_determinant3x3( - const Filtered_exact &a00, - const Filtered_exact &a01, - const Filtered_exact &a02, - const Filtered_exact &a10, - const Filtered_exact &a11, - const Filtered_exact &a12, - const Filtered_exact &a20, - const Filtered_exact &a21, - const Filtered_exact &a22) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_sign_of_determinant3x3_9::_bound; ) - CGAL_assertion(!( - fabs(a00.to_double()) > SAF_bound || - fabs(a01.to_double()) > SAF_bound || - fabs(a02.to_double()) > SAF_bound || - fabs(a10.to_double()) > SAF_bound || - fabs(a11.to_double()) > SAF_bound || - fabs(a12.to_double()) > SAF_bound || - fabs(a20.to_double()) > SAF_bound || - fabs(a21.to_double()) > SAF_bound || - fabs(a22.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST sign_of_determinant3x3 calls"); - ++calls; -#endif - return Static_Filtered_sign_of_determinant3x3_9::epsilon_variant( - a00.dbl(), - a01.dbl(), - a02.dbl(), - a10.dbl(), - a11.dbl(), - a12.dbl(), - a20.dbl(), - a21.dbl(), - a22.dbl(), - Static_Filtered_sign_of_determinant3x3_9::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST sign_of_determinant3x3 failures"); - ++failures; -#endif - return sign_of_determinant3x3( - a00.exact(), - a01.exact(), - a02.exact(), - a10.exact(), - a11.exact(), - a12.exact(), - a20.exact(), - a21.exact(), - a22.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -592,307 +205,6 @@ sign_of_determinant4x4( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_sign_of_determinant4x4_16 -{ - static double _bound; - static double _epsilon_0; - - static Sign update_epsilon( - const Static_filter_error &a00, - const Static_filter_error &a01, - const Static_filter_error &a02, - const Static_filter_error &a03, - const Static_filter_error &a10, - const Static_filter_error &a11, - const Static_filter_error &a12, - const Static_filter_error &a13, - const Static_filter_error &a20, - const Static_filter_error &a21, - const Static_filter_error &a22, - const Static_filter_error &a23, - const Static_filter_error &a30, - const Static_filter_error &a31, - const Static_filter_error &a32, - const Static_filter_error &a33, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return CGAL_NTS Static_Filtered_sign_1::update_epsilon(det4x4_by_formula(a00, a01, a02, a03, - a10, a11, a12, a13, - a20, a21, a22, a23, - a30, a31, a32, a33), - epsilon_0); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Sign epsilon_variant( - const Restricted_double &a00, - const Restricted_double &a01, - const Restricted_double &a02, - const Restricted_double &a03, - const Restricted_double &a10, - const Restricted_double &a11, - const Restricted_double &a12, - const Restricted_double &a13, - const Restricted_double &a20, - const Restricted_double &a21, - const Restricted_double &a22, - const Restricted_double &a23, - const Restricted_double &a30, - const Restricted_double &a31, - const Restricted_double &a32, - const Restricted_double &a33, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return CGAL_NTS Static_Filtered_sign_1::epsilon_variant(det4x4_by_formula(a00, a01, a02, a03, - a10, a11, a12, a13, - a20, a21, a22, a23, - a30, a31, a32, a33), - epsilon_0); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Sign -sign_of_determinant4x4( - const Filtered_exact &a00, - const Filtered_exact &a01, - const Filtered_exact &a02, - const Filtered_exact &a03, - const Filtered_exact &a10, - const Filtered_exact &a11, - const Filtered_exact &a12, - const Filtered_exact &a13, - const Filtered_exact &a20, - const Filtered_exact &a21, - const Filtered_exact &a22, - const Filtered_exact &a23, - const Filtered_exact &a30, - const Filtered_exact &a31, - const Filtered_exact &a32, - const Filtered_exact &a33) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_sign_of_determinant4x4_16::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(a00.to_double()) > SAF_bound || - fabs(a01.to_double()) > SAF_bound || - fabs(a02.to_double()) > SAF_bound || - fabs(a03.to_double()) > SAF_bound || - fabs(a10.to_double()) > SAF_bound || - fabs(a11.to_double()) > SAF_bound || - fabs(a12.to_double()) > SAF_bound || - fabs(a13.to_double()) > SAF_bound || - fabs(a20.to_double()) > SAF_bound || - fabs(a21.to_double()) > SAF_bound || - fabs(a22.to_double()) > SAF_bound || - fabs(a23.to_double()) > SAF_bound || - fabs(a30.to_double()) > SAF_bound || - fabs(a31.to_double()) > SAF_bound || - fabs(a32.to_double()) > SAF_bound || - fabs(a33.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(a00.to_double())); - NEW_bound = max(NEW_bound, fabs(a01.to_double())); - NEW_bound = max(NEW_bound, fabs(a02.to_double())); - NEW_bound = max(NEW_bound, fabs(a03.to_double())); - NEW_bound = max(NEW_bound, fabs(a10.to_double())); - NEW_bound = max(NEW_bound, fabs(a11.to_double())); - NEW_bound = max(NEW_bound, fabs(a12.to_double())); - NEW_bound = max(NEW_bound, fabs(a13.to_double())); - NEW_bound = max(NEW_bound, fabs(a20.to_double())); - NEW_bound = max(NEW_bound, fabs(a21.to_double())); - NEW_bound = max(NEW_bound, fabs(a22.to_double())); - NEW_bound = max(NEW_bound, fabs(a23.to_double())); - NEW_bound = max(NEW_bound, fabs(a30.to_double())); - NEW_bound = max(NEW_bound, fabs(a31.to_double())); - NEW_bound = max(NEW_bound, fabs(a32.to_double())); - NEW_bound = max(NEW_bound, fabs(a33.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA sign_of_determinant4x4 updates"); - ++updates; -#endif - Static_Filtered_sign_of_determinant4x4_16::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA sign_of_determinant4x4 calls"); - ++calls; -#endif - return Static_Filtered_sign_of_determinant4x4_16::epsilon_variant( - a00.dbl(), - a01.dbl(), - a02.dbl(), - a03.dbl(), - a10.dbl(), - a11.dbl(), - a12.dbl(), - a13.dbl(), - a20.dbl(), - a21.dbl(), - a22.dbl(), - a23.dbl(), - a30.dbl(), - a31.dbl(), - a32.dbl(), - a33.dbl(), - Static_Filtered_sign_of_determinant4x4_16::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA sign_of_determinant4x4 failures"); - ++failures; -#endif - return sign_of_determinant4x4( - a00.exact(), - a01.exact(), - a02.exact(), - a03.exact(), - a10.exact(), - a11.exact(), - a12.exact(), - a13.exact(), - a20.exact(), - a21.exact(), - a22.exact(), - a23.exact(), - a30.exact(), - a31.exact(), - a32.exact(), - a33.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* inline */ -Sign -sign_of_determinant4x4( - const Filtered_exact &a00, - const Filtered_exact &a01, - const Filtered_exact &a02, - const Filtered_exact &a03, - const Filtered_exact &a10, - const Filtered_exact &a11, - const Filtered_exact &a12, - const Filtered_exact &a13, - const Filtered_exact &a20, - const Filtered_exact &a21, - const Filtered_exact &a22, - const Filtered_exact &a23, - const Filtered_exact &a30, - const Filtered_exact &a31, - const Filtered_exact &a32, - const Filtered_exact &a33) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_sign_of_determinant4x4_16::_bound; ) - CGAL_assertion(!( - fabs(a00.to_double()) > SAF_bound || - fabs(a01.to_double()) > SAF_bound || - fabs(a02.to_double()) > SAF_bound || - fabs(a03.to_double()) > SAF_bound || - fabs(a10.to_double()) > SAF_bound || - fabs(a11.to_double()) > SAF_bound || - fabs(a12.to_double()) > SAF_bound || - fabs(a13.to_double()) > SAF_bound || - fabs(a20.to_double()) > SAF_bound || - fabs(a21.to_double()) > SAF_bound || - fabs(a22.to_double()) > SAF_bound || - fabs(a23.to_double()) > SAF_bound || - fabs(a30.to_double()) > SAF_bound || - fabs(a31.to_double()) > SAF_bound || - fabs(a32.to_double()) > SAF_bound || - fabs(a33.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST sign_of_determinant4x4 calls"); - ++calls; -#endif - return Static_Filtered_sign_of_determinant4x4_16::epsilon_variant( - a00.dbl(), - a01.dbl(), - a02.dbl(), - a03.dbl(), - a10.dbl(), - a11.dbl(), - a12.dbl(), - a13.dbl(), - a20.dbl(), - a21.dbl(), - a22.dbl(), - a23.dbl(), - a30.dbl(), - a31.dbl(), - a32.dbl(), - a33.dbl(), - Static_Filtered_sign_of_determinant4x4_16::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST sign_of_determinant4x4 failures"); - ++failures; -#endif - return sign_of_determinant4x4( - a00.exact(), - a01.exact(), - a02.exact(), - a03.exact(), - a10.exact(), - a11.exact(), - a12.exact(), - a13.exact(), - a20.exact(), - a21.exact(), - a22.exact(), - a23.exact(), - a30.exact(), - a31.exact(), - a32.exact(), - a33.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -998,408 +310,6 @@ sign_of_determinant5x5( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_sign_of_determinant5x5_25 -{ - static double _bound; - static double _epsilon_0; - - static Sign update_epsilon( - const Static_filter_error &a00, - const Static_filter_error &a01, - const Static_filter_error &a02, - const Static_filter_error &a03, - const Static_filter_error &a04, - const Static_filter_error &a10, - const Static_filter_error &a11, - const Static_filter_error &a12, - const Static_filter_error &a13, - const Static_filter_error &a14, - const Static_filter_error &a20, - const Static_filter_error &a21, - const Static_filter_error &a22, - const Static_filter_error &a23, - const Static_filter_error &a24, - const Static_filter_error &a30, - const Static_filter_error &a31, - const Static_filter_error &a32, - const Static_filter_error &a33, - const Static_filter_error &a34, - const Static_filter_error &a40, - const Static_filter_error &a41, - const Static_filter_error &a42, - const Static_filter_error &a43, - const Static_filter_error &a44, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return CGAL_NTS Static_Filtered_sign_1::update_epsilon(det5x5_by_formula(a00, a01, a02, a03, a04, - a10, a11, a12, a13, a14, - a20, a21, a22, a23, a24, - a30, a31, a32, a33, a34, - a40, a41, a42, a43, a44), - epsilon_0); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Sign epsilon_variant( - const Restricted_double &a00, - const Restricted_double &a01, - const Restricted_double &a02, - const Restricted_double &a03, - const Restricted_double &a04, - const Restricted_double &a10, - const Restricted_double &a11, - const Restricted_double &a12, - const Restricted_double &a13, - const Restricted_double &a14, - const Restricted_double &a20, - const Restricted_double &a21, - const Restricted_double &a22, - const Restricted_double &a23, - const Restricted_double &a24, - const Restricted_double &a30, - const Restricted_double &a31, - const Restricted_double &a32, - const Restricted_double &a33, - const Restricted_double &a34, - const Restricted_double &a40, - const Restricted_double &a41, - const Restricted_double &a42, - const Restricted_double &a43, - const Restricted_double &a44, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return CGAL_NTS Static_Filtered_sign_1::epsilon_variant(det5x5_by_formula(a00, a01, a02, a03, a04, - a10, a11, a12, a13, a14, - a20, a21, a22, a23, a24, - a30, a31, a32, a33, a34, - a40, a41, a42, a43, a44), - epsilon_0); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Sign -sign_of_determinant5x5( - const Filtered_exact &a00, - const Filtered_exact &a01, - const Filtered_exact &a02, - const Filtered_exact &a03, - const Filtered_exact &a04, - const Filtered_exact &a10, - const Filtered_exact &a11, - const Filtered_exact &a12, - const Filtered_exact &a13, - const Filtered_exact &a14, - const Filtered_exact &a20, - const Filtered_exact &a21, - const Filtered_exact &a22, - const Filtered_exact &a23, - const Filtered_exact &a24, - const Filtered_exact &a30, - const Filtered_exact &a31, - const Filtered_exact &a32, - const Filtered_exact &a33, - const Filtered_exact &a34, - const Filtered_exact &a40, - const Filtered_exact &a41, - const Filtered_exact &a42, - const Filtered_exact &a43, - const Filtered_exact &a44) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_sign_of_determinant5x5_25::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(a00.to_double()) > SAF_bound || - fabs(a01.to_double()) > SAF_bound || - fabs(a02.to_double()) > SAF_bound || - fabs(a03.to_double()) > SAF_bound || - fabs(a04.to_double()) > SAF_bound || - fabs(a10.to_double()) > SAF_bound || - fabs(a11.to_double()) > SAF_bound || - fabs(a12.to_double()) > SAF_bound || - fabs(a13.to_double()) > SAF_bound || - fabs(a14.to_double()) > SAF_bound || - fabs(a20.to_double()) > SAF_bound || - fabs(a21.to_double()) > SAF_bound || - fabs(a22.to_double()) > SAF_bound || - fabs(a23.to_double()) > SAF_bound || - fabs(a24.to_double()) > SAF_bound || - fabs(a30.to_double()) > SAF_bound || - fabs(a31.to_double()) > SAF_bound || - fabs(a32.to_double()) > SAF_bound || - fabs(a33.to_double()) > SAF_bound || - fabs(a34.to_double()) > SAF_bound || - fabs(a40.to_double()) > SAF_bound || - fabs(a41.to_double()) > SAF_bound || - fabs(a42.to_double()) > SAF_bound || - fabs(a43.to_double()) > SAF_bound || - fabs(a44.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(a00.to_double())); - NEW_bound = max(NEW_bound, fabs(a01.to_double())); - NEW_bound = max(NEW_bound, fabs(a02.to_double())); - NEW_bound = max(NEW_bound, fabs(a03.to_double())); - NEW_bound = max(NEW_bound, fabs(a04.to_double())); - NEW_bound = max(NEW_bound, fabs(a10.to_double())); - NEW_bound = max(NEW_bound, fabs(a11.to_double())); - NEW_bound = max(NEW_bound, fabs(a12.to_double())); - NEW_bound = max(NEW_bound, fabs(a13.to_double())); - NEW_bound = max(NEW_bound, fabs(a14.to_double())); - NEW_bound = max(NEW_bound, fabs(a20.to_double())); - NEW_bound = max(NEW_bound, fabs(a21.to_double())); - NEW_bound = max(NEW_bound, fabs(a22.to_double())); - NEW_bound = max(NEW_bound, fabs(a23.to_double())); - NEW_bound = max(NEW_bound, fabs(a24.to_double())); - NEW_bound = max(NEW_bound, fabs(a30.to_double())); - NEW_bound = max(NEW_bound, fabs(a31.to_double())); - NEW_bound = max(NEW_bound, fabs(a32.to_double())); - NEW_bound = max(NEW_bound, fabs(a33.to_double())); - NEW_bound = max(NEW_bound, fabs(a34.to_double())); - NEW_bound = max(NEW_bound, fabs(a40.to_double())); - NEW_bound = max(NEW_bound, fabs(a41.to_double())); - NEW_bound = max(NEW_bound, fabs(a42.to_double())); - NEW_bound = max(NEW_bound, fabs(a43.to_double())); - NEW_bound = max(NEW_bound, fabs(a44.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA sign_of_determinant5x5 updates"); - ++updates; -#endif - Static_Filtered_sign_of_determinant5x5_25::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA sign_of_determinant5x5 calls"); - ++calls; -#endif - return Static_Filtered_sign_of_determinant5x5_25::epsilon_variant( - a00.dbl(), - a01.dbl(), - a02.dbl(), - a03.dbl(), - a04.dbl(), - a10.dbl(), - a11.dbl(), - a12.dbl(), - a13.dbl(), - a14.dbl(), - a20.dbl(), - a21.dbl(), - a22.dbl(), - a23.dbl(), - a24.dbl(), - a30.dbl(), - a31.dbl(), - a32.dbl(), - a33.dbl(), - a34.dbl(), - a40.dbl(), - a41.dbl(), - a42.dbl(), - a43.dbl(), - a44.dbl(), - Static_Filtered_sign_of_determinant5x5_25::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA sign_of_determinant5x5 failures"); - ++failures; -#endif - return sign_of_determinant5x5( - a00.exact(), - a01.exact(), - a02.exact(), - a03.exact(), - a04.exact(), - a10.exact(), - a11.exact(), - a12.exact(), - a13.exact(), - a14.exact(), - a20.exact(), - a21.exact(), - a22.exact(), - a23.exact(), - a24.exact(), - a30.exact(), - a31.exact(), - a32.exact(), - a33.exact(), - a34.exact(), - a40.exact(), - a41.exact(), - a42.exact(), - a43.exact(), - a44.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Sign -sign_of_determinant5x5( - const Filtered_exact &a00, - const Filtered_exact &a01, - const Filtered_exact &a02, - const Filtered_exact &a03, - const Filtered_exact &a04, - const Filtered_exact &a10, - const Filtered_exact &a11, - const Filtered_exact &a12, - const Filtered_exact &a13, - const Filtered_exact &a14, - const Filtered_exact &a20, - const Filtered_exact &a21, - const Filtered_exact &a22, - const Filtered_exact &a23, - const Filtered_exact &a24, - const Filtered_exact &a30, - const Filtered_exact &a31, - const Filtered_exact &a32, - const Filtered_exact &a33, - const Filtered_exact &a34, - const Filtered_exact &a40, - const Filtered_exact &a41, - const Filtered_exact &a42, - const Filtered_exact &a43, - const Filtered_exact &a44) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_sign_of_determinant5x5_25::_bound; ) - CGAL_assertion(!( - fabs(a00.to_double()) > SAF_bound || - fabs(a01.to_double()) > SAF_bound || - fabs(a02.to_double()) > SAF_bound || - fabs(a03.to_double()) > SAF_bound || - fabs(a04.to_double()) > SAF_bound || - fabs(a10.to_double()) > SAF_bound || - fabs(a11.to_double()) > SAF_bound || - fabs(a12.to_double()) > SAF_bound || - fabs(a13.to_double()) > SAF_bound || - fabs(a14.to_double()) > SAF_bound || - fabs(a20.to_double()) > SAF_bound || - fabs(a21.to_double()) > SAF_bound || - fabs(a22.to_double()) > SAF_bound || - fabs(a23.to_double()) > SAF_bound || - fabs(a24.to_double()) > SAF_bound || - fabs(a30.to_double()) > SAF_bound || - fabs(a31.to_double()) > SAF_bound || - fabs(a32.to_double()) > SAF_bound || - fabs(a33.to_double()) > SAF_bound || - fabs(a34.to_double()) > SAF_bound || - fabs(a40.to_double()) > SAF_bound || - fabs(a41.to_double()) > SAF_bound || - fabs(a42.to_double()) > SAF_bound || - fabs(a43.to_double()) > SAF_bound || - fabs(a44.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST sign_of_determinant5x5 calls"); - ++calls; -#endif - return Static_Filtered_sign_of_determinant5x5_25::epsilon_variant( - a00.dbl(), - a01.dbl(), - a02.dbl(), - a03.dbl(), - a04.dbl(), - a10.dbl(), - a11.dbl(), - a12.dbl(), - a13.dbl(), - a14.dbl(), - a20.dbl(), - a21.dbl(), - a22.dbl(), - a23.dbl(), - a24.dbl(), - a30.dbl(), - a31.dbl(), - a32.dbl(), - a33.dbl(), - a34.dbl(), - a40.dbl(), - a41.dbl(), - a42.dbl(), - a43.dbl(), - a44.dbl(), - Static_Filtered_sign_of_determinant5x5_25::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST sign_of_determinant5x5 failures"); - ++failures; -#endif - return sign_of_determinant5x5( - a00.exact(), - a01.exact(), - a02.exact(), - a03.exact(), - a04.exact(), - a10.exact(), - a11.exact(), - a12.exact(), - a13.exact(), - a14.exact(), - a20.exact(), - a21.exact(), - a22.exact(), - a23.exact(), - a24.exact(), - a30.exact(), - a31.exact(), - a32.exact(), - a33.exact(), - a34.exact(), - a40.exact(), - a41.exact(), - a42.exact(), - a43.exact(), - a44.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - #ifndef CGAL_CFG_MATCHING_BUG_2 template < class CGAL_IA_CT, class CGAL_IA_ET, bool CGAL_IA_PROTECTED, class CGAL_IA_CACHE > @@ -1538,531 +448,6 @@ sign_of_determinant6x6( } } -#ifdef CGAL_IA_NEW_FILTERS - -struct Static_Filtered_sign_of_determinant6x6_36 -{ - static double _bound; - static double _epsilon_0; - - static Sign update_epsilon( - const Static_filter_error &a00, - const Static_filter_error &a01, - const Static_filter_error &a02, - const Static_filter_error &a03, - const Static_filter_error &a04, - const Static_filter_error &a05, - const Static_filter_error &a10, - const Static_filter_error &a11, - const Static_filter_error &a12, - const Static_filter_error &a13, - const Static_filter_error &a14, - const Static_filter_error &a15, - const Static_filter_error &a20, - const Static_filter_error &a21, - const Static_filter_error &a22, - const Static_filter_error &a23, - const Static_filter_error &a24, - const Static_filter_error &a25, - const Static_filter_error &a30, - const Static_filter_error &a31, - const Static_filter_error &a32, - const Static_filter_error &a33, - const Static_filter_error &a34, - const Static_filter_error &a35, - const Static_filter_error &a40, - const Static_filter_error &a41, - const Static_filter_error &a42, - const Static_filter_error &a43, - const Static_filter_error &a44, - const Static_filter_error &a45, - const Static_filter_error &a50, - const Static_filter_error &a51, - const Static_filter_error &a52, - const Static_filter_error &a53, - const Static_filter_error &a54, - const Static_filter_error &a55, - double & epsilon_0) - { - typedef Static_filter_error FT; - - return CGAL_NTS Static_Filtered_sign_1::update_epsilon(det6x6_by_formula(a00, a01, a02, a03, a04, a05, - a10, a11, a12, a13, a14, a15, - a20, a21, a22, a23, a24, a25, - a30, a31, a32, a33, a34, a35, - a40, a41, a42, a43, a44, a45, - a50, a51, a52, a53, a54, a55), - epsilon_0); - } - - // Call this function from the outside to update the context. - static void new_bound (const double b) // , const double error = 0) - { - _bound = b; - // recompute the epsilons: "just" call it over Static_filter_error. - // That's the tricky part that might not work for everything. - (void) update_epsilon(b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,_epsilon_0); - // TODO: We should verify that all epsilons have really been updated. - } - - static Sign epsilon_variant( - const Restricted_double &a00, - const Restricted_double &a01, - const Restricted_double &a02, - const Restricted_double &a03, - const Restricted_double &a04, - const Restricted_double &a05, - const Restricted_double &a10, - const Restricted_double &a11, - const Restricted_double &a12, - const Restricted_double &a13, - const Restricted_double &a14, - const Restricted_double &a15, - const Restricted_double &a20, - const Restricted_double &a21, - const Restricted_double &a22, - const Restricted_double &a23, - const Restricted_double &a24, - const Restricted_double &a25, - const Restricted_double &a30, - const Restricted_double &a31, - const Restricted_double &a32, - const Restricted_double &a33, - const Restricted_double &a34, - const Restricted_double &a35, - const Restricted_double &a40, - const Restricted_double &a41, - const Restricted_double &a42, - const Restricted_double &a43, - const Restricted_double &a44, - const Restricted_double &a45, - const Restricted_double &a50, - const Restricted_double &a51, - const Restricted_double &a52, - const Restricted_double &a53, - const Restricted_double &a54, - const Restricted_double &a55, - const double & epsilon_0) - { - typedef Restricted_double FT; - - return CGAL_NTS Static_Filtered_sign_1::epsilon_variant(det6x6_by_formula(a00, a01, a02, a03, a04, a05, - a10, a11, a12, a13, a14, a15, - a20, a21, a22, a23, a24, a25, - a30, a31, a32, a33, a34, a35, - a40, a41, a42, a43, a44, a45, - a50, a51, a52, a53, a54, a55), - epsilon_0); - } -}; - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Sign -sign_of_determinant6x6( - const Filtered_exact &a00, - const Filtered_exact &a01, - const Filtered_exact &a02, - const Filtered_exact &a03, - const Filtered_exact &a04, - const Filtered_exact &a05, - const Filtered_exact &a10, - const Filtered_exact &a11, - const Filtered_exact &a12, - const Filtered_exact &a13, - const Filtered_exact &a14, - const Filtered_exact &a15, - const Filtered_exact &a20, - const Filtered_exact &a21, - const Filtered_exact &a22, - const Filtered_exact &a23, - const Filtered_exact &a24, - const Filtered_exact &a25, - const Filtered_exact &a30, - const Filtered_exact &a31, - const Filtered_exact &a32, - const Filtered_exact &a33, - const Filtered_exact &a34, - const Filtered_exact &a35, - const Filtered_exact &a40, - const Filtered_exact &a41, - const Filtered_exact &a42, - const Filtered_exact &a43, - const Filtered_exact &a44, - const Filtered_exact &a45, - const Filtered_exact &a50, - const Filtered_exact &a51, - const Filtered_exact &a52, - const Filtered_exact &a53, - const Filtered_exact &a54, - const Filtered_exact &a55) -{ -// bool re_adjusted = false; - const double SAF_bound = Static_Filtered_sign_of_determinant6x6_36::_bound; - - // Check the bounds. All arguments must be <= SAF_bound. - if ( - fabs(a00.to_double()) > SAF_bound || - fabs(a01.to_double()) > SAF_bound || - fabs(a02.to_double()) > SAF_bound || - fabs(a03.to_double()) > SAF_bound || - fabs(a04.to_double()) > SAF_bound || - fabs(a05.to_double()) > SAF_bound || - fabs(a10.to_double()) > SAF_bound || - fabs(a11.to_double()) > SAF_bound || - fabs(a12.to_double()) > SAF_bound || - fabs(a13.to_double()) > SAF_bound || - fabs(a14.to_double()) > SAF_bound || - fabs(a15.to_double()) > SAF_bound || - fabs(a20.to_double()) > SAF_bound || - fabs(a21.to_double()) > SAF_bound || - fabs(a22.to_double()) > SAF_bound || - fabs(a23.to_double()) > SAF_bound || - fabs(a24.to_double()) > SAF_bound || - fabs(a25.to_double()) > SAF_bound || - fabs(a30.to_double()) > SAF_bound || - fabs(a31.to_double()) > SAF_bound || - fabs(a32.to_double()) > SAF_bound || - fabs(a33.to_double()) > SAF_bound || - fabs(a34.to_double()) > SAF_bound || - fabs(a35.to_double()) > SAF_bound || - fabs(a40.to_double()) > SAF_bound || - fabs(a41.to_double()) > SAF_bound || - fabs(a42.to_double()) > SAF_bound || - fabs(a43.to_double()) > SAF_bound || - fabs(a44.to_double()) > SAF_bound || - fabs(a45.to_double()) > SAF_bound || - fabs(a50.to_double()) > SAF_bound || - fabs(a51.to_double()) > SAF_bound || - fabs(a52.to_double()) > SAF_bound || - fabs(a53.to_double()) > SAF_bound || - fabs(a54.to_double()) > SAF_bound || - fabs(a55.to_double()) > SAF_bound) - { -// re_adjust: - // Compute the new bound. - double NEW_bound = 0.0; - NEW_bound = max(NEW_bound, fabs(a00.to_double())); - NEW_bound = max(NEW_bound, fabs(a01.to_double())); - NEW_bound = max(NEW_bound, fabs(a02.to_double())); - NEW_bound = max(NEW_bound, fabs(a03.to_double())); - NEW_bound = max(NEW_bound, fabs(a04.to_double())); - NEW_bound = max(NEW_bound, fabs(a05.to_double())); - NEW_bound = max(NEW_bound, fabs(a10.to_double())); - NEW_bound = max(NEW_bound, fabs(a11.to_double())); - NEW_bound = max(NEW_bound, fabs(a12.to_double())); - NEW_bound = max(NEW_bound, fabs(a13.to_double())); - NEW_bound = max(NEW_bound, fabs(a14.to_double())); - NEW_bound = max(NEW_bound, fabs(a15.to_double())); - NEW_bound = max(NEW_bound, fabs(a20.to_double())); - NEW_bound = max(NEW_bound, fabs(a21.to_double())); - NEW_bound = max(NEW_bound, fabs(a22.to_double())); - NEW_bound = max(NEW_bound, fabs(a23.to_double())); - NEW_bound = max(NEW_bound, fabs(a24.to_double())); - NEW_bound = max(NEW_bound, fabs(a25.to_double())); - NEW_bound = max(NEW_bound, fabs(a30.to_double())); - NEW_bound = max(NEW_bound, fabs(a31.to_double())); - NEW_bound = max(NEW_bound, fabs(a32.to_double())); - NEW_bound = max(NEW_bound, fabs(a33.to_double())); - NEW_bound = max(NEW_bound, fabs(a34.to_double())); - NEW_bound = max(NEW_bound, fabs(a35.to_double())); - NEW_bound = max(NEW_bound, fabs(a40.to_double())); - NEW_bound = max(NEW_bound, fabs(a41.to_double())); - NEW_bound = max(NEW_bound, fabs(a42.to_double())); - NEW_bound = max(NEW_bound, fabs(a43.to_double())); - NEW_bound = max(NEW_bound, fabs(a44.to_double())); - NEW_bound = max(NEW_bound, fabs(a45.to_double())); - NEW_bound = max(NEW_bound, fabs(a50.to_double())); - NEW_bound = max(NEW_bound, fabs(a51.to_double())); - NEW_bound = max(NEW_bound, fabs(a52.to_double())); - NEW_bound = max(NEW_bound, fabs(a53.to_double())); - NEW_bound = max(NEW_bound, fabs(a54.to_double())); - NEW_bound = max(NEW_bound, fabs(a55.to_double())); - // Re-adjust the context. -#ifdef CGAL_PROFILE - static Profile_counter updates("SA sign_of_determinant6x6 updates"); - ++updates; -#endif - Static_Filtered_sign_of_determinant6x6_36::new_bound(NEW_bound); - } - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("SA sign_of_determinant6x6 calls"); - ++calls; -#endif - return Static_Filtered_sign_of_determinant6x6_36::epsilon_variant( - a00.dbl(), - a01.dbl(), - a02.dbl(), - a03.dbl(), - a04.dbl(), - a05.dbl(), - a10.dbl(), - a11.dbl(), - a12.dbl(), - a13.dbl(), - a14.dbl(), - a15.dbl(), - a20.dbl(), - a21.dbl(), - a22.dbl(), - a23.dbl(), - a24.dbl(), - a25.dbl(), - a30.dbl(), - a31.dbl(), - a32.dbl(), - a33.dbl(), - a34.dbl(), - a35.dbl(), - a40.dbl(), - a41.dbl(), - a42.dbl(), - a43.dbl(), - a44.dbl(), - a45.dbl(), - a50.dbl(), - a51.dbl(), - a52.dbl(), - a53.dbl(), - a54.dbl(), - a55.dbl(), - Static_Filtered_sign_of_determinant6x6_36::_epsilon_0); - } - catch (...) - { - // if (!re_adjusted) { // It failed, we re-adjust once. - // re_adjusted = true; - // goto re_adjust; - // } -#ifdef CGAL_PROFILE - static Profile_counter failures("SA sign_of_determinant6x6 failures"); - ++failures; -#endif - return sign_of_determinant6x6( - a00.exact(), - a01.exact(), - a02.exact(), - a03.exact(), - a04.exact(), - a05.exact(), - a10.exact(), - a11.exact(), - a12.exact(), - a13.exact(), - a14.exact(), - a15.exact(), - a20.exact(), - a21.exact(), - a22.exact(), - a23.exact(), - a24.exact(), - a25.exact(), - a30.exact(), - a31.exact(), - a32.exact(), - a33.exact(), - a34.exact(), - a35.exact(), - a40.exact(), - a41.exact(), - a42.exact(), - a43.exact(), - a44.exact(), - a45.exact(), - a50.exact(), - a51.exact(), - a52.exact(), - a53.exact(), - a54.exact(), - a55.exact()); - } -} - -#ifndef CGAL_CFG_MATCHING_BUG_2 -template < class CGAL_IA_CT, class CGAL_IA_ET, class CGAL_IA_CACHE > -#else -static -#endif -/* CGAL_KERNEL_LARGE_INLINE */ -Sign -sign_of_determinant6x6( - const Filtered_exact &a00, - const Filtered_exact &a01, - const Filtered_exact &a02, - const Filtered_exact &a03, - const Filtered_exact &a04, - const Filtered_exact &a05, - const Filtered_exact &a10, - const Filtered_exact &a11, - const Filtered_exact &a12, - const Filtered_exact &a13, - const Filtered_exact &a14, - const Filtered_exact &a15, - const Filtered_exact &a20, - const Filtered_exact &a21, - const Filtered_exact &a22, - const Filtered_exact &a23, - const Filtered_exact &a24, - const Filtered_exact &a25, - const Filtered_exact &a30, - const Filtered_exact &a31, - const Filtered_exact &a32, - const Filtered_exact &a33, - const Filtered_exact &a34, - const Filtered_exact &a35, - const Filtered_exact &a40, - const Filtered_exact &a41, - const Filtered_exact &a42, - const Filtered_exact &a43, - const Filtered_exact &a44, - const Filtered_exact &a45, - const Filtered_exact &a50, - const Filtered_exact &a51, - const Filtered_exact &a52, - const Filtered_exact &a53, - const Filtered_exact &a54, - const Filtered_exact &a55) -{ - CGAL_assertion_code( - const double SAF_bound = Static_Filtered_sign_of_determinant6x6_36::_bound; ) - CGAL_assertion(!( - fabs(a00.to_double()) > SAF_bound || - fabs(a01.to_double()) > SAF_bound || - fabs(a02.to_double()) > SAF_bound || - fabs(a03.to_double()) > SAF_bound || - fabs(a04.to_double()) > SAF_bound || - fabs(a05.to_double()) > SAF_bound || - fabs(a10.to_double()) > SAF_bound || - fabs(a11.to_double()) > SAF_bound || - fabs(a12.to_double()) > SAF_bound || - fabs(a13.to_double()) > SAF_bound || - fabs(a14.to_double()) > SAF_bound || - fabs(a15.to_double()) > SAF_bound || - fabs(a20.to_double()) > SAF_bound || - fabs(a21.to_double()) > SAF_bound || - fabs(a22.to_double()) > SAF_bound || - fabs(a23.to_double()) > SAF_bound || - fabs(a24.to_double()) > SAF_bound || - fabs(a25.to_double()) > SAF_bound || - fabs(a30.to_double()) > SAF_bound || - fabs(a31.to_double()) > SAF_bound || - fabs(a32.to_double()) > SAF_bound || - fabs(a33.to_double()) > SAF_bound || - fabs(a34.to_double()) > SAF_bound || - fabs(a35.to_double()) > SAF_bound || - fabs(a40.to_double()) > SAF_bound || - fabs(a41.to_double()) > SAF_bound || - fabs(a42.to_double()) > SAF_bound || - fabs(a43.to_double()) > SAF_bound || - fabs(a44.to_double()) > SAF_bound || - fabs(a45.to_double()) > SAF_bound || - fabs(a50.to_double()) > SAF_bound || - fabs(a51.to_double()) > SAF_bound || - fabs(a52.to_double()) > SAF_bound || - fabs(a53.to_double()) > SAF_bound || - fabs(a54.to_double()) > SAF_bound || - fabs(a55.to_double()) > SAF_bound)); - - try - { -#ifdef CGAL_PROFILE - static Profile_counter calls("ST sign_of_determinant6x6 calls"); - ++calls; -#endif - return Static_Filtered_sign_of_determinant6x6_36::epsilon_variant( - a00.dbl(), - a01.dbl(), - a02.dbl(), - a03.dbl(), - a04.dbl(), - a05.dbl(), - a10.dbl(), - a11.dbl(), - a12.dbl(), - a13.dbl(), - a14.dbl(), - a15.dbl(), - a20.dbl(), - a21.dbl(), - a22.dbl(), - a23.dbl(), - a24.dbl(), - a25.dbl(), - a30.dbl(), - a31.dbl(), - a32.dbl(), - a33.dbl(), - a34.dbl(), - a35.dbl(), - a40.dbl(), - a41.dbl(), - a42.dbl(), - a43.dbl(), - a44.dbl(), - a45.dbl(), - a50.dbl(), - a51.dbl(), - a52.dbl(), - a53.dbl(), - a54.dbl(), - a55.dbl(), - Static_Filtered_sign_of_determinant6x6_36::_epsilon_0); - } - catch (...) - { -#ifdef CGAL_PROFILE - static Profile_counter failures("ST sign_of_determinant6x6 failures"); - ++failures; -#endif - return sign_of_determinant6x6( - a00.exact(), - a01.exact(), - a02.exact(), - a03.exact(), - a04.exact(), - a05.exact(), - a10.exact(), - a11.exact(), - a12.exact(), - a13.exact(), - a14.exact(), - a15.exact(), - a20.exact(), - a21.exact(), - a22.exact(), - a23.exact(), - a24.exact(), - a25.exact(), - a30.exact(), - a31.exact(), - a32.exact(), - a33.exact(), - a34.exact(), - a35.exact(), - a40.exact(), - a41.exact(), - a42.exact(), - a43.exact(), - a44.exact(), - a45.exact(), - a50.exact(), - a51.exact(), - a52.exact(), - a53.exact(), - a54.exact(), - a55.exact()); - } -} - -#endif // CGAL_IA_NEW_FILTERS - CGAL_END_NAMESPACE #endif // CGAL_ARITHMETIC_FILTER_PREDICATES_SIGN_OF_DETERMINANT_H diff --git a/Packages/Interval_arithmetic/scripts/filtered_predicates_generator.pl b/Packages/Interval_arithmetic/scripts/filtered_predicates_generator.pl index c64253ddce6..6a3bdb497a2 100755 --- a/Packages/Interval_arithmetic/scripts/filtered_predicates_generator.pl +++ b/Packages/Interval_arithmetic/scripts/filtered_predicates_generator.pl @@ -16,7 +16,7 @@ # - While parsing, remove CGAL_assertion() and co from the original code. # - Add assertions about the epsilons being updated. -use vars qw($opt_p $opt_h $opt_d $opt_v $opt_l); # Suppress warnings +use vars qw($opt_p $opt_h $opt_d $opt_v $opt_l $opt_s); # Suppress warnings require 'getopt.pl'; # Global variables @@ -47,6 +47,7 @@ sub parse_command_line { warn "Usage: filtered_predicate_converter [options] -i file : specify the main input source file [default is stdin] -o file : specify the main output file [default is stdout] + -s : also want the static adaptative filters [default is off] -l file : indicate the output file that will receive the static part. -d files : list of dependant predicates file (concatenated with \":\") by default, only the built-in predicates are known. @@ -63,6 +64,7 @@ sub parse_command_line { warning("The -l option is compulsory for the static filters."); } $pedantic = $opt_p; + $want_statics = $opt_s; } # Auxiliary routine to emit a warning and die if pedantic. @@ -367,12 +369,14 @@ sub print_predicates { print FO "CGAL_BEGIN_NAMESPACE\n\n" if $CGAL eq "" && not $was_in_CGAL; print FO "CGAL_END_NAMESPACE\n\n" if $CGAL ne "" && $was_in_CGAL; print_dynamic(@{$predicates[$i]}); - print FO "#ifdef CGAL_IA_NEW_FILTERS\n\n"; - print_predicate_struct(@{$predicates[$i]}); - print_static("true", @{$predicates[$i]}); - print_static("false", @{$predicates[$i]}); - print FO "#endif // CGAL_IA_NEW_FILTERS\n\n"; - print_static_infos(@{$predicates[$i]}); + if ($want_statics) { + print FO "#ifdef CGAL_IA_NEW_FILTERS\n\n"; + print_predicate_struct(@{$predicates[$i]}); + print_static("true", @{$predicates[$i]}); + print_static("false", @{$predicates[$i]}); + print FO "#endif // CGAL_IA_NEW_FILTERS\n\n"; + print_static_infos(@{$predicates[$i]}); + } $was_in_CGAL = $CGAL eq ""; } print FO "CGAL_END_NAMESPACE\n\n" if $was_in_CGAL; @@ -471,15 +475,23 @@ sub main { close(FI); parse_input_code($rest); open(FO, ">$opt_o") || die "Couldn't open output file \"$opt_o\"\n"; - open(FL, ">$opt_l") || die "Couldn't open lib file \"$opt_l\"\n"; + if ($want_statics) { + open(FL, ">$opt_l") || die "Couldn't open lib file \"$opt_l\"\n"; + } print_CGAL_header(FO, $new_protect_name, $file_name); - print_CGAL_header(FL, $new_protect_name."_STATIC_INFO_H", + if ($want_statics) { + print_CGAL_header(FL, $new_protect_name."_STATIC_INFO_H", "static_infos/".$file_name); + } print_predicates(); print FO "#endif // $new_protect_name\n"; - print FL "#endif // $new_protect_name"."_STATIC_INFO_H\n"; + if ($want_statics) { + print FL "#endif // $new_protect_name"."_STATIC_INFO_H\n"; + } close(FO); - close(FL); + if ($want_statics) { + close(FL); + } } main();