# Boost Users :

Subject: [Boost-users] logic operation in boost polygon
From: HxH (huangxinheng_at_[hidden])
Date: 2011-05-10 12:17:52

Help!
I wrote this function to load the data point to a boost polygon.

typedef vector&lt;polygon_data&lt;int&gt; > LayoutSet;
static void addPolygonData(LayoutSet &sets,int* points,int size){
polygon_data<int> poly_data;
vector&lt;point_data&lt;int&gt; > poly_points(size);
for(int i=0;i&lt;size;i++)
{
int x=i*2;
int y=x+1;
poly_points[i]=point_data&lt;int&gt;(points[x],points[y]);
}
poly_data.set(poly_points.begin(),poly_points.end());
sets.push_back(poly_data);
}
Then I load two sets of points
int p1[8]={1200 2400 1200 3600 4000 3600 4000 2400};
int p2[8]={1800 600 1800 4700 3500 4700 3500 600};
LayoutSet group_2;
LayoutSet group_1;
boost::polygon::assign(group_2,group_1[0] & group_1[1]); // Here I do the
logic operation & (AND)

vector&lt;point_data&lt;int&gt; > pts;
pts.insert(pts.begin(),group_2[0].begin(),group[0].end());

for(size_t i=0;i<group_2[0].size();i++){
cout<<pts[i].x()<<","<<pts[i].y()<<endl;
}

Here is the result I get:

6484944,0
3500,600
3500,3600
1800,3600
1800,600
3,1
0,0
6484944,0

It doesn't look correct. It gives me a hard time to fix it. Any suggestions
are welcome!!

Thank you!

```--
View this message in context: http://boost.2283326.n4.nabble.com/logic-operation-in-boost-polygon-tp3512369p3512369.html
Sent from the Boost - Users mailing list archive at Nabble.com.
```