|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76712 - in sandbox/gtl: boost/polygon/detail libs/polygon/test
From: sydorchuk.andriy_at_[hidden]
Date: 2012-01-26 16:36:52
Author: asydorchuk
Date: 2012-01-26 16:36:51 EST (Thu, 26 Jan 2012)
New Revision: 76712
URL: http://svn.boost.org/trac/boost/changeset/76712
Log:
Making code portable to support gmp library mpz_class.
Text files modified:
sandbox/gtl/boost/polygon/detail/voronoi_ctypes.hpp | 2 +-
sandbox/gtl/boost/polygon/detail/voronoi_predicates.hpp | 10 ++++++----
sandbox/gtl/libs/polygon/test/voronoi_benchmark_test.cpp | 6 +++---
3 files changed, 10 insertions(+), 8 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-01-26 16:36:51 EST (Thu, 26 Jan 2012)
@@ -26,7 +26,7 @@
// If two floating-point numbers in the same format are ordered (x < y),
// then they are ordered the same way when their bits are reinterpreted as
// sign-magnitude integers. Values are considered to be almost equal if
-// their integer reinterpretations differ in not more than maxUlps units.
+// their integer bit reinterpretations differ in not more than maxUlps units.
template <typename _fpt>
struct ulp_comparison;
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-01-26 16:36:51 EST (Thu, 26 Jan 2012)
@@ -556,7 +556,8 @@
static_cast<int_x2_type>(site2.y());
sum_y[1] = static_cast<int_x2_type>(site2.y()) +
static_cast<int_x2_type>(site3.y());
- fpt_type inv_denom = to_fpt(0.5) / to_fpt(dif_x[0] * dif_y[1] - dif_x[1] * dif_y[0]);
+ fpt_type inv_denom = to_fpt(0.5) / to_fpt(static_cast<big_int_type>(
+ dif_x[0] * dif_y[1] - dif_x[1] * dif_y[0]));
big_int_type numer1 = dif_x[0] * sum_x[0] + dif_y[0] * sum_y[0];
big_int_type numer2 = dif_x[1] * sum_x[1] + dif_y[1] * sum_y[1];
@@ -567,8 +568,8 @@
if (recompute_lower_x) {
// Evaluate radius of the circle.
big_int_type sqr_r = (dif_x[0] * dif_x[0] + dif_y[0] * dif_y[0]) *
- (dif_x[1] * dif_x[1] + dif_y[1] * dif_y[1]) *
- (dif_x[2] * dif_x[2] + dif_y[2] * dif_y[2]);
+ (dif_x[1] * dif_x[1] + dif_y[1] * dif_y[1]) *
+ (dif_x[2] * dif_x[2] + dif_y[2] * dif_y[2]);
fpt_type r = get_sqrt(to_fpt(sqr_r));
// If c_x >= 0 then lower_x = c_x + r,
@@ -716,7 +717,8 @@
static_cast<int_x2_type>(segm_start2.y());
big_int_type orientation = a[1] * b[0] - a[0] * b[1];
if (is_zero(orientation)) {
- fpt_type denom = to_fpt(2.0) * to_fpt(a[0] * a[0] + b[0] * b[0]);
+ fpt_type denom = to_fpt(2.0) * to_fpt(
+ static_cast<big_int_type>(a[0] * a[0] + b[0] * b[0]));
c[0] = b[0] * (static_cast<int_x2_type>(segm_start2.x()) -
static_cast<int_x2_type>(segm_start1.x())) -
a[0] * (static_cast<int_x2_type>(segm_start2.y()) -
Modified: sandbox/gtl/libs/polygon/test/voronoi_benchmark_test.cpp
==============================================================================
--- sandbox/gtl/libs/polygon/test/voronoi_benchmark_test.cpp (original)
+++ sandbox/gtl/libs/polygon/test/voronoi_benchmark_test.cpp 2012-01-26 16:36:51 EST (Thu, 26 Jan 2012)
@@ -30,7 +30,7 @@
const int SEGMENT_RUNS = 10;
boost::mt19937 gen(static_cast<unsigned int>(time(NULL)));
-boost::timer timer;
+boost::timer timer;
BOOST_AUTO_TEST_CASE_TEMPLATE(benchmark_test_random, T, test_types) {
typedef T coordinate_type;
@@ -78,7 +78,7 @@
BOOST_AUTO_TEST_CASE_TEMPLATE(benchmark_test_points, T, test_types) {
typedef T coordinate_type;
typedef point_data<coordinate_type> point_type;
-
+
std::vector<point_type> points;
{
std::ifstream input_file(POINT_INPUT_FILE);
@@ -117,7 +117,7 @@
typedef T coordinate_type;
typedef point_data<coordinate_type> point_type;
typedef directed_line_segment_data<coordinate_type> segment_type;
-
+
directed_line_segment_set_data<coordinate_type> segments;
{
std::ifstream input_file(SEGMENT_INPUT_FILE);
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