$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r77595 - in sandbox/gtl: boost/polygon/detail libs/polygon/voronoi_example
From: sydorchuk.andriy_at_[hidden]
Date: 2012-03-27 16:31:01
Author: asydorchuk
Date: 2012-03-27 16:31:00 EDT (Tue, 27 Mar 2012)
New Revision: 77595
URL: http://svn.boost.org/trac/boost/changeset/77595
Log:
Adding source file for the voronoi advanced tutorial.
Added:
   sandbox/gtl/libs/polygon/voronoi_example/voronoi_advanced_tutorial.cpp   (contents, props changed)
Text files modified: 
   sandbox/gtl/boost/polygon/detail/voronoi_ctypes.hpp             |     3 +--                                     
   sandbox/gtl/boost/polygon/detail/voronoi_predicates.hpp         |     4 ++--                                    
   sandbox/gtl/libs/polygon/voronoi_example/voronoi_visualizer.cpp |     1 -                                       
   3 files changed, 3 insertions(+), 5 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-03-27 16:31:00 EDT (Tue, 27 Mar 2012)
@@ -11,7 +11,7 @@
 #define BOOST_POLYGON_DETAIL_VORONOI_CTYPES
 
 #include <cmath>
-#include <memory.h>
+#include <cstring>
 
 #include <boost/cstdint.hpp>
 
@@ -705,7 +705,6 @@
   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-03-27 16:31:00 EDT (Tue, 27 Mar 2012)
@@ -32,8 +32,8 @@
   typedef typename CTYPE_TRAITS::to_efpt_converter_type to_efpt_converter;
 
   enum {
-    ULPS = CTYPE_TRAITS::ULPS,
-    ULPSx2 = ULPS * 2
+    ULPS = 64,
+    ULPSx2 = 128
   };
 
   template <typename Point>
Added: sandbox/gtl/libs/polygon/voronoi_example/voronoi_advanced_tutorial.cpp
==============================================================================
--- (empty file)
+++ sandbox/gtl/libs/polygon/voronoi_example/voronoi_advanced_tutorial.cpp	2012-03-27 16:31:00 EDT (Tue, 27 Mar 2012)
@@ -0,0 +1,84 @@
+// Boost.Polygon library voronoi_advanced_tutorial.cpp file
+
+//          Copyright Andrii Sydorchuk 2010-2012.
+// Distributed under the Boost Software License, Version 1.0.
+//    (See accompanying file LICENSE_1_0.txt or copy at
+//          http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <cmath>
+
+// This will work properly only with GCC compiler.
+#include <ieee754.h>
+typedef long double fpt80;
+
+#include "boost/polygon/voronoi.hpp"
+using namespace boost::polygon;
+
+struct my_ulp_comparison {
+  int operator()(fpt80 a, fpt80 b, unsigned int maxUlps) const {
+    if (a == b)
+      return 0;
+    if (a > b)
+      return -operator()(b, a, maxUlps);
+    ieee854_long_double lhs, rhs;
+    lhs.d = a;
+    rhs.d = b;
+    if (lhs.ieee.negative ^ rhs.ieee.negative)
+      return lhs.ieee.negative ? -1 : 1;
+    boost::uint64_t le = lhs.ieee.exponent; le = (le << 32) + lhs.ieee.mantissa0;
+    boost::uint64_t re = rhs.ieee.exponent; re = (re << 32) + rhs.ieee.mantissa0;
+    if (lhs.ieee.negative) {
+      if (le - 1 > re)
+        return -1;
+      le = (le == re) ? 0 : 1; le = (le << 32) + lhs.ieee.mantissa1;
+      re = rhs.ieee.mantissa1;
+      return (re + maxUlps < le) ? -1 : 0;
+    } else {
+      if (le + 1 < re)
+        return -1;
+      le = lhs.ieee.mantissa0;
+      re = (le == re) ? 0 : 1; re = (re << 32) + rhs.ieee.mantissa1;
+      return (le + maxUlps < re) ? -1 : 0;
+    }
+  }
+};
+
+struct my_fpt_converter {
+  template <typename T>
+  fpt80 operator()(const T& that) const {
+    return static_cast<fpt80>(that);
+  }
+
+  template <size_t N>
+  fpt80 operator()(const detail::extended_int<N>& that) const {
+    fpt80 result = 0.0;
+    for (int i = 1; i <= (std::min)(3u, that.size()); ++i) {
+      if (i != 1)
+        result *= static_cast<fpt80>(0x100000000ULL);
+      result += that.chunks[that.size() - i];
+    }
+    return (that.count < 0) ? -result : result;
+  }
+};
+
+// Voronoi ctype traits for 43-bit signed integer input coordinates.
+struct my_voronoi_ctype_traits {
+  typedef boost::int64_t int_type;
+  typedef detail::extended_int<3> int_x2_type;
+  typedef detail::extended_int<3> uint_x2_type;
+  typedef detail::extended_int<128> big_int_type;
+  typedef fpt80 fpt_type;
+  typedef fpt80 efpt_type;
+  typedef my_ulp_comparison ulp_cmp_type;
+  typedef my_fpt_converter to_fpt_converter_type;
+  typedef my_fpt_converter to_efpt_converter_type;
+};
+
+int main () {
+  voronoi_diagram<fpt80> vd;
+  voronoi_builder<boost::int64_t, my_voronoi_ctype_traits> vb;
+  vb.construct(&vd);
+  return 0;
+}
Modified: sandbox/gtl/libs/polygon/voronoi_example/voronoi_visualizer.cpp
==============================================================================
--- sandbox/gtl/libs/polygon/voronoi_example/voronoi_visualizer.cpp	(original)
+++ sandbox/gtl/libs/polygon/voronoi_example/voronoi_visualizer.cpp	2012-03-27 16:31:00 EDT (Tue, 27 Mar 2012)
@@ -7,7 +7,6 @@
 
 // See http://www.boost.org for updates, documentation, and revision history.
 
-#include <iostream>
 #include <vector>
 
 #include <QtOpenGL/QGLWidget>