|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r78372 - in trunk: boost/polygon boost/polygon/detail libs/polygon/test
From: sydorchuk.andriy_at_[hidden]
Date: 2012-05-07 15:40:36
Author: asydorchuk
Date: 2012-05-07 15:40:35 EDT (Mon, 07 May 2012)
New Revision: 78372
URL: http://svn.boost.org/trac/boost/changeset/78372
Log:
Polygon: Fixing trunk test targets.
Text files modified:
trunk/boost/polygon/detail/polygon_arbitrary_formation.hpp | 296 ++++++++++++++++++++--------------------
trunk/boost/polygon/detail/voronoi_ctypes.hpp | 12
trunk/boost/polygon/polygon_45_set_data.hpp | 176 +++++++++++-----------
trunk/boost/polygon/segment_concept.hpp | 47 -----
trunk/boost/polygon/voronoi_builder.hpp | 2
trunk/libs/polygon/test/gtl_boost_unit_test.cpp | 3
trunk/libs/polygon/test/polygon_segment_test.cpp | 28 ++-
7 files changed, 264 insertions(+), 300 deletions(-)
Modified: trunk/boost/polygon/detail/polygon_arbitrary_formation.hpp
==============================================================================
--- trunk/boost/polygon/detail/polygon_arbitrary_formation.hpp (original)
+++ trunk/boost/polygon/detail/polygon_arbitrary_formation.hpp 2012-05-07 15:40:35 EDT (Mon, 07 May 2012)
@@ -1,6 +1,6 @@
/*
Copyright 2008 Intel Corporation
-
+
Use, modification and distribution are subject to 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).
@@ -40,7 +40,7 @@
return lp(pt, pt2) && lp(pt1, pt);
return lp(pt, pt1) && lp(pt2, pt);
}
-
+
template <typename area_type>
static inline Unit compute_intercept(const area_type& dy2,
const area_type& dx1,
@@ -96,7 +96,7 @@
dy2 *= -1;
dx2 *= -1;
} else if(dx2 == 0) {
- //if the second slope is vertical the first is always less unless it is also vertical, in which case they are equal
+ //if the second slope is vertical the first is always less unless it is also vertical, in which case they are equal
return dx1 != 0;
}
typedef typename coordinate_traits<Unit>::unsigned_area_type unsigned_product_type;
@@ -173,9 +173,9 @@
return false;
}
- static inline Unit evalAtXforYlazy(Unit xIn, Point pt, Point other_pt) {
+ static inline Unit evalAtXforYlazy(Unit xIn, Point pt, Point other_pt) {
long double
- evalAtXforYret, evalAtXforYxIn, evalAtXforYx1, evalAtXforYy1, evalAtXforYdx1, evalAtXforYdx,
+ evalAtXforYret, evalAtXforYxIn, evalAtXforYx1, evalAtXforYy1, evalAtXforYdx1, evalAtXforYdx,
evalAtXforYdy, evalAtXforYx2, evalAtXforYy2, evalAtXforY0;
//y = (x - x1)dy/dx + y1
//y = (xIn - pt.x)*(other_pt.y-pt.y)/(other_pt.x-pt.x) + pt.y
@@ -190,16 +190,16 @@
if(evalAtXforYdx1 == evalAtXforY0) return (Unit)evalAtXforYy1;
evalAtXforYx2 = other_pt.get(HORIZONTAL);
evalAtXforYy2 = other_pt.get(VERTICAL);
-
+
evalAtXforYdx = evalAtXforYx2 - evalAtXforYx1;
evalAtXforYdy = evalAtXforYy2 - evalAtXforYy1;
evalAtXforYret = ((evalAtXforYdx1) * evalAtXforYdy / evalAtXforYdx + evalAtXforYy1);
return (Unit)evalAtXforYret;
}
- static inline typename high_precision_type<Unit>::type evalAtXforY(Unit xIn, Point pt, Point other_pt) {
+ static inline typename high_precision_type<Unit>::type evalAtXforY(Unit xIn, Point pt, Point other_pt) {
typename high_precision_type<Unit>::type
- evalAtXforYret, evalAtXforYxIn, evalAtXforYx1, evalAtXforYy1, evalAtXforYdx1, evalAtXforYdx,
+ evalAtXforYret, evalAtXforYxIn, evalAtXforYx1, evalAtXforYy1, evalAtXforYdx1, evalAtXforYdx,
evalAtXforYdy, evalAtXforYx2, evalAtXforYy2, evalAtXforY0;
//y = (x - x1)dy/dx + y1
//y = (xIn - pt.x)*(other_pt.y-pt.y)/(other_pt.x-pt.x) + pt.y
@@ -215,18 +215,18 @@
if(evalAtXforYdx1 == evalAtXforY0) return evalAtXforYret = evalAtXforYy1;
evalAtXforYx2 = (high_precision)other_pt.get(HORIZONTAL);
evalAtXforYy2 = (high_precision)other_pt.get(VERTICAL);
-
+
evalAtXforYdx = evalAtXforYx2 - evalAtXforYx1;
evalAtXforYdy = evalAtXforYy2 - evalAtXforYy1;
evalAtXforYret = ((evalAtXforYdx1) * evalAtXforYdy / evalAtXforYdx + evalAtXforYy1);
return evalAtXforYret;
}
-
+
struct evalAtXforYPack {
typename high_precision_type<Unit>::type
- evalAtXforYret, evalAtXforYxIn, evalAtXforYx1, evalAtXforYy1, evalAtXforYdx1, evalAtXforYdx,
+ evalAtXforYret, evalAtXforYxIn, evalAtXforYx1, evalAtXforYy1, evalAtXforYdx1, evalAtXforYdx,
evalAtXforYdy, evalAtXforYx2, evalAtXforYy2, evalAtXforY0;
- inline const typename high_precision_type<Unit>::type& evalAtXforY(Unit xIn, Point pt, Point other_pt) {
+ inline const typename high_precision_type<Unit>::type& evalAtXforY(Unit xIn, Point pt, Point other_pt) {
//y = (x - x1)dy/dx + y1
//y = (xIn - pt.x)*(other_pt.y-pt.y)/(other_pt.x-pt.x) + pt.y
//assert pt.x != other_pt.x
@@ -243,7 +243,7 @@
if(evalAtXforYdx1 == evalAtXforY0) return evalAtXforYret = evalAtXforYy1;
evalAtXforYx2 = (high_precision)other_pt.get(HORIZONTAL);
evalAtXforYy2 = (high_precision)other_pt.get(VERTICAL);
-
+
evalAtXforYdx = evalAtXforYx2 - evalAtXforYx1;
evalAtXforYdy = evalAtXforYy2 - evalAtXforYy1;
evalAtXforYret = ((evalAtXforYdx1) * evalAtXforYdy / evalAtXforYdx + evalAtXforYy1);
@@ -254,7 +254,7 @@
static inline bool is_vertical(const half_edge& he) {
return he.first.get(HORIZONTAL) == he.second.get(HORIZONTAL);
}
-
+
static inline bool is_horizontal(const half_edge& he) {
return he.first.get(VERTICAL) == he.second.get(VERTICAL);
}
@@ -274,10 +274,10 @@
inline less_half_edge(Unit *x, int *justBefore, evalAtXforYPack * packIn) : x_(x), justBefore_(justBefore), pack_(packIn) {}
inline less_half_edge(const less_half_edge& that) : x_(that.x_), justBefore_(that.justBefore_),
pack_(that.pack_){}
- inline less_half_edge& operator=(const less_half_edge& that) {
- x_ = that.x_;
- justBefore_ = that.justBefore_;
- pack_ = that.pack_;
+ inline less_half_edge& operator=(const less_half_edge& that) {
+ x_ = that.x_;
+ justBefore_ = that.justBefore_;
+ pack_ = that.pack_;
return *this; }
inline bool operator () (const half_edge& elm1, const half_edge& elm2) const {
if((std::max)(elm1.first.y(), elm1.second.y()) < (std::min)(elm2.first.y(), elm2.second.y()))
@@ -346,8 +346,8 @@
template <typename unsigned_product_type>
static inline void unsigned_add(unsigned_product_type& result, int& result_sign, unsigned_product_type a, int a_sign, unsigned_product_type b, int b_sign) {
int switcher = 0;
- if(a_sign < 0) switcher += 1;
- if(b_sign < 0) switcher += 2;
+ if(a_sign < 0) switcher += 1;
+ if(b_sign < 0) switcher += 2;
if(a < b) switcher += 4;
switch (switcher) {
case 0: //both positive
@@ -388,7 +388,7 @@
struct compute_intersection_pack {
typedef typename high_precision_type<Unit>::type high_precision;
high_precision y_high, dx1, dy1, dx2, dy2, x11, x21, y11, y21, x_num, y_num, x_den, y_den, x, y;
- static inline bool compute_lazy_intersection(Point& intersection, const half_edge& he1, const half_edge& he2,
+ static inline bool compute_lazy_intersection(Point& intersection, const half_edge& he1, const half_edge& he2,
bool projected = false, bool round_closest = false) {
long double y_high, dx1, dy1, dx2, dy2, x11, x21, y11, y21, x_num, y_num, x_den, y_den, x, y;
typedef rectangle_data<Unit> Rectangle;
@@ -419,13 +419,13 @@
}
}
//the bounding boxes of the two line segments intersect, so we check closer to find the intersection point
- dy2 = (he2.second.get(VERTICAL)) -
+ dy2 = (he2.second.get(VERTICAL)) -
(he2.first.get(VERTICAL));
- dy1 = (he1.second.get(VERTICAL)) -
+ dy1 = (he1.second.get(VERTICAL)) -
(he1.first.get(VERTICAL));
- dx2 = (he2.second.get(HORIZONTAL)) -
+ dx2 = (he2.second.get(HORIZONTAL)) -
(he2.first.get(HORIZONTAL));
- dx1 = (he1.second.get(HORIZONTAL)) -
+ dx1 = (he1.second.get(HORIZONTAL)) -
(he1.first.get(HORIZONTAL));
if(equal_slope_hp(dx1, dy1, dx2, dy2)) return false;
//the line segments have different slopes
@@ -436,7 +436,7 @@
y21 = (he2.first.get(VERTICAL));
//Unit exp_x = ((at)x11 * (at)dy1 * (at)dx2 - (at)x21 * (at)dy2 * (at)dx1 + (at)y21 * (at)dx1 * (at)dx2 - (at)y11 * (at)dx1 * (at)dx2) / ((at)dy1 * (at)dx2 - (at)dy2 * (at)dx1);
//Unit exp_y = ((at)y11 * (at)dx1 * (at)dy2 - (at)y21 * (at)dx2 * (at)dy1 + (at)x21 * (at)dy1 * (at)dy2 - (at)x11 * (at)dy1 * (at)dy2) / ((at)dx1 * (at)dy2 - (at)dx2 * (at)dy1);
- x_num = (x11 * dy1 * dx2 - x21 * dy2 * dx1 + y21 * dx1 * dx2 - y11 * dx1 * dx2);
+ x_num = (x11 * dy1 * dx2 - x21 * dy2 * dx1 + y21 * dx1 * dx2 - y11 * dx1 * dx2);
x_den = (dy1 * dx2 - dy2 * dx1);
y_num = (y11 * dx1 * dy2 - y21 * dx2 * dy1 + x21 * dy1 * dy2 - x11 * dy1 * dy2);
y_den = (dx1 * dy2 - dx2 * dy1);
@@ -468,9 +468,9 @@
if(!projected && !contains(rect1, result, true)) return false;
if(!projected && !contains(rect2, result, true)) return false;
if(projected) {
- rectangle_data<long double> inf_rect(-(long double)(std::numeric_limits<Unit>::max)(),
- -(long double) (std::numeric_limits<Unit>::max)(),
- (long double)(std::numeric_limits<Unit>::max)(),
+ rectangle_data<long double> inf_rect(-(long double)(std::numeric_limits<Unit>::max)(),
+ -(long double) (std::numeric_limits<Unit>::max)(),
+ (long double)(std::numeric_limits<Unit>::max)(),
(long double) (std::numeric_limits<Unit>::max)() );
if(contains(inf_rect, point_data<long double>(x, y), true)) {
intersection = result;
@@ -482,11 +482,11 @@
return true;
}
- inline bool compute_intersection(Point& intersection, const half_edge& he1, const half_edge& he2,
+ inline bool compute_intersection(Point& intersection, const half_edge& he1, const half_edge& he2,
bool projected = false, bool round_closest = false) {
if(!projected && !intersects(he1, he2))
return false;
- bool lazy_success = compute_lazy_intersection(intersection, he1, he2, projected);
+ bool lazy_success = compute_lazy_intersection(intersection, he1, he2, projected);
if(!projected) {
if(lazy_success) {
if(intersects_grid(intersection, he1) &&
@@ -499,7 +499,7 @@
return compute_exact_intersection(intersection, he1, he2, projected, round_closest);
}
- inline bool compute_exact_intersection(Point& intersection, const half_edge& he1, const half_edge& he2,
+ inline bool compute_exact_intersection(Point& intersection, const half_edge& he1, const half_edge& he2,
bool projected = false, bool round_closest = false) {
if(!projected && !intersects(he1, he2))
return false;
@@ -531,13 +531,13 @@
}
}
//the bounding boxes of the two line segments intersect, so we check closer to find the intersection point
- dy2 = (high_precision)(he2.second.get(VERTICAL)) -
+ dy2 = (high_precision)(he2.second.get(VERTICAL)) -
(high_precision)(he2.first.get(VERTICAL));
- dy1 = (high_precision)(he1.second.get(VERTICAL)) -
+ dy1 = (high_precision)(he1.second.get(VERTICAL)) -
(high_precision)(he1.first.get(VERTICAL));
- dx2 = (high_precision)(he2.second.get(HORIZONTAL)) -
+ dx2 = (high_precision)(he2.second.get(HORIZONTAL)) -
(high_precision)(he2.first.get(HORIZONTAL));
- dx1 = (high_precision)(he1.second.get(HORIZONTAL)) -
+ dx1 = (high_precision)(he1.second.get(HORIZONTAL)) -
(high_precision)(he1.first.get(HORIZONTAL));
if(equal_slope_hp(dx1, dy1, dx2, dy2)) return false;
//the line segments have different slopes
@@ -548,7 +548,7 @@
y21 = (high_precision)(he2.first.get(VERTICAL));
//Unit exp_x = ((at)x11 * (at)dy1 * (at)dx2 - (at)x21 * (at)dy2 * (at)dx1 + (at)y21 * (at)dx1 * (at)dx2 - (at)y11 * (at)dx1 * (at)dx2) / ((at)dy1 * (at)dx2 - (at)dy2 * (at)dx1);
//Unit exp_y = ((at)y11 * (at)dx1 * (at)dy2 - (at)y21 * (at)dx2 * (at)dy1 + (at)x21 * (at)dy1 * (at)dy2 - (at)x11 * (at)dy1 * (at)dy2) / ((at)dx1 * (at)dy2 - (at)dx2 * (at)dy1);
- x_num = (x11 * dy1 * dx2 - x21 * dy2 * dx1 + y21 * dx1 * dx2 - y11 * dx1 * dx2);
+ x_num = (x11 * dy1 * dx2 - x21 * dy2 * dx1 + y21 * dx1 * dx2 - y11 * dx1 * dx2);
x_den = (dy1 * dx2 - dy2 * dx1);
y_num = (y11 * dx1 * dy2 - y21 * dx2 * dy1 + x21 * dy1 * dy2 - x11 * dy1 * dy2);
y_den = (dx1 * dy2 - dx2 * dy1);
@@ -621,13 +621,13 @@
}
}
//the bounding boxes of the two line segments intersect, so we check closer to find the intersection point
- high_precision dy2 = (high_precision)(he2.second.get(VERTICAL)) -
+ high_precision dy2 = (high_precision)(he2.second.get(VERTICAL)) -
(high_precision)(he2.first.get(VERTICAL));
- high_precision dy1 = (high_precision)(he1.second.get(VERTICAL)) -
+ high_precision dy1 = (high_precision)(he1.second.get(VERTICAL)) -
(high_precision)(he1.first.get(VERTICAL));
- high_precision dx2 = (high_precision)(he2.second.get(HORIZONTAL)) -
+ high_precision dx2 = (high_precision)(he2.second.get(HORIZONTAL)) -
(high_precision)(he2.first.get(HORIZONTAL));
- high_precision dx1 = (high_precision)(he1.second.get(HORIZONTAL)) -
+ high_precision dx1 = (high_precision)(he1.second.get(HORIZONTAL)) -
(high_precision)(he1.first.get(HORIZONTAL));
if(equal_slope_hp(dx1, dy1, dx2, dy2)) return false;
//the line segments have different slopes
@@ -638,7 +638,7 @@
high_precision y21 = (high_precision)(he2.first.get(VERTICAL));
//Unit exp_x = ((at)x11 * (at)dy1 * (at)dx2 - (at)x21 * (at)dy2 * (at)dx1 + (at)y21 * (at)dx1 * (at)dx2 - (at)y11 * (at)dx1 * (at)dx2) / ((at)dy1 * (at)dx2 - (at)dy2 * (at)dx1);
//Unit exp_y = ((at)y11 * (at)dx1 * (at)dy2 - (at)y21 * (at)dx2 * (at)dy1 + (at)x21 * (at)dy1 * (at)dy2 - (at)x11 * (at)dy1 * (at)dy2) / ((at)dx1 * (at)dy2 - (at)dx2 * (at)dy1);
- high_precision x_num = (x11 * dy1 * dx2 - x21 * dy2 * dx1 + y21 * dx1 * dx2 - y11 * dx1 * dx2);
+ high_precision x_num = (x11 * dy1 * dx2 - x21 * dy2 * dx1 + y21 * dx1 * dx2 - y11 * dx1 * dx2);
high_precision x_den = (dy1 * dx2 - dy2 * dx1);
high_precision y_num = (y11 * dx1 * dy2 - y21 * dx2 * dy1 + x21 * dy1 * dy2 - x11 * dy1 * dy2);
high_precision y_den = (dx1 * dy2 - dx2 * dy1);
@@ -708,14 +708,14 @@
}
}
int oab1 = on_above_or_below(he1.first, he2);
- if(oab1 == 0 && between(he1.first, he2.first, he2.second)) return true;
+ if(oab1 == 0 && between(he1.first, he2.first, he2.second)) return true;
int oab2 = on_above_or_below(he1.second, he2);
- if(oab2 == 0 && between(he1.second, he2.first, he2.second)) return true;
+ if(oab2 == 0 && between(he1.second, he2.first, he2.second)) return true;
if(oab1 == oab2 && oab1 != 0) return false; //both points of he1 are on same side of he2
int oab3 = on_above_or_below(he2.first, he1);
- if(oab3 == 0 && between(he2.first, he1.first, he1.second)) return true;
+ if(oab3 == 0 && between(he2.first, he1.first, he1.second)) return true;
int oab4 = on_above_or_below(he2.second, he1);
- if(oab4 == 0 && between(he2.second, he1.first, he1.second)) return true;
+ if(oab4 == 0 && between(he2.second, he1.first, he1.second)) return true;
if(oab3 == oab4) return false; //both points of he2 are on same side of he1
return true; //they must cross
}
@@ -737,7 +737,7 @@
inline vertex_half_edge() : pt(), other_pt(), count() {}
inline vertex_half_edge(const Point& point, const Point& other_point, int countIn) : pt(point), other_pt(other_point), count(countIn) {}
inline vertex_half_edge(const vertex_half_edge& vertex) : pt(vertex.pt), other_pt(vertex.other_pt), count(vertex.count) {}
- inline vertex_half_edge& operator=(const vertex_half_edge& vertex){
+ inline vertex_half_edge& operator=(const vertex_half_edge& vertex){
pt = vertex.pt; other_pt = vertex.other_pt; count = vertex.count; return *this; }
inline vertex_half_edge(const std::pair<Point, Point>& vertex) : pt(), other_pt(), count() {}
inline vertex_half_edge& operator=(const std::pair<Point, Point>& vertex){ return *this; }
@@ -846,7 +846,7 @@
typedef typename scanline_base<Unit>::half_edge half_edge;
typedef typename scanline_base<Unit>::vertex_half_edge vertex_half_edge;
typedef typename scanline_base<Unit>::less_vertex_half_edge less_vertex_half_edge;
-
+
class poly_line_arbitrary {
public:
typedef typename std::list<Point>::const_iterator iterator;
@@ -868,7 +868,7 @@
// copy constructor (since we have dynamic memory)
inline poly_line_arbitrary(const poly_line_arbitrary& that) : points(that.points) {}
-
+
// assignment operator (since we have dynamic memory do a deep copy)
inline poly_line_arbitrary& operator=(const poly_line_arbitrary& that) {
points = that.points;
@@ -884,31 +884,31 @@
inline std::size_t size() const { return points.size(); }
//public data member
- std::list<Point> points;
+ std::list<Point> points;
};
class active_tail_arbitrary {
protected:
//data
- poly_line_arbitrary* tailp_;
+ poly_line_arbitrary* tailp_;
active_tail_arbitrary *otherTailp_;
std::list<active_tail_arbitrary*> holesList_;
bool head_;
public:
-
+
/**
* @brief iterator over coordinates of the figure
*/
typedef typename poly_line_arbitrary::iterator iterator;
-
+
/**
* @brief iterator over holes contained within the figure
*/
typedef typename std::list<active_tail_arbitrary*>::const_iterator iteratorHoles;
-
+
//default constructor
inline active_tail_arbitrary() : tailp_(), otherTailp_(), holesList_(), head_() {}
-
+
//constructor
inline active_tail_arbitrary(const vertex_half_edge& vertex, active_tail_arbitrary* otherTailp = 0) : tailp_(), otherTailp_(), holesList_(), head_() {
tailp_ = new poly_line_arbitrary;
@@ -925,7 +925,7 @@
tailp_->points.push_back(point);
head_ = head;
otherTailp_ = otherTailp;
-
+
}
inline active_tail_arbitrary(active_tail_arbitrary* otherTailp) :
tailp_(), otherTailp_(), holesList_(), head_() {
@@ -970,7 +970,7 @@
* @brief get the pointer to the activetail at the other end of the chain
*/
inline active_tail_arbitrary* getOtherActiveTail() const { return otherTailp_; }
-
+
/**
* @brief test if another active tail is the other end of the chain
*/
@@ -1107,7 +1107,7 @@
* returns a handle to a hole if one is closed
*/
template <class cT>
- static inline active_tail_arbitrary* joinChains(Point point, active_tail_arbitrary* at1, active_tail_arbitrary* at2, bool solid,
+ static inline active_tail_arbitrary* joinChains(Point point, active_tail_arbitrary* at1, active_tail_arbitrary* at2, bool solid,
cT& output) {
if(at1->otherTailp_ == at2) {
//if(at2->otherTailp_ != at1) std::cout << "half closed error\n";
@@ -1179,7 +1179,7 @@
//std::cout << this << " " << tailp_ << " " << otherTailp_ << " " << holesList_.size() << " " << head_ << std::endl;
}
- static inline std::pair<active_tail_arbitrary*, active_tail_arbitrary*> createActiveTailsAsPair(Point point, bool solid,
+ static inline std::pair<active_tail_arbitrary*, active_tail_arbitrary*> createActiveTailsAsPair(Point point, bool solid,
active_tail_arbitrary* phole, bool fractureHoles) {
active_tail_arbitrary* at1 = 0;
active_tail_arbitrary* at2 = 0;
@@ -1195,7 +1195,7 @@
at2 = new active_tail_arbitrary(at1);
at1->otherTailp_ = at2;
at2->head_ = !solid;
- if(phole)
+ if(phole)
at2->addHole(phole); //assert fractureHoles == false
}
return std::pair<active_tail_arbitrary*, active_tail_arbitrary*>(at1, at2);
@@ -1224,14 +1224,14 @@
typedef std::vector<std::pair<std::pair<std::pair<Point, Point>, int>, active_tail_arbitrary*> > incoming_count;
- class less_incoming_count : public std::binary_function<std::pair<std::pair<std::pair<Point, Point>, int>, active_tail_arbitrary*>,
+ class less_incoming_count : public std::binary_function<std::pair<std::pair<std::pair<Point, Point>, int>, active_tail_arbitrary*>,
std::pair<std::pair<std::pair<Point, Point>, int>, active_tail_arbitrary*>, bool> {
private:
Point pt_;
public:
inline less_incoming_count() : pt_() {}
inline less_incoming_count(Point point) : pt_(point) {}
- inline bool operator () (const std::pair<std::pair<std::pair<Point, Point>, int>, active_tail_arbitrary*>& elm1,
+ inline bool operator () (const std::pair<std::pair<std::pair<Point, Point>, int>, active_tail_arbitrary*>& elm1,
const std::pair<std::pair<std::pair<Point, Point>, int>, active_tail_arbitrary*>& elm2) const {
Unit dx1 = elm1.first.first.first.get(HORIZONTAL) - elm1.first.first.second.get(HORIZONTAL);
Unit dx2 = elm2.first.first.first.get(HORIZONTAL) - elm2.first.first.second.get(HORIZONTAL);
@@ -1282,7 +1282,7 @@
count.push_back(std::pair<Point, int>(vertex.other_pt, vertex.count));
}
inline vertex_arbitrary_compact(const vertex_arbitrary_compact& vertex) : pt(vertex.pt), count(vertex.count) {}
- inline vertex_arbitrary_compact& operator=(const vertex_arbitrary_compact& vertex){
+ inline vertex_arbitrary_compact& operator=(const vertex_arbitrary_compact& vertex){
pt = vertex.pt; count = vertex.count; return *this; }
//inline vertex_arbitrary_compact(const std::pair<Point, Point>& vertex) {}
inline vertex_arbitrary_compact& operator=(const std::pair<Point, Point>& vertex){ return *this; }
@@ -1315,24 +1315,24 @@
typedef std::map<vertex_half_edge, active_tail_arbitrary*, less_vertex_half_edge> scanline_data;
typedef typename scanline_data::iterator iterator;
typedef typename scanline_data::const_iterator const_iterator;
-
+
//data
scanline_data scanData_;
Unit x_;
int justBefore_;
- int fractureHoles_;
+ int fractureHoles_;
public:
- inline polygon_arbitrary_formation() :
+ inline polygon_arbitrary_formation() :
scanData_(), x_((std::numeric_limits<Unit>::min)()), justBefore_(false), fractureHoles_(0) {
less_vertex_half_edge lessElm(&x_, &justBefore_);
scanData_ = scanline_data(lessElm);
}
- inline polygon_arbitrary_formation(bool fractureHoles) :
+ inline polygon_arbitrary_formation(bool fractureHoles) :
scanData_(), x_((std::numeric_limits<Unit>::min)()), justBefore_(false), fractureHoles_(fractureHoles) {
less_vertex_half_edge lessElm(&x_, &justBefore_);
scanData_ = scanline_data(lessElm);
}
- inline polygon_arbitrary_formation(const polygon_arbitrary_formation& that) :
+ inline polygon_arbitrary_formation(const polygon_arbitrary_formation& that) :
scanData_(), x_((std::numeric_limits<Unit>::min)()), justBefore_(false), fractureHoles_(0) { (*this) = that; }
inline polygon_arbitrary_formation& operator=(const polygon_arbitrary_formation& that) {
x_ = that.x_;
@@ -1345,7 +1345,7 @@
}
return *this;
}
-
+
//cT is an output container of Polygon45 or Polygon45WithHoles
//iT is an iterator over vertex_half_edge elements
//inputBegin - inputEnd is a range of sorted iT that represents
@@ -1367,8 +1367,8 @@
protected:
//functions
template <class cT, class cT2>
- inline std::pair<std::pair<Point, int>, active_tail_arbitrary*> processPoint_(cT& output, cT2& elements, Point point,
- incoming_count& counts_from_scanline, vertex_arbitrary_count& incoming_count) {
+ inline std::pair<std::pair<Point, int>, active_tail_arbitrary*> processPoint_(cT& output, cT2& elements, Point point,
+ incoming_count& counts_from_scanline, vertex_arbitrary_count& incoming_count) {
//std::cout << "\nAT POINT: " << point << std::endl;
//join any closing solid corners
std::vector<int> counts;
@@ -1387,7 +1387,7 @@
incoming.back() = 0;
}
}
-
+
active_tail_arbitrary* returnValue = 0;
std::pair<Point, int> returnCount(Point(0, 0), 0);
int i_size_less_1 = (int)(incoming.size()) -1;
@@ -1421,7 +1421,7 @@
if(counts[j] == 1) {
//std::cout << "case1: " << i << " " << j << std::endl;
//if a figure is closed it will be written out by this function to output
- active_tail_arbitrary::joinChains(point, tails[i], tails[j], true, output);
+ active_tail_arbitrary::joinChains(point, tails[i], tails[j], true, output);
counts[i] = 0;
counts[j] = 0;
tails[i] = 0;
@@ -1447,7 +1447,7 @@
if(incoming[j] == -1) {
//std::cout << "case2: " << i << " " << j << std::endl;
//std::cout << "creating active tail pair\n";
- std::pair<active_tail_arbitrary*, active_tail_arbitrary*> tailPair =
+ std::pair<active_tail_arbitrary*, active_tail_arbitrary*> tailPair =
active_tail_arbitrary::createActiveTailsAsPair(point, true, 0, fractureHoles_ != 0);
//tailPair.first->print();
//tailPair.second->print();
@@ -1459,13 +1459,13 @@
} else {
//std::cout << "new element " << j-1 << " " << -1 << std::endl;
//std::cout << point << " " << incoming_count[j].first << std::endl;
- elements.push_back(std::pair<vertex_half_edge,
+ elements.push_back(std::pair<vertex_half_edge,
active_tail_arbitrary*>(vertex_half_edge(point,
incoming_count[j].first, -1), tailPair.first));
}
//std::cout << "new element " << i-1 << " " << 1 << std::endl;
//std::cout << point << " " << incoming_count[i].first << std::endl;
- elements.push_back(std::pair<vertex_half_edge,
+ elements.push_back(std::pair<vertex_half_edge,
active_tail_arbitrary*>(vertex_half_edge(point,
incoming_count[i].first, 1), tailPair.second));
incoming[i] = 0;
@@ -1501,8 +1501,8 @@
returnCount.first = point;
returnCount.second = -1;
} else {
- elements.push_back(std::pair<vertex_half_edge,
- active_tail_arbitrary*>(vertex_half_edge(point,
+ elements.push_back(std::pair<vertex_half_edge,
+ active_tail_arbitrary*>(vertex_half_edge(point,
incoming_count[j].first, incoming[j]), tails[i]));
}
tails[i] = 0;
@@ -1575,7 +1575,7 @@
}
break;
}
- }
+ }
}
//find beginning of a hole
{
@@ -1586,14 +1586,14 @@
//std::cout << "case6: " << i << " " << j << std::endl;
//we are beginning a empty space
active_tail_arbitrary* holep = 0;
- //if(c_size && counts[c_size_less_1] == 0 &&
- // counts_from_scanline[c_size_less_1].first.first.first.get(HORIZONTAL) == point.get(HORIZONTAL))
+ //if(c_size && counts[c_size_less_1] == 0 &&
+ // counts_from_scanline[c_size_less_1].first.first.first.get(HORIZONTAL) == point.get(HORIZONTAL))
if(have_vertical_tail_from_below) {
holep = tails[c_size_less_1];
tails[c_size_less_1] = 0;
have_vertical_tail_from_below = false;
}
- std::pair<active_tail_arbitrary*, active_tail_arbitrary*> tailPair =
+ std::pair<active_tail_arbitrary*, active_tail_arbitrary*> tailPair =
active_tail_arbitrary::createActiveTailsAsPair(point, false, holep, fractureHoles_ != 0);
if(j == i_size_less_1 && incoming_count[j].first.get(HORIZONTAL) == point.get(HORIZONTAL)) {
//std::cout << "vertical element " << point << std::endl;
@@ -1604,13 +1604,13 @@
} else {
//std::cout << "new element " << j-1 << " " << incoming[j] << std::endl;
//std::cout << point << " " << incoming_count[j].first << std::endl;
- elements.push_back(std::pair<vertex_half_edge,
+ elements.push_back(std::pair<vertex_half_edge,
active_tail_arbitrary*>(vertex_half_edge(point,
incoming_count[j].first, incoming[j]), tailPair.first));
}
//std::cout << "new element " << i-1 << " " << incoming[i] << std::endl;
//std::cout << point << " " << incoming_count[i].first << std::endl;
- elements.push_back(std::pair<vertex_half_edge,
+ elements.push_back(std::pair<vertex_half_edge,
active_tail_arbitrary*>(vertex_half_edge(point,
incoming_count[i].first, incoming[i]), tailPair.second));
incoming[i] = 0;
@@ -1682,7 +1682,7 @@
elementIters.push_back(iter);
counts_from_scanline.push_back(std::pair<std::pair<std::pair<Point, Point>, int>, active_tail_arbitrary*>
(std::pair<std::pair<Point, Point>, int>(std::pair<Point, Point>(iter->first.pt,
- iter->first.other_pt),
+ iter->first.other_pt),
iter->first.count),
iter->second));
++iter;
@@ -1722,8 +1722,8 @@
//std::cout << "adding vertical tail to counts from scanline\n";
//std::cout << -verticalCount.second << std::endl;
counts_from_scanline.push_back(std::pair<std::pair<std::pair<Point, Point>, int>, active_tail_arbitrary*>
- (std::pair<std::pair<Point, Point>, int>(std::pair<Point, Point>(verticalCount.first,
- currentPoint),
+ (std::pair<std::pair<Point, Point>, int>(std::pair<Point, Point>(verticalCount.first,
+ currentPoint),
-verticalCount.second),
verticalTail));
}
@@ -1743,7 +1743,7 @@
//we got a hole out of the point we just processed
//iter is still at the next y element above the current y value in the tree
//std::cout << "checking whether ot handle hole\n";
- if(currentIter == inputEnd ||
+ if(currentIter == inputEnd ||
currentIter->pt.get(HORIZONTAL) != x_ ||
scanline_base<Unit>::on_above_or_below(currentIter->pt, half_edge(iter->first.pt, iter->first.other_pt)) != -1) {
//(high_precision)(currentIter->pt.get(VERTICAL)) >= iter->first.evalAtX(x_)) {
@@ -1791,15 +1791,15 @@
//std::cout << "end processEvent\n";
return currentIter;
}
-
+
inline iterator lookUp_(Unit y){
//if just before then we need to look from 1 not -1
//std::cout << "just before " << justBefore_ << std::endl;
return scanData_.lower_bound(vertex_half_edge(Point(x_, y), Point(x_, y+1), 0));
}
-
+
public: //test functions
-
+
template <typename stream_type>
static inline bool testPolygonArbitraryFormationRect(stream_type& stdcout) {
stdcout << "testing polygon formation\n";
@@ -1943,18 +1943,18 @@
data.push_back(vertex_half_edge(Point(5, 10), Point(5, 5), 1));
data.push_back(vertex_half_edge(Point(5, 10), Point(0, 10), 1));
-
+
data.push_back(vertex_half_edge(Point(5, 2), Point(5, 5), -1));
data.push_back(vertex_half_edge(Point(5, 2), Point(7, 2), -1));
-
+
data.push_back(vertex_half_edge(Point(5, 5), Point(5, 10), -1));
data.push_back(vertex_half_edge(Point(5, 5), Point(5, 2), 1));
data.push_back(vertex_half_edge(Point(5, 5), Point(10, 5), -1));
data.push_back(vertex_half_edge(Point(5, 5), Point(7, 2), 1));
-
+
data.push_back(vertex_half_edge(Point(7, 2), Point(5, 5), -1));
data.push_back(vertex_half_edge(Point(7, 2), Point(5, 2), 1));
-
+
polygon_sort(data.begin(), data.end());
pf.scan(polys, data.begin(), data.end());
stdcout << "result size: " << polys.size() << std::endl;
@@ -1985,16 +1985,16 @@
data.push_back(vertex_half_edge(Point(5, 10), Point(4, 1), -1));
data.push_back(vertex_half_edge(Point(5, 10), Point(0, 10), 1));
-
+
data.push_back(vertex_half_edge(Point(4, 1), Point(5, 10), 1));
data.push_back(vertex_half_edge(Point(4, 1), Point(7, 2), -1));
-
+
data.push_back(vertex_half_edge(Point(5, 5), Point(10, 5), -1));
data.push_back(vertex_half_edge(Point(5, 5), Point(7, 2), 1));
-
+
data.push_back(vertex_half_edge(Point(7, 2), Point(5, 5), -1));
data.push_back(vertex_half_edge(Point(7, 2), Point(4, 1), 1));
-
+
polygon_sort(data.begin(), data.end());
pf.scan(polys, data.begin(), data.end());
stdcout << "result size: " << polys.size() << std::endl;
@@ -2025,16 +2025,16 @@
data.push_back(vertex_half_edge(Point(6, 10), Point(4, 1), -1));
data.push_back(vertex_half_edge(Point(6, 10), Point(0, 10), 1));
-
+
data.push_back(vertex_half_edge(Point(4, 1), Point(6, 10), 1));
data.push_back(vertex_half_edge(Point(4, 1), Point(7, 2), -1));
-
+
data.push_back(vertex_half_edge(Point(5, 5), Point(10, 5), -1));
data.push_back(vertex_half_edge(Point(5, 5), Point(7, 2), 1));
-
+
data.push_back(vertex_half_edge(Point(7, 2), Point(5, 5), -1));
data.push_back(vertex_half_edge(Point(7, 2), Point(4, 1), 1));
-
+
polygon_sort(data.begin(), data.end());
pf.scan(polys, data.begin(), data.end());
stdcout << "result size: " << polys.size() << std::endl;
@@ -2120,7 +2120,7 @@
return b;
}
-
+
};
template <typename Unit>
@@ -2134,7 +2134,7 @@
typedef Unit coordinate_type;
typedef typename active_tail_arbitrary::iterator iterator_type;
//typedef iterator_points_to_compact<iterator_type, Point> compact_iterator_type;
-
+
typedef iterator_type iterator;
inline poly_line_arbitrary_hole_data() : p_(0) {}
inline poly_line_arbitrary_hole_data(active_tail_arbitrary* p) : p_(p) {}
@@ -2174,7 +2174,7 @@
typedef poly_line_arbitrary_hole_data<Unit> holeType;
mutable holeType hole_;
typename active_tail_arbitrary::iteratorHoles itr_;
-
+
public:
typedef std::forward_iterator_tag iterator_category;
typedef holeType value_type;
@@ -2183,7 +2183,7 @@
typedef const holeType& reference; //immutable
inline iterator_holes_type() : hole_(), itr_() {}
inline iterator_holes_type(typename active_tail_arbitrary::iteratorHoles itr) : hole_(), itr_(itr) {}
- inline iterator_holes_type(const iterator_holes_type& that) : hole_(that.hole_), itr_(that.itr_) {}
+ inline iterator_holes_type(const iterator_holes_type& that) : hole_(that.hole_), itr_(that.itr_) {}
inline iterator_holes_type& operator=(const iterator_holes_type& that) {
itr_ = that.itr_;
return *this;
@@ -2241,7 +2241,7 @@
typedef typename scanline_base<Unit>::half_edge half_edge;
typedef typename scanline_base<Unit>::vertex_half_edge vertex_half_edge;
typedef typename scanline_base<Unit>::less_vertex_half_edge less_vertex_half_edge;
-
+
typedef typename polygon_arbitrary_formation<Unit>::poly_line_arbitrary poly_line_arbitrary;
typedef typename polygon_arbitrary_formation<Unit>::active_tail_arbitrary active_tail_arbitrary;
@@ -2261,7 +2261,7 @@
typedef std::map<vertex_half_edge, active_tail_arbitrary*, less_vertex_half_edge> scanline_data;
typedef typename scanline_data::iterator iterator;
typedef typename scanline_data::const_iterator const_iterator;
-
+
//data
public:
inline trapezoid_arbitrary_formation() : polygon_arbitrary_formation<Unit>() {}
@@ -2270,7 +2270,7 @@
* static_cast<polygon_arbitrary_formation<Unit>*>(this) = * static_cast<polygon_arbitrary_formation<Unit>*>(&that);
return *this;
}
-
+
//cT is an output container of Polygon45 or Polygon45WithHoles
//iT is an iterator over vertex_half_edge elements
//inputBegin - inputEnd is a range of sorted iT that represents
@@ -2291,14 +2291,14 @@
private:
//functions
- inline void getVerticalPair_(std::pair<active_tail_arbitrary*,
- active_tail_arbitrary*>& verticalPair,
+ inline void getVerticalPair_(std::pair<active_tail_arbitrary*,
+ active_tail_arbitrary*>& verticalPair,
iterator previter) {
active_tail_arbitrary* iterTail = (*previter).second;
- Point prevPoint(polygon_arbitrary_formation<Unit>::x_,
+ Point prevPoint(polygon_arbitrary_formation<Unit>::x_,
convert_high_precision_type<Unit>(previter->first.evalAtX(polygon_arbitrary_formation<Unit>::x_)));
iterTail->pushPoint(prevPoint);
- std::pair<active_tail_arbitrary*, active_tail_arbitrary*> tailPair =
+ std::pair<active_tail_arbitrary*, active_tail_arbitrary*> tailPair =
active_tail_arbitrary::createActiveTailsAsPair(prevPoint, true, 0, false);
verticalPair.first = iterTail;
verticalPair.second = tailPair.first;
@@ -2306,11 +2306,11 @@
}
template <class cT, class cT2>
- inline std::pair<std::pair<Point, int>, active_tail_arbitrary*>
- processPoint_(cT& output, cT2& elements,
+ inline std::pair<std::pair<Point, int>, active_tail_arbitrary*>
+ processPoint_(cT& output, cT2& elements,
std::pair<active_tail_arbitrary*, active_tail_arbitrary*>& verticalPair,
- iterator previter, Point point, incoming_count& counts_from_scanline,
- vertex_arbitrary_count& incoming_count) {
+ iterator previter, Point point, incoming_count& counts_from_scanline,
+ vertex_arbitrary_count& incoming_count) {
//std::cout << "\nAT POINT: " << point << std::endl;
//join any closing solid corners
std::vector<int> counts;
@@ -2329,7 +2329,7 @@
incoming.back() = 0;
}
}
-
+
active_tail_arbitrary* returnValue = 0;
std::pair<active_tail_arbitrary*, active_tail_arbitrary*> verticalPairOut;
verticalPairOut.first = 0;
@@ -2366,7 +2366,7 @@
if(counts[j] == 1) {
//std::cout << "case1: " << i << " " << j << std::endl;
//if a figure is closed it will be written out by this function to output
- active_tail_arbitrary::joinChains(point, tails[i], tails[j], true, output);
+ active_tail_arbitrary::joinChains(point, tails[i], tails[j], true, output);
counts[i] = 0;
counts[j] = 0;
tails[i] = 0;
@@ -2392,7 +2392,7 @@
if(incoming[j] == -1) {
//std::cout << "case2: " << i << " " << j << std::endl;
//std::cout << "creating active tail pair\n";
- std::pair<active_tail_arbitrary*, active_tail_arbitrary*> tailPair =
+ std::pair<active_tail_arbitrary*, active_tail_arbitrary*> tailPair =
active_tail_arbitrary::createActiveTailsAsPair(point, true, 0, polygon_arbitrary_formation<Unit>::fractureHoles_ != 0);
//tailPair.first->print();
//tailPair.second->print();
@@ -2404,13 +2404,13 @@
} else {
//std::cout << "new element " << j-1 << " " << -1 << std::endl;
//std::cout << point << " " << incoming_count[j].first << std::endl;
- elements.push_back(std::pair<vertex_half_edge,
+ elements.push_back(std::pair<vertex_half_edge,
active_tail_arbitrary*>(vertex_half_edge(point,
incoming_count[j].first, -1), tailPair.first));
}
//std::cout << "new element " << i-1 << " " << 1 << std::endl;
//std::cout << point << " " << incoming_count[i].first << std::endl;
- elements.push_back(std::pair<vertex_half_edge,
+ elements.push_back(std::pair<vertex_half_edge,
active_tail_arbitrary*>(vertex_half_edge(point,
incoming_count[i].first, 1), tailPair.second));
incoming[i] = 0;
@@ -2446,12 +2446,12 @@
returnCount.first = point;
returnCount.second = -1;
} else {
- std::pair<active_tail_arbitrary*, active_tail_arbitrary*> tailPair =
+ std::pair<active_tail_arbitrary*, active_tail_arbitrary*> tailPair =
active_tail_arbitrary::createActiveTailsAsPair(point, true, 0, false);
verticalPairOut.first = tails[i];
verticalPairOut.second = tailPair.first;
- elements.push_back(std::pair<vertex_half_edge,
- active_tail_arbitrary*>(vertex_half_edge(point,
+ elements.push_back(std::pair<vertex_half_edge,
+ active_tail_arbitrary*>(vertex_half_edge(point,
incoming_count[j].first, incoming[j]), tailPair.second));
}
tails[i] = 0;
@@ -2478,13 +2478,13 @@
if(incoming[j] == -1) {
//std::cout << "case4: " << i << " " << j << std::endl;
//pass through solid on bottom
-
+
//if count from scanline is vertical
- if(i == c_size_less_1 &&
- counts_from_scanline[i].first.first.first.get(HORIZONTAL) ==
+ if(i == c_size_less_1 &&
+ counts_from_scanline[i].first.first.first.get(HORIZONTAL) ==
point.get(HORIZONTAL)) {
//if incoming count is vertical
- if(j == i_size_less_1 &&
+ if(j == i_size_less_1 &&
incoming_count[j].first.get(HORIZONTAL) == point.get(HORIZONTAL)) {
returnValue = tails[i];
returnCount.first = point;
@@ -2495,13 +2495,13 @@
active_tail_arbitrary*>(vertex_half_edge(point,
incoming_count[j].first, incoming[j]), tails[i]));
}
- } else if(j == i_size_less_1 &&
- incoming_count[j].first.get(HORIZONTAL) ==
+ } else if(j == i_size_less_1 &&
+ incoming_count[j].first.get(HORIZONTAL) ==
point.get(HORIZONTAL)) {
if(verticalPair.first == 0) {
getVerticalPair_(verticalPair, previter);
}
- active_tail_arbitrary::joinChains(point, tails[i], verticalPair.first, true, output);
+ active_tail_arbitrary::joinChains(point, tails[i], verticalPair.first, true, output);
returnValue = verticalPair.second;
returnCount.first = point;
returnCount.second = 1;
@@ -2510,7 +2510,7 @@
if(verticalPair.first == 0) {
getVerticalPair_(verticalPair, previter);
}
- active_tail_arbitrary::joinChains(point, tails[i], verticalPair.first, true, output);
+ active_tail_arbitrary::joinChains(point, tails[i], verticalPair.first, true, output);
verticalPair.second->pushPoint(point);
elements.push_back(std::pair<vertex_half_edge,
active_tail_arbitrary*>(vertex_half_edge(point,
@@ -2541,8 +2541,8 @@
tails[i]->pushPoint(point);
verticalPairOut.first = tails[i];
if(j == c_size_less_1 &&
- counts_from_scanline[j].first.first.first.get(HORIZONTAL) ==
- point.get(HORIZONTAL)) {
+ counts_from_scanline[j].first.first.first.get(HORIZONTAL) ==
+ point.get(HORIZONTAL)) {
verticalPairOut.second = tails[j];
} else {
//need to close a trapezoid below
@@ -2561,7 +2561,7 @@
}
break;
}
- }
+ }
}
//find beginning of a hole
{
@@ -2581,15 +2581,15 @@
returnCount.first = point;
returnCount.second = -1;
} else {
- std::pair<active_tail_arbitrary*, active_tail_arbitrary*> tailPair =
+ std::pair<active_tail_arbitrary*, active_tail_arbitrary*> tailPair =
active_tail_arbitrary::createActiveTailsAsPair(point, false, 0, false);
- elements.push_back(std::pair<vertex_half_edge,
+ elements.push_back(std::pair<vertex_half_edge,
active_tail_arbitrary*>(vertex_half_edge(point,
incoming_count[j].first, incoming[j]), tailPair.second));
verticalPairOut.second = tailPair.first;
verticalPairOut.first = verticalPair.first;
}
- elements.push_back(std::pair<vertex_half_edge,
+ elements.push_back(std::pair<vertex_half_edge,
active_tail_arbitrary*>(vertex_half_edge(point,
incoming_count[i].first, incoming[i]), verticalPair.second));
incoming[i] = 0;
@@ -2668,7 +2668,7 @@
elementIters.push_back(iter);
counts_from_scanline.push_back(std::pair<std::pair<std::pair<Point, Point>, int>, active_tail_arbitrary*>
(std::pair<std::pair<Point, Point>, int>(std::pair<Point, Point>(iter->first.pt,
- iter->first.other_pt),
+ iter->first.other_pt),
iter->first.count),
iter->second));
++iter;
@@ -2708,8 +2708,8 @@
//std::cout << "adding vertical tail to counts from scanline\n";
//std::cout << -verticalCount.second << std::endl;
counts_from_scanline.push_back(std::pair<std::pair<std::pair<Point, Point>, int>, active_tail_arbitrary*>
- (std::pair<std::pair<Point, Point>, int>(std::pair<Point, Point>(verticalCount.first,
- currentPoint),
+ (std::pair<std::pair<Point, Point>, int>(std::pair<Point, Point>(verticalCount.first,
+ currentPoint),
-verticalCount.second),
verticalTail));
}
@@ -2895,18 +2895,18 @@
data.push_back(vertex_half_edge(Point(5, 10), Point(5, 5), 1));
data.push_back(vertex_half_edge(Point(5, 10), Point(0, 10), 1));
-
+
data.push_back(vertex_half_edge(Point(5, 2), Point(5, 5), -1));
data.push_back(vertex_half_edge(Point(5, 2), Point(7, 2), -1));
-
+
data.push_back(vertex_half_edge(Point(5, 5), Point(5, 10), -1));
data.push_back(vertex_half_edge(Point(5, 5), Point(5, 2), 1));
data.push_back(vertex_half_edge(Point(5, 5), Point(10, 5), -1));
data.push_back(vertex_half_edge(Point(5, 5), Point(7, 2), 1));
-
+
data.push_back(vertex_half_edge(Point(7, 2), Point(5, 5), -1));
data.push_back(vertex_half_edge(Point(7, 2), Point(5, 2), 1));
-
+
polygon_sort(data.begin(), data.end());
pf.scan(polys, data.begin(), data.end());
stdcout << "result size: " << polys.size() << std::endl;
@@ -2917,7 +2917,7 @@
return true;
}
};
-
+
template <typename T>
struct PolyLineArbitraryByConcept<T, polygon_with_holes_concept> { typedef poly_line_arbitrary_polygon_data<T> type; };
template <typename T>
Modified: trunk/boost/polygon/detail/voronoi_ctypes.hpp
==============================================================================
--- trunk/boost/polygon/detail/voronoi_ctypes.hpp (original)
+++ trunk/boost/polygon/detail/voronoi_ctypes.hpp 2012-05-07 15:40:35 EDT (Mon, 07 May 2012)
@@ -44,8 +44,8 @@
uint64 ll_a, ll_b;
// Reinterpret double bits as 64-bit signed integer.
- memcpy(&ll_a, &a, sizeof(fpt64));
- memcpy(&ll_b, &b, sizeof(fpt64));
+ std::memcpy(&ll_a, &a, sizeof(fpt64));
+ std::memcpy(&ll_b, &b, sizeof(fpt64));
// Positive 0.0 is integer zero. Negative 0.0 is 0x8000000000000000.
// Map negative zero to an integer zero representation - making it
@@ -80,12 +80,12 @@
static int64 set_exponent(fpt64& value, int64 exponent) {
int64 bits;
- memcpy(&bits, &value, sizeof(fpt64));
+ std::memcpy(&bits, &value, sizeof(fpt64));
int64 exp = ((bits & kExponentMask) >> 52) - 1023;
if (exp == exponent)
return exp;
bits = (bits & kSignedMantissaMask) | ((exponent + 1023) << 52);
- memcpy(&value, &bits, sizeof(fpt64));
+ std::memcpy(&value, &bits, sizeof(fpt64));
return exp;
}
};
@@ -321,7 +321,7 @@
extended_int(const extended_int<M>& that) {
if (that.size() > N) return;
this->count_ = that.count();
- memcpy(this->chunks_, that.chunks(), that.size() * sizeof(uint32));
+ std::memcpy(this->chunks_, that.chunks(), that.size() * sizeof(uint32));
}
extended_int& operator=(int32 that) {
@@ -357,7 +357,7 @@
extended_int& operator=(const extended_int<M>& that) {
size_t mx = (std::max)(N, that.size());
this->count_ = that.count();
- memcpy(this->chunks_, that.chunks(), mx * sizeof(uint32));
+ std::memcpy(this->chunks_, that.chunks(), mx * sizeof(uint32));
return *this;
}
Modified: trunk/boost/polygon/polygon_45_set_data.hpp
==============================================================================
--- trunk/boost/polygon/polygon_45_set_data.hpp (original)
+++ trunk/boost/polygon/polygon_45_set_data.hpp 2012-05-07 15:40:35 EDT (Mon, 07 May 2012)
@@ -1,6 +1,6 @@
/*
Copyright 2008 Intel Corporation
-
+
Use, modification and distribution are subject to 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).
@@ -19,7 +19,7 @@
template <typename ltype, typename rtype, int op_type>
class polygon_45_set_view;
-
+
struct polygon_45_set_concept {};
template <typename Unit>
@@ -43,8 +43,8 @@
}
// copy constructor
- inline polygon_45_set_data(const polygon_45_set_data& that) :
- error_data_(that.error_data_), data_(that.data_), dirty_(that.dirty_),
+ inline polygon_45_set_data(const polygon_45_set_data& that) :
+ error_data_(that.error_data_), data_(that.data_), dirty_(that.dirty_),
unsorted_(that.unsorted_), is_manhattan_(that.is_manhattan_) {}
template <typename ltype, typename rtype, int op_type>
@@ -123,7 +123,7 @@
unsorted_ = true;
insert_clean(vertex_45, is_hole);
}
-
+
template <typename coordinate_type_2>
inline void insert(const polygon_90_set_data<coordinate_type_2>& polygon_set, bool is_hole = false) {
if(polygon_set.orient() == VERTICAL) {
@@ -158,14 +158,14 @@
p.data_.insert(p.data_.end(), error_data_.begin(), error_data_.end());
}
- // equivalence operator
+ // equivalence operator
inline bool operator==(const polygon_45_set_data& p) const {
clean();
p.clean();
return data_ == p.data_;
}
- // inequivalence operator
+ // inequivalence operator
inline bool operator!=(const polygon_45_set_data& p) const {
return !((*this) == p);
}
@@ -233,7 +233,7 @@
}
void set(const value_type& value) {
- data_ = value;
+ data_ = value;
dirty_ = true;
unsorted_ = true;
}
@@ -243,13 +243,13 @@
void get_polygons(cT& container) const {
get_dispatch(container, polygon_45_concept());
}
-
+
// append to the container cT with PolygonWithHoles objects
template <class cT>
void get_polygons_with_holes(cT& container) const {
get_dispatch(container, polygon_45_with_holes_concept());
}
-
+
// append to the container cT with polygons of three or four verticies
// slicing orientation is vertical
template <class cT>
@@ -289,7 +289,7 @@
// snap verticies of set to even,even or odd,odd coordinates
void snap() const;
-
+
// |= &= += *= -= ^= binary operators
polygon_45_set_data& operator|=(const polygon_45_set_data& b);
polygon_45_set_data& operator&=(const polygon_45_set_data& b);
@@ -301,7 +301,7 @@
// resizing operations
polygon_45_set_data& operator+=(Unit delta);
polygon_45_set_data& operator-=(Unit delta);
-
+
// shrink the Polygon45Set by shrinking
polygon_45_set_data& resize(coordinate_type resizing, RoundingOption rounding = CLOSEST,
CornerOption corner = INTERSECTION);
@@ -339,14 +339,14 @@
bool hole = false) {
return insert_with_resize_dispatch(poly, resizing, rounding, corner, hole, typename geometry_concept<geometry_type>::type());
}
-
+
private:
mutable value_type error_data_;
mutable value_type data_;
mutable bool dirty_;
mutable bool unsorted_;
mutable bool is_manhattan_;
-
+
private:
//functions
template <typename output_container>
@@ -378,7 +378,7 @@
insert(geometry_object.begin(), geometry_object.end(), is_hole);
}
template <typename geometry_type>
- void insert_dispatch(const geometry_type& geometry_object, bool is_hole, rectangle_concept tag);
+ void insert_dispatch(const geometry_type& geometry_object, bool is_hole, rectangle_concept tag);
template <typename geometry_type>
void insert_dispatch(const geometry_type& geometry_object, bool is_hole, polygon_90_concept ) {
insert_vertex_sequence(begin_points(geometry_object), end_points(geometry_object), winding(geometry_object), is_hole);
@@ -418,20 +418,20 @@
insert(pl.begin(), pl.end(), is_hole);
}
- void insert_vertex_half_edge_45_pair(const point_data<Unit>& pt1, point_data<Unit>& pt2,
+ void insert_vertex_half_edge_45_pair(const point_data<Unit>& pt1, point_data<Unit>& pt2,
const point_data<Unit>& pt3, direction_1d wdir);
template <typename geometry_type>
polygon_45_set_data& insert_with_resize_dispatch(const geometry_type& poly,
coordinate_type resizing, RoundingOption rounding,
CornerOption corner, bool hole, polygon_45_concept tag);
-
+
// accumulate the bloated polygon with holes
template <typename geometry_type>
polygon_45_set_data& insert_with_resize_dispatch(const geometry_type& poly,
coordinate_type resizing, RoundingOption rounding,
- CornerOption corner, bool hole, polygon_45_with_holes_concept tag);
-
+ CornerOption corner, bool hole, polygon_45_with_holes_concept tag);
+
static void snap_vertex_45(Vertex45Compact& vertex);
public:
@@ -447,7 +447,7 @@
struct geometry_concept<polygon_45_set_data<T> > {
typedef polygon_45_set_concept type;
};
-
+
template <typename iT, typename T>
void scale_up_vertex_45_compact_range(iT beginr, iT endr, T factor) {
for( ; beginr != endr; ++beginr) {
@@ -491,17 +491,17 @@
template <typename cT, typename pT>
bool insert_vertex_half_edge_45_pair_into_vector(cT& output,
- const pT& pt1, pT& pt2,
- const pT& pt3,
+ const pT& pt1, pT& pt2,
+ const pT& pt3,
direction_1d wdir) {
int multiplier = wdir == LOW ? -1 : 1;
typename cT::value_type vertex(pt2, 0, 0);
//std::cout << pt1 << " " << pt2 << " " << pt3 << std::endl;
std::pair<int, int> check;
- check = characterizeEdge45(pt1, pt2);
+ check = characterizeEdge45(pt1, pt2);
//std::cout << "index " << check.first << " " << check.second * -multiplier << std::endl;
vertex.count[check.first] += check.second * -multiplier;
- check = characterizeEdge45(pt2, pt3);
+ check = characterizeEdge45(pt2, pt3);
//std::cout << "index " << check.first << " " << check.second * multiplier << std::endl;
vertex.count[check.first] += check.second * multiplier;
output.push_back(vertex);
@@ -509,8 +509,8 @@
}
template <typename Unit>
- inline void polygon_45_set_data<Unit>::insert_vertex_half_edge_45_pair(const point_data<Unit>& pt1, point_data<Unit>& pt2,
- const point_data<Unit>& pt3,
+ inline void polygon_45_set_data<Unit>::insert_vertex_half_edge_45_pair(const point_data<Unit>& pt1, point_data<Unit>& pt2,
+ const point_data<Unit>& pt3,
direction_1d wdir) {
if(insert_vertex_half_edge_45_pair_into_vector(data_, pt1, pt2, pt3, wdir)) is_manhattan_ = false;
}
@@ -612,7 +612,7 @@
template <typename cT, typename rT>
void insert_rectangle_into_vector_45(cT& output, const rT& rect, bool is_hole) {
- point_data<typename rectangle_traits<rT>::coordinate_type>
+ point_data<typename rectangle_traits<rT>::coordinate_type>
llpt = ll(rect), lrpt = lr(rect), ulpt = ul(rect), urpt = ur(rect);
direction_1d dir = COUNTERCLOCKWISE;
if(is_hole) dir = CLOCKWISE;
@@ -624,7 +624,7 @@
template <typename Unit>
template <typename geometry_type>
- inline void polygon_45_set_data<Unit>::insert_dispatch(const geometry_type& geometry_object,
+ inline void polygon_45_set_data<Unit>::insert_dispatch(const geometry_type& geometry_object,
bool is_hole, rectangle_concept ) {
dirty_ = true;
unsorted_ = true;
@@ -641,7 +641,7 @@
}
Unit low = (std::numeric_limits<Unit>::max)();
Unit high = (std::numeric_limits<Unit>::min)();
- interval_data<Unit> xivl(low, high);
+ interval_data<Unit> xivl(low, high);
interval_data<Unit> yivl(low, high);
for(typename value_type::const_iterator itr = data_.begin();
itr != data_.end(); ++ itr) {
@@ -715,7 +715,7 @@
inline polygon_45_set_data<Unit>& polygon_45_set_data<Unit>::operator-=(const polygon_45_set_data<Unit>& b) {
//b.sort();
//sort();
- applyAdaptiveBoolean_<2>(b);
+ applyAdaptiveBoolean_<2>(b);
dirty_ = false;
unsorted_ = false;
return *this;
@@ -724,7 +724,7 @@
inline polygon_45_set_data<Unit>& polygon_45_set_data<Unit>::operator^=(const polygon_45_set_data<Unit>& b) {
//b.sort();
//sort();
- applyAdaptiveBoolean_<3>(b);
+ applyAdaptiveBoolean_<3>(b);
dirty_ = false;
unsorted_ = false;
return *this;
@@ -740,7 +740,7 @@
}
template <typename Unit>
- inline polygon_45_set_data<Unit>&
+ inline polygon_45_set_data<Unit>&
polygon_45_set_data<Unit>::resize(Unit resizing, RoundingOption rounding, CornerOption corner) {
if(resizing == 0) return *this;
std::list<polygon_45_with_holes_data<Unit> > pl;
@@ -853,7 +853,7 @@
Unit y = 0;
if(run1 == 0) {
x = pt1.x();
- y = (Unit)(((x1 - x2) * rise2) / run2) + pt2.y();
+ y = (Unit)(((x1 - x2) * rise2) / run2) + pt2.y();
} else if(run2 == 0) {
x = pt2.x();
y = (Unit)(((x2 - x1) * rise1) / run1) + pt1.y();
@@ -864,7 +864,7 @@
// (rise1/run1 - rise2/run2)x = y2 - y1 + rise1/run1 x1 - rise2/run2 x2
// x = (y2 - y1 + rise1/run1 x1 - rise2/run2 x2)/(rise1/run1 - rise2/run2)
// x = (y2 - y1 + rise1/run1 x1 - rise2/run2 x2)(rise1 run2 - rise2 run1)/(run1 run2)
- x = (Unit)((y2 - y1 + ((rise1 * x1) / run1) - ((rise2 * x2) / run2)) *
+ x = (Unit)((y2 - y1 + ((rise1 * x1) / run1) - ((rise2 * x2) / run2)) *
(run1 * run2) / (rise1 * run2 - rise2 * run1));
if(rise1 == 0) {
y = pt1.y();
@@ -874,7 +874,7 @@
// y - y1 = (rise1/run1)(x - x1)
// (run1/rise1)(y - y1) = x - x1
// x = (run1/rise1)(y - y1) + x1 = (run2/rise2)(y - y2) + x2
- y = (Unit)((x2 - x1 + ((run1 * y1) / rise1) - ((run2 * y2) / rise2)) *
+ y = (Unit)((x2 - x1 + ((run1 * y1) / rise1) - ((run2 * y2) / rise2)) *
(rise1 * rise2) / (run1 * rise2 - run2 * rise1));
}
}
@@ -883,7 +883,7 @@
template <typename Unit>
inline
- void handleResizingEdge45_SQRT1OVER2(polygon_45_set_data<Unit>& sizingSet, point_data<Unit> first,
+ void handleResizingEdge45_SQRT1OVER2(polygon_45_set_data<Unit>& sizingSet, point_data<Unit> first,
point_data<Unit> second, Unit resizing, CornerOption corner) {
if(first.x() == second.x()) {
sizingSet.insert(rectangle_data<Unit>(first.x() - resizing, first.y(), first.x() + resizing, second.y()));
@@ -933,7 +933,7 @@
template <typename Unit>
inline
- void handleResizingEdge45(polygon_45_set_data<Unit>& sizingSet, point_data<Unit> first,
+ void handleResizingEdge45(polygon_45_set_data<Unit>& sizingSet, point_data<Unit> first,
point_data<Unit> second, Unit resizing, RoundingOption rounding) {
if(first.x() == second.x()) {
sizingSet.insert(rectangle_data<int>(first.x() - resizing, first.y(), first.x() + resizing, second.y()));
@@ -999,14 +999,14 @@
template <typename Unit>
inline
- void handleResizingVertex45(polygon_45_set_data<Unit>& sizingSet, const point_data<Unit>& first,
- const point_data<Unit>& second, const point_data<Unit>& third, Unit resizing,
- RoundingOption rounding, CornerOption corner,
+ void handleResizingVertex45(polygon_45_set_data<Unit>& sizingSet, const point_data<Unit>& first,
+ const point_data<Unit>& second, const point_data<Unit>& third, Unit resizing,
+ RoundingOption rounding, CornerOption corner,
int multiplier) {
unsigned int edge1 = getEdge45Direction(first, second);
unsigned int edge2 = getEdge45Direction(second, third);
unsigned int diffAngle;
- if(multiplier < 0)
+ if(multiplier < 0)
diffAngle = (edge2 + 8 - edge1) % 8;
else
diffAngle = (edge1 + 8 - edge2) % 8;
@@ -1016,7 +1016,7 @@
}
Unit bloating = abs(resizing);
if(rounding == SQRT1OVER2) {
- if(edge1 % 2 && edge2 % 2) return;
+ if(edge1 % 2 && edge2 % 2) return;
if(corner == ORTHOGONAL && edge1 % 2 == 0 && edge2 % 2 == 0) {
rectangle_data<Unit> insertion_rect;
set_points(insertion_rect, second, second);
@@ -1075,7 +1075,7 @@
sizingSet.insert(insertion_rect);
return;
}
- }
+ }
std::vector<point_data<Unit> > pts;
pts.push_back(edgePoint1);
pts.push_back(second);
@@ -1087,15 +1087,15 @@
template <typename Unit>
template <typename geometry_type>
- inline polygon_45_set_data<Unit>&
+ inline polygon_45_set_data<Unit>&
polygon_45_set_data<Unit>::insert_with_resize_dispatch(const geometry_type& poly,
- coordinate_type resizing,
+ coordinate_type resizing,
RoundingOption rounding,
CornerOption corner,
bool hole, polygon_45_concept ) {
direction_1d wdir = winding(poly);
int multiplier = wdir == LOW ? -1 : 1;
- if(hole) resizing *= -1;
+ if(hole) resizing *= -1;
typedef typename polygon_45_data<Unit>::iterator_type piterator;
piterator first, second, third, end, real_end;
real_end = end_points(poly);
@@ -1114,8 +1114,8 @@
handleResizingEdge45(sizingSet, *first, *second, resizing, rounding);
} else {
handleResizingEdge45_SQRT1OVER2(sizingSet, *first, *second, resizing, corner);
- }
- if(corner != UNFILLED)
+ }
+ if(corner != UNFILLED)
handleResizingVertex45(sizingSet, *first, *second, *third, resizing, rounding, corner, multiplier);
first = second;
second = third;
@@ -1145,9 +1145,9 @@
template <typename geometry_type>
inline polygon_45_set_data<Unit>&
polygon_45_set_data<Unit>::insert_with_resize_dispatch(const geometry_type& poly,
- coordinate_type resizing,
+ coordinate_type resizing,
RoundingOption rounding,
- CornerOption corner,
+ CornerOption corner,
bool hole, polygon_45_with_holes_concept ) {
insert_with_resize_dispatch(poly, resizing, rounding, corner, hole, polygon_45_concept());
for(typename polygon_with_holes_traits<geometry_type>::iterator_holes_type itr =
@@ -1171,11 +1171,11 @@
}
clear();
insert(polys.begin(), polys.end());
- dirty_ = true;
+ dirty_ = true;
unsorted_ = true;
return *this;
}
-
+
template <typename Unit>
inline polygon_45_set_data<Unit>& polygon_45_set_data<Unit>::scale_up(typename coordinate_traits<Unit>::unsigned_area_type factor) {
scale_up_vertex_45_compact_range(data_.begin(), data_.end(), factor);
@@ -1193,7 +1193,7 @@
}
clear();
insert(polys.begin(), polys.end());
- dirty_ = true;
+ dirty_ = true;
unsorted_ = true;
return *this;
}
@@ -1209,7 +1209,7 @@
}
clear();
insert(polys.begin(), polys.end());
- dirty_ = true;
+ dirty_ = true;
unsorted_ = true;
return *this;
}
@@ -1245,7 +1245,7 @@
typename boolean_op_45<Unit2>::template Scan45<typename boolean_op_45<Unit2>::Count2,
typename boolean_op_45<Unit2>::template boolean_op_45_output_functor<op> > scan45;
std::vector<typename boolean_op_45<Unit2>::Vertex45> eventOut;
- typedef std::pair<typename boolean_op_45<Unit2>::Point,
+ typedef std::pair<typename boolean_op_45<Unit2>::Point,
typename boolean_op_45<Unit2>::template Scan45CountT<typename boolean_op_45<Unit2>::Count2> > Scan45Vertex;
std::vector<Scan45Vertex> eventIn;
typedef std::vector<typename polygon_45_formation<Unit2>::Vertex45Compact> value_type;
@@ -1271,7 +1271,7 @@
result_data.back().count += eventOut[i];
++ptCount;
} else {
- if(!result_data.empty()) {
+ if(!result_data.empty()) {
if(result_data.back().count.is_45()) {
result_is_manhattan_ = false;
}
@@ -1291,24 +1291,24 @@
x = currentX;
}
//std::cout << "get next\n";
- if(iter2 != end2 && (iter1 == end1 || iter2->pt.x() < iter1->pt.x() ||
+ if(iter2 != end2 && (iter1 == end1 || iter2->pt.x() < iter1->pt.x() ||
(iter2->pt.x() == iter1->pt.x() &&
iter2->pt.y() < iter1->pt.y()) )) {
//std::cout << "case1 next\n";
eventIn.push_back(Scan45Vertex
- (iter2->pt,
+ (iter2->pt,
typename polygon_45_formation<Unit2>::
Scan45Count(typename polygon_45_formation<Unit2>::Count2(0, iter2->count[0]),
typename polygon_45_formation<Unit2>::Count2(0, iter2->count[1]),
typename polygon_45_formation<Unit2>::Count2(0, iter2->count[2]),
typename polygon_45_formation<Unit2>::Count2(0, iter2->count[3]))));
++iter2;
- } else if(iter1 != end1 && (iter2 == end2 || iter1->pt.x() < iter2->pt.x() ||
+ } else if(iter1 != end1 && (iter2 == end2 || iter1->pt.x() < iter2->pt.x() ||
(iter1->pt.x() == iter2->pt.x() &&
iter1->pt.y() < iter2->pt.y()) )) {
//std::cout << "case2 next\n";
eventIn.push_back(Scan45Vertex
- (iter1->pt,
+ (iter1->pt,
typename polygon_45_formation<Unit2>::
Scan45Count(
typename polygon_45_formation<Unit2>::Count2(iter1->count[0], 0),
@@ -1319,15 +1319,15 @@
} else {
//std::cout << "case3 next\n";
eventIn.push_back(Scan45Vertex
- (iter2->pt,
+ (iter2->pt,
typename polygon_45_formation<Unit2>::
- Scan45Count(typename polygon_45_formation<Unit2>::Count2(iter1->count[0],
+ Scan45Count(typename polygon_45_formation<Unit2>::Count2(iter1->count[0],
iter2->count[0]),
- typename polygon_45_formation<Unit2>::Count2(iter1->count[1],
+ typename polygon_45_formation<Unit2>::Count2(iter1->count[1],
iter2->count[1]),
- typename polygon_45_formation<Unit2>::Count2(iter1->count[2],
+ typename polygon_45_formation<Unit2>::Count2(iter1->count[2],
iter2->count[2]),
- typename polygon_45_formation<Unit2>::Count2(iter1->count[3],
+ typename polygon_45_formation<Unit2>::Count2(iter1->count[3],
iter2->count[3]))));
++iter1;
++iter2;
@@ -1343,7 +1343,7 @@
result_data.back().count += eventOut[i];
++ptCount;
} else {
- if(!result_data.empty()) {
+ if(!result_data.empty()) {
if(result_data.back().count.is_45()) {
result_is_manhattan_ = false;
}
@@ -1394,7 +1394,7 @@
result_data.back().count += eventOut[i];
++ptCount;
} else {
- if(!result_data.empty()) {
+ if(!result_data.empty()) {
if(result_data.back().count.is_45()) {
result_is_manhattan_ = false;
}
@@ -1415,7 +1415,7 @@
}
//std::cout << "get next\n";
eventIn.push_back(Scan45Vertex
- (iter1->pt,
+ (iter1->pt,
Scan45Count( typename boolean_op_45<Unit2>::Count1(iter1->count[0]),
typename boolean_op_45<Unit2>::Count1(iter1->count[1]),
typename boolean_op_45<Unit2>::Count1(iter1->count[2]),
@@ -1432,7 +1432,7 @@
result_data.back().count += eventOut[i];
++ptCount;
} else {
- if(!result_data.empty()) {
+ if(!result_data.empty()) {
if(result_data.back().count.is_45()) {
result_is_manhattan_ = false;
}
@@ -1454,9 +1454,9 @@
return result_is_manhattan_;
}
- template <typename cT, typename iT>
+ template <typename cT, typename iT>
void get_error_rects_shell(cT& posE, cT& negE, iT beginr, iT endr) {
- typedef typename iT::value_type Point;
+ typedef iT::value_type Point;
typedef typename point_traits<Point>::coordinate_type Unit;
typedef typename coordinate_traits<Unit>::area_type area_type;
Point pt1, pt2, pt3;
@@ -1494,7 +1494,7 @@
const Point& pt = *beginr;
pt3 = pt;
++beginr;
- if(beginr == endr) {
+ if(beginr == endr) {
next_to_last = true;
//skip last point equal to first
continue;
@@ -1509,7 +1509,7 @@
if(dir == CLOCKWISE) {
posE.push_back(rectangle_data<typename Point::coordinate_type>
(x(pt2) - 1, y(pt2) - 1, x(pt2) + 1, y(pt2) + 1));
-
+
} else {
negE.push_back(rectangle_data<typename Point::coordinate_type>
(x(pt2) - 1, y(pt2) - 1, x(pt2) + 1, y(pt2) + 1));
@@ -1519,8 +1519,8 @@
pt2 = pt3;
}
}
-
- template <typename cT, typename pT>
+
+ template <typename cT, typename pT>
void get_error_rects(cT& posE, cT& negE, const pT& p) {
get_error_rects_shell(posE, negE, p.begin(), p.end());
for(typename pT::iterator_holes_type iHb = p.begin_holes();
@@ -1555,16 +1555,16 @@
#endif
if(op == 0) {
output.applyBooleanBinaryOp(l90sd.begin(), l90sd.end(),
- r90sd.begin(), r90sd.end(), boolean_op::BinaryCount<boolean_op::BinaryOr>());
+ r90sd.begin(), r90sd.end(), boolean_op::BinaryCount<boolean_op::BinaryOr>());
} else if (op == 1) {
output.applyBooleanBinaryOp(l90sd.begin(), l90sd.end(),
- r90sd.begin(), r90sd.end(), boolean_op::BinaryCount<boolean_op::BinaryAnd>());
+ r90sd.begin(), r90sd.end(), boolean_op::BinaryCount<boolean_op::BinaryAnd>());
} else if (op == 2) {
output.applyBooleanBinaryOp(l90sd.begin(), l90sd.end(),
- r90sd.begin(), r90sd.end(), boolean_op::BinaryCount<boolean_op::BinaryNot>());
+ r90sd.begin(), r90sd.end(), boolean_op::BinaryCount<boolean_op::BinaryNot>());
} else if (op == 3) {
output.applyBooleanBinaryOp(l90sd.begin(), l90sd.end(),
- r90sd.begin(), r90sd.end(), boolean_op::BinaryCount<boolean_op::BinaryXor>());
+ r90sd.begin(), r90sd.end(), boolean_op::BinaryCount<boolean_op::BinaryXor>());
}
#ifdef BOOST_POLYGON_MSVC
#pragma warning (default: 4127)
@@ -1591,7 +1591,7 @@
lvalue_data.reserve(data_.size());
for(std::size_t i = 0 ; i < data_.size(); ++i) {
const Vertex45Compact& vi = data_[i];
- Vertex45Compact2 ci;
+ Vertex45Compact2 ci;
ci.pt = point_data<Unit2>(x(vi.pt), y(vi.pt));
ci.count = typename polygon_45_formation<Unit2>::Vertex45Count
( vi.count[0], vi.count[1], vi.count[2], vi.count[3]);
@@ -1710,7 +1710,7 @@
lvalue_data.reserve(data_.size());
for(std::size_t i = 0 ; i < data_.size(); ++i) {
const Vertex45Compact& vi = data_[i];
- Vertex45Compact2 ci;
+ Vertex45Compact2 ci;
ci.pt.x(static_cast<Unit>(x(vi.pt)));
ci.pt.y(static_cast<Unit>(y(vi.pt)));
ci.count = typename polygon_45_formation<Unit2>::Vertex45Count
@@ -1788,11 +1788,11 @@
public:
inline property_merge_45() : tsd_() {}
inline property_merge_45(const property_merge_45& that) : tsd_(that.tsd_) {}
- inline property_merge_45& operator=(const property_merge_45& that) {
- tsd_ = that.tsd_;
+ inline property_merge_45& operator=(const property_merge_45& that) {
+ tsd_ = that.tsd_;
return *this;
}
-
+
inline void insert(const polygon_45_set_data<coordinate_type>& ps, property_type property) {
ps.clean();
polygon_45_property_merge<big_coord, property_type>::populateMergeSetData(tsd_, ps.begin(), ps.end(), property);
@@ -1845,12 +1845,12 @@
inline connectivity_extraction_45() : tsd_(), nodeCount_(0) {}
inline connectivity_extraction_45(const connectivity_extraction_45& that) : tsd_(that.tsd_),
nodeCount_(that.nodeCount_) {}
- inline connectivity_extraction_45& operator=(const connectivity_extraction_45& that) {
- tsd_ = that.tsd_;
+ inline connectivity_extraction_45& operator=(const connectivity_extraction_45& that) {
+ tsd_ = that.tsd_;
nodeCount_ = that.nodeCount_; {}
return *this;
}
-
+
//insert a polygon set graph node, the value returned is the id of the graph node
inline unsigned int insert(const polygon_45_set_data<coordinate_type>& ps) {
ps.clean();
@@ -1863,7 +1863,7 @@
ps.insert(geoObj);
return insert(ps);
}
-
+
//extract connectivity and store the edges in the graph
//graph must be indexable by graph node id and the indexed value must be a std::set of
//graph node id
Modified: trunk/boost/polygon/segment_concept.hpp
==============================================================================
--- trunk/boost/polygon/segment_concept.hpp (original)
+++ trunk/boost/polygon/segment_concept.hpp 2012-05-07 15:40:35 EDT (Mon, 07 May 2012)
@@ -7,6 +7,7 @@
*/
#ifndef BOOST_POLYGON_SEGMENT_CONCEPT_HPP
#define BOOST_POLYGON_SEGMENT_CONCEPT_HPP
+
#include "isotropy.hpp"
#include "segment_data.hpp"
#include "segment_traits.hpp"
@@ -603,54 +604,12 @@
return false;
if (consider_touch || or1_1 && or1_2 || or2_1 && or2_2)
return true;
- if (or1_1 || or1_2 || or2_1 || or2_2)
+ if (or1_1 || or1_2)
return false;
return intersects(vertical(rect1), vertical(rect2), false) ||
intersects(horizontal(rect1), horizontal(rect2), false);
}
- struct y_s_intersect : gtl_yes {};
-
- // Set point to the intersection of segment and b
- template <typename Point, typename Segment1, typename Segment2>
- typename enable_if<
- typename gtl_and_4<
- y_s_intersect,
- typename is_mutable_point_concept<
- typename geometry_concept<Point>::type
- >::type,
- typename is_segment_concept<
- typename geometry_concept<Segment1>::type
- >::type,
- typename is_segment_concept<
- typename geometry_concept<Segment2>::type
- >::type
- >::type,
- bool
- >::type
- intersection(Point& intersection,
- const Segment1& segment1,
- const Segment2& segment2,
- bool projected = false,
- bool round_closest = false) {
- typedef polygon_arbitrary_formation<
- typename segment_coordinate_type<Segment1>::type
- > paf;
- typename paf::Point pt;
- typename paf::Point l1, h1, l2, h2;
- assign(l1, low(segment1));
- assign(h1, high(segment1));
- assign(l2, low(segment2));
- assign(h2, high(segment2));
- typename paf::half_edge he1(l1, h1), he2(l2, h2);
- typename paf::compute_intersection_pack pack;
- if (pack.compute_intersection(pt, he1, he2, projected, round_closest)) {
- assign(intersection, pt);
- return true;
- }
- return false;
- }
-
struct y_s_e_dist : gtl_yes {};
template <typename Segment, typename Point>
@@ -687,7 +646,7 @@
}
if (length_sq == 0.0)
return 0.0;
- Unit denom = sqrt(length_sq);
+ Unit denom = std::sqrt(length_sq);
Unit result = (A * D - C * B) / denom;
return (result < 0.0) ? -result : result;
}
Modified: trunk/boost/polygon/voronoi_builder.hpp
==============================================================================
--- trunk/boost/polygon/voronoi_builder.hpp (original)
+++ trunk/boost/polygon/voronoi_builder.hpp 2012-05-07 15:40:35 EDT (Mon, 07 May 2012)
@@ -153,7 +153,7 @@
void init_sites_queue() {
// Sort site events.
- sort(site_events_.begin(), site_events_.end(),
+ std::sort(site_events_.begin(), site_events_.end(),
event_comparison_predicate());
// Remove duplicates.
Modified: trunk/libs/polygon/test/gtl_boost_unit_test.cpp
==============================================================================
--- trunk/libs/polygon/test/gtl_boost_unit_test.cpp (original)
+++ trunk/libs/polygon/test/gtl_boost_unit_test.cpp 2012-05-07 15:40:35 EDT (Mon, 07 May 2012)
@@ -3707,9 +3707,6 @@
assert_s(intersects(dls1, dls3), "intersects1");
assert_s(!intersects(dls1, segment_data<int>(Point(2, 0), Point(3, 0))), "intersects2");
assert_s(abuts(dls1, dls2), "abuts");
- Point p;
- bool ir = intersection(p, dls1, dls2);
- std::cout << ir << " " << p << std::endl;
}
std::cout << "ALL TESTS COMPLETE\n";
Modified: trunk/libs/polygon/test/polygon_segment_test.cpp
==============================================================================
--- trunk/libs/polygon/test/polygon_segment_test.cpp (original)
+++ trunk/libs/polygon/test/polygon_segment_test.cpp 2012-05-07 15:40:35 EDT (Mon, 07 May 2012)
@@ -160,17 +160,25 @@
point_type point7(100, 201);
point_type point8(100, 200);
point_type point9(100, 199);
- segment_type segment = construct<segment_type>(point1, point2);
+ segment_type segment1 = construct<segment_type>(point1, point2);
+ segment_type segment2 = construct<segment_type>(point2, point1);
+ segment_type segment3 = construct<segment_type>(point1, point5);
- BOOST_CHECK(on_above_or_below(segment, point1) == 0);
- BOOST_CHECK(on_above_or_below(segment, point2) == 0);
- BOOST_CHECK(on_above_or_below(segment, point3) == 0);
- BOOST_CHECK(on_above_or_below(segment, point4) == 0);
- BOOST_CHECK(on_above_or_below(segment, point5) == 1);
- BOOST_CHECK(on_above_or_below(segment, point6) == -1);
- BOOST_CHECK(on_above_or_below(segment, point7) == 1);
- BOOST_CHECK(on_above_or_below(segment, point8) == 0);
- BOOST_CHECK(on_above_or_below(segment, point9) == -1);
+ BOOST_CHECK(on_above_or_below(segment1, point1) == 0);
+ BOOST_CHECK(on_above_or_below(segment1, point2) == 0);
+ BOOST_CHECK(on_above_or_below(segment1, point3) == 0);
+ BOOST_CHECK(on_above_or_below(segment1, point4) == 0);
+ BOOST_CHECK(on_above_or_below(segment1, point5) == 1);
+ BOOST_CHECK(on_above_or_below(segment2, point5) == 1);
+ BOOST_CHECK(on_above_or_below(segment1, point6) == -1);
+ BOOST_CHECK(on_above_or_below(segment2, point6) == -1);
+ BOOST_CHECK(on_above_or_below(segment1, point7) == 1);
+ BOOST_CHECK(on_above_or_below(segment2, point7) == 1);
+ BOOST_CHECK(on_above_or_below(segment1, point8) == 0);
+ BOOST_CHECK(on_above_or_below(segment1, point9) == -1);
+ BOOST_CHECK(on_above_or_below(segment2, point9) == -1);
+ BOOST_CHECK(on_above_or_below(segment3, point6) == -1);
+ BOOST_CHECK(on_above_or_below(segment3, point3) == 1);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(segment_concept_test3, T, test_types) {
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