Boost logo

Boost Users :

Subject: [Boost-users] Polygon, accessing Points_Data
From: AmandaLind (abl128_at_[hidden])
Date: 2011-04-12 21:11:05

This is my first post here. Please help me as I am stuck on how to access
the points defining the new polygon generated with two other polygons and a
boolean operation.

I am having a hard time with using the iterators properly. The code runs
well up to that point.

Thanks in advance,

       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;
        Point pts1[numcorners1];
        for (int index=0; index<numcorners1; index++)
        Polygon poly1;
        gtl::set_points(poly1, pts1, pts1+numcorners1);
        //Polygon 2
        Point pts2[numcorners2];
        for (int index=0; index<numcorners2; index++)
            //mult by 1000 because it rounds to integers.
        Polygon poly2;
        gtl::set_points(poly2, pts2, pts2+numcorners2);
        using namespace boost::polygon::operators;
        Polygon poly3;
        poly3 = poly1 & poly2;
        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)

View this message in context:
Sent from the Boost - Users mailing list archive at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at