diff --git a/benchmark/voronoi_benchmark_segments.cpp b/benchmark/voronoi_benchmark_segments.cpp index 3964022..7dd777c 100644 --- a/benchmark/voronoi_benchmark_segments.cpp +++ b/benchmark/voronoi_benchmark_segments.cpp @@ -110,7 +110,6 @@ std::vector get_intersection_runtime() { } clean_segment_set(ssd); } - double time_per_test = timer.elapsed() / NUM_RUNS[i]; running_times.push_back(timer.elapsed()); } return running_times; diff --git a/example/Jamfile.v2 b/example/Jamfile.v2 index 30d52d2..9549dad 100644 --- a/example/Jamfile.v2 +++ b/example/Jamfile.v2 @@ -18,11 +18,11 @@ project voronoi_example exe voronoi-visualizer : - voronoi_visualizer.cpp - [ cast _ moccable-cpp : voronoi_visualizer.cpp ] - /qt//QtOpenGL + voronoi_visualizer.cpp + [ cast _ moccable-cpp : voronoi_visualizer.cpp ] + /qt//QtOpenGL : - windows:opengl + windows:opengl ; alias "basic-tutorial" diff --git a/example/voronoi_advanced_tutorial.cpp b/example/voronoi_advanced_tutorial.cpp index 5fdc2b5..96ad969 100644 --- a/example/voronoi_advanced_tutorial.cpp +++ b/example/voronoi_advanced_tutorial.cpp @@ -22,8 +22,7 @@ typedef long double fpt80; #include #include -using boost::polygon::voronoi_builder; -using boost::polygon::voronoi_diagram; +using namespace boost::polygon; struct my_ulp_comparison { enum Result { @@ -88,20 +87,13 @@ struct my_fpt_converter { // Voronoi diagram traits. struct my_voronoi_diagram_traits { typedef fpt80 coordinate_type; - typedef struct { - template - fpt80 operator()(const CT& that) const { - return static_cast(that); - } - } ctype_converter_type; - typedef detail::point_2d point_type; typedef voronoi_cell cell_type; typedef voronoi_vertex vertex_type; typedef voronoi_edge edge_type; - typedef struct { + typedef class { public: enum { ULPS = 128 }; - bool operator()(const point_type &v1, const point_type &v2) const { + bool operator()(const vertex_type &v1, const vertex_type &v2) const { return (ulp_cmp(v1.x(), v2.x(), ULPS) == my_ulp_comparison::EQUAL && ulp_cmp(v1.y(), v2.y(), ULPS) == my_ulp_comparison::EQUAL); } @@ -146,8 +138,8 @@ int main() { printf("Construction done in: %s seconds.\n", ftime.c_str()); printf("Resulting Voronoi graph has the following stats:\n"); - printf("Number of Voronoi cells: %d.\n", vd.num_cells()); - printf("Number of Voronoi vertices: %d.\n", vd.num_vertices()); - printf("Number of Voronoi edges: %d.\n", vd.num_edges()); + printf("Number of Voronoi cells: %lu.\n", vd.num_cells()); + printf("Number of Voronoi vertices: %lu.\n", vd.num_vertices()); + printf("Number of Voronoi edges: %lu.\n", vd.num_edges()); return 0; } diff --git a/example/voronoi_basic_tutorial.cpp b/example/voronoi_basic_tutorial.cpp index cb145a4..6565bbe 100644 --- a/example/voronoi_basic_tutorial.cpp +++ b/example/voronoi_basic_tutorial.cpp @@ -149,7 +149,7 @@ int main() { } for (voronoi_diagram::const_cell_iterator it = vd.cells().begin(); it != vd.cells().end(); ++it) { - printf("%d ", it->color()); + printf("%lu ", it->color()); } printf("\n"); printf("\n"); diff --git a/example/voronoi_visualizer.cpp b/example/voronoi_visualizer.cpp index 1ed9cd3..af7026f 100644 --- a/example/voronoi_visualizer.cpp +++ b/example/voronoi_visualizer.cpp @@ -14,9 +14,7 @@ #include #include -#include -#include -#include +#include #include using namespace boost::polygon; @@ -107,9 +105,9 @@ class GLWidget : public QGLWidget { private: typedef double coordinate_type; - typedef point_data point_type; - typedef segment_data segment_type; - typedef rectangle_data rect_type; + typedef point_data point_type; + typedef segment_data segment_type; + typedef rectangle_data rect_type; typedef voronoi_builder VB; typedef voronoi_diagram VD; typedef VD::cell_type cell_type; @@ -217,9 +215,11 @@ class GLWidget : public QGLWidget { glVertex2f(point.x(), point.y()); } for (std::size_t i = 0; i < segment_data_.size(); ++i) { - point_type lp = deconvolve(low(segment_data_[i]), shift_); - point_type hp = deconvolve(high(segment_data_[i]), shift_); + point_type lp = low(segment_data_[i]); + lp = deconvolve(lp, shift_); glVertex2f(lp.x(), lp.y()); + point_type hp = high(segment_data_[i]); + hp = deconvolve(hp, shift_); glVertex2f(hp.x(), hp.y()); } glEnd(); @@ -231,9 +231,11 @@ class GLWidget : public QGLWidget { glLineWidth(2.7f); glBegin(GL_LINES); for (std::size_t i = 0; i < segment_data_.size(); ++i) { - point_type lp = deconvolve(low(segment_data_[i]), shift_); - point_type hp = deconvolve(high(segment_data_[i]), shift_); + point_type lp = low(segment_data_[i]); + lp = deconvolve(lp, shift_); glVertex2f(lp.x(), lp.y()); + point_type hp = high(segment_data_[i]); + hp = deconvolve(hp, shift_); glVertex2f(hp.x(), hp.y()); } glEnd(); diff --git a/include/boost/polygon/detail/voronoi_ctypes.hpp b/include/boost/polygon/detail/voronoi_ctypes.hpp index b292b1e..63e42a9 100644 --- a/include/boost/polygon/detail/voronoi_ctypes.hpp +++ b/include/boost/polygon/detail/voronoi_ctypes.hpp @@ -266,7 +266,8 @@ class extended_int { this->count_ = -this->count_; } - extended_int(const extended_int& that) { + template + extended_int(const extended_int& that) { this->count_ = that.count(); std::memcpy(this->chunks_, that.chunks(), that.size() * sizeof(uint32)); } @@ -300,7 +301,8 @@ class extended_int { return *this; } - extended_int& operator=(const extended_int& that) { + template + extended_int& operator=(const extended_int& that) { this->count_ = that.count(); std::memcpy(this->chunks_, that.chunks(), that.size() * sizeof(uint32)); return *this;