|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65994 - in sandbox/SOC/2010/sweepline: boost/sweepline boost/sweepline/detail libs/sweepline/example libs/sweepline/test/voronoi_segment
From: sydorchuk.andriy_at_[hidden]
Date: 2010-10-15 16:18:40
Author: asydorchuk
Date: 2010-10-15 16:18:19 EDT (Fri, 15 Oct 2010)
New Revision: 65994
URL: http://svn.boost.org/trac/boost/changeset/65994
Log:
Fixed visualizer.
Updated visualizer build scripts.
Text files modified:
sandbox/SOC/2010/sweepline/boost/sweepline/detail/voronoi_segment_formation.hpp | 73 ------------------------------
sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_builder.hpp | 5 -
sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_output.hpp | 82 ++++++++++++++++++++++++++++++++--
sandbox/SOC/2010/sweepline/libs/sweepline/example/Jamfile.v2 | 10 ---
sandbox/SOC/2010/sweepline/libs/sweepline/example/voronoi_visualizer.cpp | 95 +++++++++++++++++++++------------------
sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_queue_test.cpp | 6 +-
sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_types_test.cpp | 8 +-
sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_node_comparer_test.cpp | 30 ++++++------
sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_voronoi_benchmark_test.cpp | 6 +-
9 files changed, 156 insertions(+), 159 deletions(-)
Modified: sandbox/SOC/2010/sweepline/boost/sweepline/detail/voronoi_segment_formation.hpp
==============================================================================
--- sandbox/SOC/2010/sweepline/boost/sweepline/detail/voronoi_segment_formation.hpp (original)
+++ sandbox/SOC/2010/sweepline/boost/sweepline/detail/voronoi_segment_formation.hpp 2010-10-15 16:18:19 EDT (Fri, 15 Oct 2010)
@@ -22,8 +22,6 @@
if ((val) >= 0) first_expr += (val); \
else second_expr -= (val);
-#define INV_LOG_2 1.4426950408889634
-
namespace boost {
namespace sweepline {
namespace detail {
@@ -543,76 +541,6 @@
}
}
- template<typename T>
- double get_point_projection(point_2d<T> point, point_2d<T> segment_start,
- point_2d<T> segment_end) {
- double segment_vec_x = static_cast<double>(segment_end.x()) -
- static_cast<double>(segment_start.x());
- double segment_vec_y = static_cast<double>(segment_end.y()) -
- static_cast<double>(segment_start.y());
- double point_vec_x = static_cast<double>(point.x()) -
- static_cast<double>(segment_start.x());
- double point_vec_y = static_cast<double>(point.y()) -
- static_cast<double>(segment_start.y());
- double sqr_segment_length = segment_vec_x * segment_vec_x +
- segment_vec_y * segment_vec_y;
- double vec_dot = segment_vec_x * point_vec_x +
- segment_vec_y * point_vec_y;
- return vec_dot / sqr_segment_length;
- }
-
- template<typename T>
- int get_intermediate_points_count(point_2d<T> point1, point_2d<T> point2) {
- double vec_x = static_cast<double>(point1.x()) - static_cast<double>(point2.x());
- double vec_y = static_cast<double>(point1.y()) - static_cast<double>(point2.y());
- double sqr_len = vec_x * vec_x + vec_y * vec_y;
- return static_cast<int>(log(sqr_len) * INV_LOG_2 * 2 + 1E-6);
- }
-
- template<typename T>
- void fill_intermediate_points(point_2d<T> point_site, point_2d<T> segment_site_start,
- point_2d<T> segment_site_end, std::vector< point_2d<T> > &intermediate_points) {
- int num_inter_points = get_intermediate_points_count(
- intermediate_points[0], intermediate_points[1]);
- if (num_inter_points <= 0 ||
- orientation_test(point_site, segment_site_start, segment_site_end) == COLINEAR) {
- return;
- }
- intermediate_points.reserve(2 + num_inter_points);
- double segm_vec_x = static_cast<double>(segment_site_end.x()) -
- static_cast<double>(segment_site_start.x());
- double segm_vec_y = static_cast<double>(segment_site_end.y()) -
- static_cast<double>(segment_site_start.y());
- double sqr_segment_length = segm_vec_x * segm_vec_x + segm_vec_y * segm_vec_y;
- double projection_start =
- get_point_projection(intermediate_points[0], segment_site_start, segment_site_end);
- double projection_end =
- get_point_projection(intermediate_points[1], segment_site_start, segment_site_end);
- double step = (projection_end - projection_start) *
- sqr_segment_length / (num_inter_points + 1);
- double point_vec_x = static_cast<double>(point_site.x()) -
- static_cast<double>(segment_site_start.x());
- double point_vec_y = static_cast<double>(point_site.y()) -
- static_cast<double>(segment_site_start.y());
- double point_rot_x = segm_vec_x * point_vec_x + segm_vec_y * point_vec_y;
- double point_rot_y = segm_vec_x * point_vec_y - segm_vec_y * point_vec_x;
- double projection_cur_x = projection_start * sqr_segment_length + step;
- point_2d<T> last_point = intermediate_points.back();
- intermediate_points.pop_back();
- for (int i = 0; i < num_inter_points; i++, projection_cur_x += step) {
- double inter_rot_x = projection_cur_x;
- double inter_rot_y =
- ((inter_rot_x - point_rot_x) * (inter_rot_x - point_rot_x) +
- point_rot_y * point_rot_y) / (2.0 * point_rot_y);
- double new_point_x = (segm_vec_x * inter_rot_x - segm_vec_y * inter_rot_y) /
- sqr_segment_length + static_cast<double>(segment_site_start.x());
- double new_point_y = (segm_vec_x * inter_rot_y + segm_vec_y * inter_rot_x) /
- sqr_segment_length + static_cast<double>(segment_site_start.y());
- intermediate_points.push_back(make_point_2d(new_point_x, new_point_y));
- }
- intermediate_points.push_back(last_point);
- }
-
enum kPredicateResult {
LESS = -1,
UNDEFINED = 0,
@@ -1588,7 +1516,6 @@
}
edge_type *insert_new_edge(const site_event_type &site1,
- const site_event_type &site2,
const site_event_type &site3,
const circle_event_type &circle,
edge_type *edge12,
Modified: sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_builder.hpp
==============================================================================
--- sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_builder.hpp (original)
+++ sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_builder.hpp 2010-10-15 16:18:19 EDT (Fri, 15 Oct 2010)
@@ -288,8 +288,7 @@
beach_line_iterator it_first = circle_event.get_bisector();
beach_line_iterator it_last = it_first;
- // Get the second and the third sites that create given circle event.
- site_event_type site2 = it_first->first.get_left_site();
+ // Get the the third site.
site_event_type site3 = it_first->first.get_right_site();
// Get second bisector;
@@ -316,7 +315,7 @@
if (site3.is_segment() && site3.get_point1(true) == site1.get_point0(true)) {
const_cast<Key &>(it_first->first).set_right_site_inverse();
}
- it_first->second.edge = output_.insert_new_edge(site1, site2, site3, circle_event,
+ it_first->second.edge = output_.insert_new_edge(site1, site3, circle_event,
bisector1, bisector2);
beach_line_.erase(it_last);
it_last = it_first;
Modified: sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_output.hpp
==============================================================================
--- sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_output.hpp (original)
+++ sandbox/SOC/2010/sweepline/boost/sweepline/voronoi_segment_output.hpp 2010-10-15 16:18:19 EDT (Fri, 15 Oct 2010)
@@ -195,6 +195,52 @@
return fT0_used && fT1_used;
}
+
+ static void fill_intermediate_points(point_2d<coordinate_type> point_site,
+ point_2d<coordinate_type> segment_site_start,
+ point_2d<coordinate_type> segment_site_end,
+ std::vector< point_2d<double> > &intermediate_points) {
+ int num_inter_points = get_intermediate_points_count(
+ intermediate_points[0], intermediate_points[1]);
+ if (num_inter_points <= 0 ||
+ point_site == segment_site_start ||
+ point_site == segment_site_end) {
+ return;
+ }
+ intermediate_points.reserve(2 + num_inter_points);
+ double segm_vec_x = static_cast<double>(segment_site_end.x()) -
+ static_cast<double>(segment_site_start.x());
+ double segm_vec_y = static_cast<double>(segment_site_end.y()) -
+ static_cast<double>(segment_site_start.y());
+ double sqr_segment_length = segm_vec_x * segm_vec_x + segm_vec_y * segm_vec_y;
+ double projection_start =
+ get_point_projection(intermediate_points[0], segment_site_start, segment_site_end);
+ double projection_end =
+ get_point_projection(intermediate_points[1], segment_site_start, segment_site_end);
+ double step = (projection_end - projection_start) *
+ sqr_segment_length / (num_inter_points + 1);
+ double point_vec_x = static_cast<double>(point_site.x()) -
+ static_cast<double>(segment_site_start.x());
+ double point_vec_y = static_cast<double>(point_site.y()) -
+ static_cast<double>(segment_site_start.y());
+ double point_rot_x = segm_vec_x * point_vec_x + segm_vec_y * point_vec_y;
+ double point_rot_y = segm_vec_x * point_vec_y - segm_vec_y * point_vec_x;
+ double projection_cur_x = projection_start * sqr_segment_length + step;
+ point_2d<T> last_point = intermediate_points.back();
+ intermediate_points.pop_back();
+ for (int i = 0; i < num_inter_points; i++, projection_cur_x += step) {
+ double inter_rot_x = projection_cur_x;
+ double inter_rot_y =
+ ((inter_rot_x - point_rot_x) * (inter_rot_x - point_rot_x) +
+ point_rot_y * point_rot_y) / (2.0 * point_rot_y);
+ double new_point_x = (segm_vec_x * inter_rot_x - segm_vec_y * inter_rot_y) /
+ sqr_segment_length + static_cast<double>(segment_site_start.x());
+ double new_point_y = (segm_vec_x * inter_rot_y + segm_vec_y * inter_rot_x) /
+ sqr_segment_length + static_cast<double>(segment_site_start.y());
+ intermediate_points.push_back(make_point_2d(new_point_x, new_point_y));
+ }
+ intermediate_points.push_back(last_point);
+ }
private:
Helper();
@@ -237,6 +283,32 @@
}
return false;
}
+
+ static double get_point_projection(point_2d<coordinate_type> point,
+ point_2d<coordinate_type> segment_start,
+ point_2d<coordinate_type> segment_end) {
+ double segment_vec_x = static_cast<double>(segment_end.x()) -
+ static_cast<double>(segment_start.x());
+ double segment_vec_y = static_cast<double>(segment_end.y()) -
+ static_cast<double>(segment_start.y());
+ double point_vec_x = static_cast<double>(point.x()) -
+ static_cast<double>(segment_start.x());
+ double point_vec_y = static_cast<double>(point.y()) -
+ static_cast<double>(segment_start.y());
+ double sqr_segment_length = segment_vec_x * segment_vec_x +
+ segment_vec_y * segment_vec_y;
+ double vec_dot = segment_vec_x * point_vec_x +
+ segment_vec_y * point_vec_y;
+ return vec_dot / sqr_segment_length;
+ }
+
+ static int get_intermediate_points_count(point_2d<coordinate_type> point1,
+ point_2d<coordinate_type> point2) {
+ double vec_x = static_cast<double>(point1.x()) - static_cast<double>(point2.x());
+ double vec_y = static_cast<double>(point1.y()) - static_cast<double>(point2.y());
+ double sqr_len = vec_x * vec_x + vec_y * vec_y;
+ return static_cast<int>(log(sqr_len) * 3.4 + 1E-6);
+ }
};
template <typename T>
@@ -253,8 +325,8 @@
voronoi_cell_clipped(const site_event_type &new_site,
voronoi_edge_clipped<coordinate_type>* edge) :
incident_edge(edge),
- site(new_site),
- num_incident_edges(0) {}
+ num_incident_edges(0),
+ site(new_site) {}
bool is_segment() const {
return site.is_segment();
@@ -354,7 +426,7 @@
if (start_point != NULL && end_point != NULL) {
edge_points.push_back(start_point->vertex);
edge_points.push_back(end_point->vertex);
- fill_intermediate_points(point1, point2, point3, edge_points);
+ Helper<T>::fill_intermediate_points(point1, point2, point3, edge_points);
} else {
coordinate_type dir_x = (cell1->is_segment() ^ (point1 == point3)) ?
point3.y() - point2.y() : point2.y() - point3.y();
@@ -381,12 +453,12 @@
typedef detail::site_event<T> site_event_type;
typedef voronoi_cell_clipped<coordinate_type> voronoi_cell_type;
- typedef std::list<voronoi_cell_type> voronoi_cells_type;
+ typedef std::list<voronoi_cell_type> voronoi_cells_type;
typedef typename voronoi_cells_type::iterator voronoi_cell_iterator_type;
typedef typename voronoi_cells_type::const_iterator voronoi_cell_const_iterator_type;
typedef voronoi_vertex_clipped<coordinate_type> voronoi_vertex_type;
- typedef std::list<voronoi_vertex_type> voronoi_vertices_type;
+ typedef std::list<voronoi_vertex_type> voronoi_vertices_type;
typedef typename voronoi_vertices_type::iterator voronoi_vertex_iterator_type;
typedef typename voronoi_vertices_type::const_iterator voronoi_vertex_const_iterator_type;
Modified: sandbox/SOC/2010/sweepline/libs/sweepline/example/Jamfile.v2
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/example/Jamfile.v2 (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/example/Jamfile.v2 2010-10-15 16:18:19 EDT (Fri, 15 Oct 2010)
@@ -5,13 +5,7 @@
import cast ;
-lib opengl : : <name>opengl32 ;
-lib glu : : <name>glu32 ;
exe voronoi_visualizer : voronoi_visualizer.cpp
- [ cast _ moccable-cpp : voronoi_visualizer.cpp ]
- /qt//QtCore
- /qt//QtGui
+ [ cast _ moccable-cpp : voronoi_visualizer.cpp ]
/qt//QtOpenGL
- opengl
- glu
- ;
\ No newline at end of file
+ ;
Modified: sandbox/SOC/2010/sweepline/libs/sweepline/example/voronoi_visualizer.cpp
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/example/voronoi_visualizer.cpp (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/example/voronoi_visualizer.cpp 2010-10-15 16:18:19 EDT (Fri, 15 Oct 2010)
@@ -16,7 +16,9 @@
class GLWidget : public QGLWidget {
Q_OBJECT
public:
- GLWidget(QMainWindow *parent = NULL) : QGLWidget(QGLFormat(QGL::SampleBuffers), parent) {}
+ GLWidget(QMainWindow *parent = NULL) : QGLWidget(QGLFormat(QGL::SampleBuffers), parent) {
+ startTimer(40);
+ }
QSize sizeHint() const {
return QSize(600, 600);
@@ -58,7 +60,6 @@
// Update view.
update_view_port();
- updateGL();
}
protected:
@@ -71,52 +72,52 @@
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Draw voronoi sites.
- {
- voronoi_cells_type cells = voronoi_output_.cell_records;
- voronoi_cell_const_iterator_type it;
- glColor3f(0.0f, 0.0f, 1.0f);
- glBegin(GL_POINTS);
- for (it = cells.begin(); it != cells.end(); it++) {
- if (!it->is_segment())
- glVertex2f(it->get_point0().x(), it->get_point0().y());
- }
- glEnd();
- glBegin(GL_LINES);
- for (it = cells.begin(); it != cells.end(); it++) {
- if (it->is_segment()) {
- glVertex2f(it->get_point0().x(), it->get_point0().y());
- glVertex2f(it->get_point1().x(), it->get_point1().y());
- }
- }
- glEnd();
- }
+ {
+ voronoi_cells_type cells = voronoi_output_.cell_records;
+ voronoi_cell_const_iterator_type it;
+ glColor3f(0.0f, 0.0f, 1.0f);
+ glBegin(GL_POINTS);
+ for (it = cells.begin(); it != cells.end(); it++) {
+ if (!it->is_segment())
+ glVertex2f(it->get_point0().x(), it->get_point0().y());
+ }
+ glEnd();
+ glBegin(GL_LINES);
+ for (it = cells.begin(); it != cells.end(); it++) {
+ if (it->is_segment()) {
+ glVertex2f(it->get_point0().x(), it->get_point0().y());
+ glVertex2f(it->get_point1().x(), it->get_point1().y());
+ }
+ }
+ glEnd();
+ }
// Draw voronoi vertices.
- {
- voronoi_vertices_type vertices = voronoi_output_.vertex_records;
- voronoi_vertex_const_iterator_type it;
- glColor3f(0.0f, 1.0f, 0.0f);
- glBegin(GL_POINTS);
- for (it = vertices.begin(); it != vertices.end(); it++)
- glVertex2f(it->vertex.x(), it->vertex.y());
- glEnd();
- }
+ {
+ voronoi_vertices_type vertices = voronoi_output_.vertex_records;
+ voronoi_vertex_const_iterator_type it;
+ glColor3f(0.0f, 1.0f, 0.0f);
+ glBegin(GL_POINTS);
+ for (it = vertices.begin(); it != vertices.end(); it++)
+ glVertex2f(it->vertex.x(), it->vertex.y());
+ glEnd();
+ }
// Draw voronoi edges.
- {
- voronoi_edges_type edges = voronoi_output_.edge_records;
- voronoi_edge_const_iterator_type it;
- glColor3f(0.0f, 1.0f, 0.0f);
- glBegin(GL_LINES);
- for (it = edges.begin(); it != edges.end(); it++) {
- std::vector<Point2D> temp_v = it->get_intermediate_points(brect_);
- for (int i = 0; i < static_cast<int>(temp_v.size()) - 1; i++) {
- glVertex2f(temp_v[i].x(), temp_v[i].y());
- glVertex2f(temp_v[i+1].x(), temp_v[i+1].y());
- }
- }
- glEnd();
- }
+ {
+ voronoi_edges_type edges = voronoi_output_.edge_records;
+ voronoi_edge_const_iterator_type it;
+ glColor3f(0.0f, 1.0f, 0.0f);
+ glBegin(GL_LINES);
+ for (it = edges.begin(); it != edges.end(); it++) {
+ std::vector<Point2D> temp_v = it->get_intermediate_points(brect_);
+ for (int i = 0; i < static_cast<int>(temp_v.size()) - 1; i++) {
+ glVertex2f(temp_v[i].x(), temp_v[i].y());
+ glVertex2f(temp_v[i+1].x(), temp_v[i+1].y());
+ }
+ }
+ glEnd();
+ }
}
void resizeGL(int width, int height) {
@@ -124,6 +125,10 @@
glViewport((width - side) / 2, (height - side) / 2, side, side);
}
+ void timerEvent(QTimerEvent *) {
+ update();
+ }
+
private:
void update_view_port() {
glMatrixMode(GL_PROJECTION);
@@ -235,4 +240,4 @@
return app.exec();
}
-#include "voronoi_visualizer.moc"
\ No newline at end of file
+#include "voronoi_visualizer.moc"
Modified: sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_queue_test.cpp
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_queue_test.cpp (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_queue_test.cpp 2010-10-15 16:18:19 EDT (Fri, 15 Oct 2010)
@@ -1,4 +1,4 @@
-// Boost sweepline library segment_event_queue_test.cpp file
+// Boost sweepline library segment_event_queue_test.cpp file
// Copyright Andrii Sydorchuk 2010.
// Distributed under the Boost Software License, Version 1.0.
@@ -23,7 +23,7 @@
BOOST_AUTO_TEST_CASE_TEMPLATE(event_queue_test1, T, test_types) {
detail::circle_events_queue<T> event_q;
BOOST_CHECK_EQUAL(event_q.empty(), true);
-
+
event_q.reset();
for (int i = 0; i < 10; i++) {
T x = static_cast<T>(-i);
@@ -42,7 +42,7 @@
BOOST_AUTO_TEST_CASE_TEMPLATE(event_queue_test2, T, test_types) {
typedef detail::circle_event<T> circle_event_type;
detail::circle_events_queue<T> event_q;
- detail::site_event<T> temp_site =
+ detail::site_event<T> temp_site =
detail::make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0);
for (int i = 0; i < 10; i++) {
Modified: sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_types_test.cpp
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_types_test.cpp (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_event_types_test.cpp 2010-10-15 16:18:19 EDT (Fri, 15 Oct 2010)
@@ -1,4 +1,4 @@
-// Boost sweepline library segment_event_types_test.cpp file
+// Boost sweepline library segment_event_types_test.cpp file
// Copyright Andrii Sydorchuk 2010.
// Distributed under the Boost Software License, Version 1.0.
@@ -81,7 +81,7 @@
site_event<T> site2 = make_site_event<T>(point1, 0);
BOOST_CHECK_EQUAL(site2.is_segment(), false);
BOOST_CHECK_EQUAL(site2.is_vertical(), true);
-
+
bool arr1_1[] = { true, false, true, false, false, true };
bool arr1_2[] = { false , true, false, true, false, true };
EVENT_TYPES_CHECK_COMPARISON(site1, site2, arr1_1);
@@ -165,7 +165,7 @@
static_cast<T>(3));
site_event<T> temp_site = make_site_event<T>(static_cast<T>(0), static_cast<T>(0),0);
circle_event<T> circle2;
-
+
BOOST_CHECK_EQUAL(circle1.x(), static_cast<T>(1));
BOOST_CHECK_EQUAL(circle1.y(), static_cast<T>(2));
BOOST_CHECK_EQUAL(circle1.get_lower_x(), static_cast<T>(3));
@@ -205,7 +205,7 @@
site = make_site_event<T>(static_cast<T>(3), static_cast<T>(2), 0);
BOOST_CHECK_EQUAL(circle.compare(site), 0);
-
+
site = make_site_event<T>(static_cast<T>(3), static_cast<T>(3), 0);
BOOST_CHECK_EQUAL(circle.compare(site), -1);
Modified: sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_node_comparer_test.cpp
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_node_comparer_test.cpp (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_node_comparer_test.cpp 2010-10-15 16:18:19 EDT (Fri, 15 Oct 2010)
@@ -1,4 +1,4 @@
-// Boost sweepline library segment_node_comparer_test.cpp file
+// Boost sweepline library segment_node_comparer_test.cpp file
// Copyright Andrii Sydorchuk 2010.
// Distributed under the Boost Software License, Version 1.0.
@@ -16,9 +16,9 @@
#include <boost/test/test_case_template.hpp>
BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test_pp1, T, test_types) {
- typedef site_event<T> site_event_type;
+ typedef site_event<T> site_event_type;
typedef beach_line_node<T> bline_node;
- typedef typename std::map< bline_node, int,
+ typedef typename std::map< bline_node, int,
node_comparer<bline_node> >::const_iterator bline_it;
std::map< bline_node, int, node_comparer<bline_node> > test_beach_line;
@@ -33,7 +33,7 @@
bline_node node2(site3, site1);
test_beach_line.insert(std::pair<bline_node, int>(node1, 0));
test_beach_line.insert(std::pair<bline_node, int>(node2, 1));
-
+
int cur_value = 0;
for (bline_it it = test_beach_line.begin();
it != test_beach_line.end();
@@ -42,9 +42,9 @@
}
BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test_pp2, T, test_types) {
- typedef site_event<T> site_event_type;
+ typedef site_event<T> site_event_type;
typedef beach_line_node<T> bline_node;
- typedef typename std::map< bline_node, int,
+ typedef typename std::map< bline_node, int,
node_comparer<bline_node> >::const_iterator bline_it;
std::map< bline_node, int, node_comparer<bline_node> > test_beach_line;
@@ -77,7 +77,7 @@
bline_node initial_node(
make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 0),
make_site_event<T>(static_cast<T>(0), static_cast<T>(2), 1));
-
+
bline_node new_node1(make_site_event<T>(static_cast<T>(2), static_cast<T>(-10), 2));
bline_node new_node2(make_site_event<T>(static_cast<T>(2), static_cast<T>(-1), 3));
bline_node new_node3(make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 4));
@@ -110,7 +110,7 @@
bline_node initial_node(
make_site_event<T>(static_cast<T>(0), static_cast<T>(1), 0),
make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 1));
-
+
bline_node new_node1(make_site_event<T>(static_cast<T>(2), static_cast<T>(-3), 2));
bline_node new_node2(make_site_event<T>(static_cast<T>(2), static_cast<T>(-2), 2));
bline_node new_node3(make_site_event<T>(static_cast<T>(2), static_cast<T>(-1), 2));
@@ -141,7 +141,7 @@
bline_node initial_node(
make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0),
make_site_event<T>(static_cast<T>(1), static_cast<T>(2), 1));
-
+
bline_node new_node1(make_site_event<T>(static_cast<T>(2), static_cast<T>(-10), 2));
bline_node new_node2(make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 3));
bline_node new_node3(make_site_event<T>(static_cast<T>(2), static_cast<T>(1), 4));
@@ -174,7 +174,7 @@
bline_node initial_node(
make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 0),
make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 1));
-
+
bline_node new_node1(make_site_event<T>(static_cast<T>(2), static_cast<T>(-3), 2));
bline_node new_node2(make_site_event<T>(static_cast<T>(2), static_cast<T>(-2), 3));
bline_node new_node3(make_site_event<T>(static_cast<T>(2), static_cast<T>(0), 4));
@@ -208,11 +208,11 @@
bline_node initial_node(
make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0),
make_site_event<T>(static_cast<T>(0), static_cast<T>(2), 1));
-
+
bline_node new_node1(make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 2));
bline_node new_node2(make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 3));
bline_node new_node3(make_site_event<T>(static_cast<T>(1), static_cast<T>(2), 4));
-
+
BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), false);
BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node3), true);
@@ -230,14 +230,14 @@
bline_node initial_node(
make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0),
make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 1));
-
+
bline_node new_node1(make_site_event<T>(static_cast<T>(1), static_cast<T>(0), 2));
bline_node new_node2(make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 1));
bline_node new_node3(make_site_event<T>(static_cast<T>(1), static_cast<T>(2), 3));
bline_node new_node4(
make_site_event<T>(static_cast<T>(1), static_cast<T>(1), 1),
make_site_event<T>(static_cast<T>(0), static_cast<T>(0), 0));
-
+
BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node1), false);
BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node2), true);
BOOST_CHECK_EQUAL(node_comparer_test(initial_node, new_node3), true);
@@ -250,7 +250,7 @@
}
BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test_ps1, T, test_types) {
- // TODO(asydorchuk): add more tests there.
+ // TODO(asydorchuk): add more tests there.
}
BOOST_AUTO_TEST_CASE_TEMPLATE(node_comparer_test_ss1, T, test_types) {
Modified: sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_voronoi_benchmark_test.cpp
==============================================================================
--- sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_voronoi_benchmark_test.cpp (original)
+++ sandbox/SOC/2010/sweepline/libs/sweepline/test/voronoi_segment/segment_voronoi_benchmark_test.cpp 2010-10-15 16:18:19 EDT (Fri, 15 Oct 2010)
@@ -1,4 +1,4 @@
-// Boost sweepline library segment_voronoi_benchmark_test.cpp file
+// Boost sweepline library segment_voronoi_benchmark_test.cpp file
// Copyright Andrii Sydorchuk 2010.
// Distributed under the Boost Software License, Version 1.0.
@@ -28,7 +28,7 @@
FILE *bench_file = fopen("benchmark.txt", "a");
fprintf(bench_file, "Voronoi Segment Sweepline Benchmark Test (time in seconds):\n");
-
+
for (int num_points = 10; num_points <= 1000000; num_points *= 10) {
std::vector< point_2d<coordinate_type> > points;
points.reserve(num_points);
@@ -51,7 +51,7 @@
time_t end_time = time(NULL);
double running_time = static_cast<double>(end_time - start_time) / num_times;
- fprintf(bench_file,
+ fprintf(bench_file,
"Number of points = %8d; Overall time = %2d; Time per one input = %9.6f.\n",
num_points, static_cast<int>(end_time - start_time), running_time);
}
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