AmandaLind wrote:
This is the last time I bump this in hope of help...
You should be a little more patient, I read the list every day and search for Polygon in the subject line.
namespace gtl = boost::polygon; using namespace boost::polygon::operators; using namespace gtl;
//lets construct the two polygons typedef gtl::polygon_data Polygon; typedef gtl::polygon_traits::point_type Point;
Both polygon_data and polygon_traits are templates, so the above code doesn't appear legal. You need to specify the coordinate type for polygon data and the polygon type for polygon traits. ...
Polygon poly1; gtl::set_points(poly1, pts1, pts1+numcorners1);
...
Polygon poly2; gtl::set_points(poly2, pts2, pts2+numcorners2);
using namespace boost::polygon::operators;
Polygon poly3; poly3 = poly1 & poly2;
The above code should not compile because the result of a boolean AND between two polygons can be zero, one or many polygons. It must be stored to a model of polygon set concept. The polygon_data assignment operator should not accept the operator template produced by &.
Point pts3[poly3.size()];
//how does one use iterators ?! std::vector<point_data<int> >::iterator itr ; itr= poly3.begin(); int index=0 for(itr; itr != ploy3.end(); ++itr) { pts3(index)=*itr; index++; }
They are just like stl iterators (in fact they are std::vector iterators in this case.) Just do:
std::vector