Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76925 - in sandbox/gtl/boost/polygon: . detail
From: sydorchuk.andriy_at_[hidden]
Date: 2012-02-06 17:30:43


Author: asydorchuk
Date: 2012-02-06 17:30:41 EST (Mon, 06 Feb 2012)
New Revision: 76925
URL: http://svn.boost.org/trac/boost/changeset/76925

Log:
Removing ULPS static constants (using enumerators constants).
Text files modified:
   sandbox/gtl/boost/polygon/detail/voronoi_ctypes.hpp | 1
   sandbox/gtl/boost/polygon/detail/voronoi_predicates.hpp | 56 +++++++++++++++------------------------
   sandbox/gtl/boost/polygon/voronoi_diagram.hpp | 5 ++-
   3 files changed, 26 insertions(+), 36 deletions(-)

Modified: sandbox/gtl/boost/polygon/detail/voronoi_ctypes.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/detail/voronoi_ctypes.hpp (original)
+++ sandbox/gtl/boost/polygon/detail/voronoi_ctypes.hpp 2012-02-06 17:30:41 EST (Mon, 06 Feb 2012)
@@ -719,6 +719,7 @@
     typedef ulp_comparison<fpt_type> ulp_cmp_type;
     typedef type_converter_fpt to_fpt_converter_type;
     typedef type_converter_efpt to_efpt_converter_type;
+ enum { ULPS = 64 };
 };
 } // detail
 } // polygon

Modified: sandbox/gtl/boost/polygon/detail/voronoi_predicates.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/detail/voronoi_predicates.hpp (original)
+++ sandbox/gtl/boost/polygon/detail/voronoi_predicates.hpp 2012-02-06 17:30:41 EST (Mon, 06 Feb 2012)
@@ -32,10 +32,10 @@
     typedef typename CTYPE_TRAITS::to_fpt_converter_type to_fpt_converter;
     typedef typename CTYPE_TRAITS::to_efpt_converter_type to_efpt_converter;
 
- static const unsigned int ULPS;
- static const unsigned int ULPSx2;
- static const fpt_type fULPS;
- static const fpt_type fULPSx2;
+ enum {
+ ULPS = CTYPE_TRAITS::ULPS,
+ ULPSx2 = ULPS * 2
+ };
 
     template <typename Point>
     static bool is_vertical(const Point &point1, const Point &point2) {
@@ -185,12 +185,12 @@
 
         bool operator()(const circle_type &lhs, const circle_type &rhs) const {
             typename ulp_cmp_type::kResult xCmp =
- ulp_cmp(to_fpt(lhs.lower_x()), to_fpt(rhs.lower_x()), ULPS);
+ ulp_cmp(to_fpt(lhs.lower_x()), to_fpt(rhs.lower_x()), ULPSx2);
             if (xCmp != ulp_cmp_type::EQUAL) {
                 return xCmp == ulp_cmp_type::LESS;
             }
             typename ulp_cmp_type::kResult yCmp =
- ulp_cmp(to_fpt(lhs.lower_y()), to_fpt(rhs.lower_y()), ULPS);
+ ulp_cmp(to_fpt(lhs.lower_y()), to_fpt(rhs.lower_y()), ULPSx2);
             return yCmp == ulp_cmp_type::LESS;
         }
 
@@ -1022,9 +1022,9 @@
             c_event = circle_type(c_x.dif().fpv() * inv_orientation.fpv(),
                                   c_y.dif().fpv() * inv_orientation.fpv(),
                                   lower_x.dif().fpv() * inv_orientation.fpv());
- bool recompute_c_x = c_x.dif().ulp() > fULPS;
- bool recompute_c_y = c_y.dif().ulp() > fULPS;
- bool recompute_lower_x = lower_x.dif().ulp() > fULPS;
+ bool recompute_c_x = c_x.dif().ulp() > to_fpt(ULPS);
+ bool recompute_c_y = c_y.dif().ulp() > to_fpt(ULPS);
+ bool recompute_lower_x = lower_x.dif().ulp() > to_fpt(ULPS);
             if (recompute_c_x || recompute_c_y || recompute_lower_x) {
                 exact_circle_formation_functor_.ppp(
                     site1, site2, site3, c_event, recompute_c_x, recompute_c_y, recompute_lower_x);
@@ -1079,9 +1079,9 @@
             }
             lower_x += r * inv_segm_len;
             c_event = circle_type(c_x.dif().fpv(), c_y.dif().fpv(), lower_x.dif().fpv());
- bool recompute_c_x = c_x.dif().ulp() > fULPS;
- bool recompute_c_y = c_y.dif().ulp() > fULPS;
- bool recompute_lower_x = lower_x.dif().ulp() > fULPS;
+ bool recompute_c_x = c_x.dif().ulp() > to_fpt(ULPS);
+ bool recompute_c_y = c_y.dif().ulp() > to_fpt(ULPS);
+ bool recompute_lower_x = lower_x.dif().ulp() > to_fpt(ULPS);
             if (recompute_c_x || recompute_c_y || recompute_lower_x) {
                 exact_circle_formation_functor_.pps(
                     site1, site2, site3, segment_index, c_event,
@@ -1146,9 +1146,9 @@
                 } else {
                     lower_x += robust_fpt_type(0.5, false) * c / a.sqrt();
                 }
- recompute_c_x = c_x.dif().ulp() > fULPS;
- recompute_c_y = c_y.dif().ulp() > fULPS;
- recompute_lower_x = lower_x.dif().ulp() > fULPS;
+ recompute_c_x = c_x.dif().ulp() > to_fpt(ULPS);
+ recompute_c_y = c_y.dif().ulp() > to_fpt(ULPS);
+ recompute_lower_x = lower_x.dif().ulp() > to_fpt(ULPS);
                 c_event = circle_type(c_x.dif().fpv(), c_y.dif().fpv(), lower_x.dif().fpv());
             } else {
                 robust_fpt_type sqr_sum1(get_sqrt(a1 * a1 + b1 * b1), 2.0);
@@ -1212,9 +1212,9 @@
                 } else {
                     lower_x += t * orientation;
                 }
- recompute_c_x = c_x.dif().ulp() > fULPS;
- recompute_c_y = c_y.dif().ulp() > fULPS;
- recompute_lower_x = lower_x.dif().ulp() > fULPS;
+ recompute_c_x = c_x.dif().ulp() > to_fpt(ULPS);
+ recompute_c_y = c_y.dif().ulp() > to_fpt(ULPS);
+ recompute_lower_x = lower_x.dif().ulp() > to_fpt(ULPS);
                 c_event = circle_type(c_x.dif().fpv(), c_y.dif().fpv(), lower_x.dif().fpv());
             }
             if (recompute_c_x || recompute_c_y || recompute_lower_x) {
@@ -1277,10 +1277,10 @@
             c_y += b3 * c1 * len2;
             c_y -= b1 * c3 * len2;
             robust_dif_type lower_x(c_x + r);
- bool recompute_c_x = c_x.dif().ulp() > fULPS;
- bool recompute_c_y = c_y.dif().ulp() > fULPS;
- bool recompute_lower_x = lower_x.dif().ulp() > fULPS;
- bool recompute_denom = denom.dif().ulp() > fULPS;
+ bool recompute_c_x = c_x.dif().ulp() > to_fpt(ULPS);
+ bool recompute_c_y = c_y.dif().ulp() > to_fpt(ULPS);
+ bool recompute_lower_x = lower_x.dif().ulp() > to_fpt(ULPS);
+ bool recompute_denom = denom.dif().ulp() > to_fpt(ULPS);
             c_event = circle_type(c_x.dif().fpv() / denom.dif().fpv(),
                                   c_y.dif().fpv() / denom.dif().fpv(),
                                   lower_x.dif().fpv() / denom.dif().fpv());
@@ -1379,18 +1379,6 @@
         return dif_x * dif_x + dif_y * dif_y;
     }
 };
-
-template <typename CTYPE_TRAITS>
-const unsigned int voronoi_predicates<CTYPE_TRAITS>::ULPS = 64;
-template <typename CTYPE_TRAITS>
-const unsigned int voronoi_predicates<CTYPE_TRAITS>::ULPSx2 = 128;
-template <typename CTYPE_TRAITS>
-const typename voronoi_predicates<CTYPE_TRAITS>::fpt_type voronoi_predicates<CTYPE_TRAITS>::fULPS =
- voronoi_predicates<CTYPE_TRAITS>::ULPS;
-template <typename CTYPE_TRAITS>
-const typename voronoi_predicates<CTYPE_TRAITS>::fpt_type voronoi_predicates<CTYPE_TRAITS>::fULPSx2 =
- voronoi_predicates<CTYPE_TRAITS>::ULPSx2;
-
 } // detail
 } // polygon
 } // boost

Modified: sandbox/gtl/boost/polygon/voronoi_diagram.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/voronoi_diagram.hpp (original)
+++ sandbox/gtl/boost/polygon/voronoi_diagram.hpp 2012-02-06 17:30:41 EST (Mon, 06 Feb 2012)
@@ -336,11 +336,12 @@
         typedef voronoi_edge<coordinate_type> voronoi_edge_type;
         typedef class {
         public:
+ enum { ULPS = 128 };
             bool operator()(const point_type &v1,
                             const point_type &v2) const {
- return (ulp_cmp(v1.x(), v2.x(), 128) ==
+ return (ulp_cmp(v1.x(), v2.x(), ULPS) ==
                         detail::ulp_comparison<T>::EQUAL) &&
- (ulp_cmp(v1.y(), v2.y(), 128) ==
+ (ulp_cmp(v1.y(), v2.y(), ULPS) ==
                         detail::ulp_comparison<T>::EQUAL);
             }
         private:


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk