|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77366 - sandbox/gtl/boost/polygon
From: sydorchuk.andriy_at_[hidden]
Date: 2012-03-18 07:34:04
Author: asydorchuk
Date: 2012-03-18 07:34:03 EDT (Sun, 18 Mar 2012)
New Revision: 77366
URL: http://svn.boost.org/trac/boost/changeset/77366
Log:
Minor speed up of voronoi utils.
Text files modified:
sandbox/gtl/boost/polygon/voronoi_diagram.hpp | 20 +++++++++-----------
sandbox/gtl/boost/polygon/voronoi_utils.hpp | 11 ++++-------
2 files changed, 13 insertions(+), 18 deletions(-)
Modified: sandbox/gtl/boost/polygon/voronoi_diagram.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/voronoi_diagram.hpp (original)
+++ sandbox/gtl/boost/polygon/voronoi_diagram.hpp 2012-03-18 07:34:03 EDT (Sun, 18 Mar 2012)
@@ -207,17 +207,15 @@
// Return false if edge goes through the endpoint of the segment.
// Return true else.
bool is_primary() const {
- voronoi_cell_type *cell1 = cell_;
- voronoi_cell_type *cell2 = twin_->cell();
- if (cell1->contains_segment() && !cell2->contains_segment()) {
- if (cell1->point0() == cell2->point0() ||
- cell1->point1() == cell2->point0())
- return false;
- }
- if (cell2->contains_segment() && !cell1->contains_segment()) {
- if (cell2->point0() == cell1->point0() ||
- cell2->point1() == cell1->point0())
- return false;
+ bool flag1 = cell_->contains_segment();
+ bool flag2 = twin_->cell()->contains_segment();
+ if (flag1 && !flag2) {
+ return cell_->point0() != twin_->cell()->point0() &&
+ cell_->point1() != twin_->cell()->point0();
+ }
+ if (!flag1 && flag2) {
+ return twin_->cell()->point0() != cell_->point0() &&
+ twin_->cell()->point1() != cell_->point0();
}
return true;
}
Modified: sandbox/gtl/boost/polygon/voronoi_utils.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/voronoi_utils.hpp (original)
+++ sandbox/gtl/boost/polygon/voronoi_utils.hpp 2012-03-18 07:34:03 EDT (Sun, 18 Mar 2012)
@@ -143,7 +143,6 @@
// Retrieve the cell to the left of the current edge.
const typename voronoi_edge<CT>::voronoi_cell_type *cell1 = edge.cell();
-
// Retrieve the cell to the right of the current edge.
const typename voronoi_edge<CT>::voronoi_cell_type *cell2 =
edge.twin()->cell();
@@ -151,18 +150,16 @@
discretization.push_back(get_point(edge.vertex0()->vertex()));
discretization.push_back(get_point(edge.vertex1()->vertex()));
if (edge.is_curved()) {
+ bool flag = cell1->contains_segment();
// point1 - site point;
- point_type point1 = (cell1->contains_segment()) ?
+ point_type point1 = flag ?
get_point(cell2->point0()) : get_point(cell1->point0());
-
// point2 - start-point of the segment site;
- point_type point2 = (cell1->contains_segment()) ?
+ point_type point2 = flag ?
get_point(cell1->point0()) : get_point(cell2->point0());
-
// point3 - endpoint of the segment site;
- point_type point3 = (cell1->contains_segment()) ?
+ point_type point3 = flag ?
get_point(cell1->point1()) : get_point(cell2->point1());
-
fill_intermediate_points(
point1, point2, point3, max_error, discretization);
}
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