Boost logo

Boost :

Subject: Re: [boost] Adapting Polygon to work with point attributes
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2012-03-01 14:20:31

From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On Behalf Of Paul Miller
>Boost::Polygon looks like exactly what I need to do some boolean operations on polygons but my polygons have additional attributes
>per point that I want to carry through the operation.
>But I can't figure out how to get polygon to create sensible values for the attributes other than X,Y, and I can't find an example that covers this scenario.
>It seems from the documentation that this is possible however. Can someone point me to an example, to say, adapt a polygon with this Point type?
>struct Point {
> int x, y;
> float r, g, b, a;
>Ideally it would average new r, g, b, a values together to make new points and polygon join points, but it could just copy one of the existing Points' attributes instead. I'm not picky.

This has been requested in the past. Unfortunately it is not currently supported. It would require some significant implementation effort to plumb generic properties all the way through the algorithm and provide customization points for the attribute merge policy. I have in the trunk the code for doing general line segment intersection, which gives you intersected line segments at the output that have an ID associated with the input line segment they came from. Intersection points would then know which line segments gave rise to them. If you ran that and the polygon clipping algorithm then you can lookup your output line segments in the result of line segment intersection to figure out which input line segments they came from and get the properties from the original input and annotate your output, including whatever averaging and interpolating you might want to do. I'm hoping to release line segment concepts and the generalized line segment intersection interface in Boost 1.50 or 1.51, so you can start using it from the trunk now and expect it to become available in an official release fairly soon.


Boost list run by bdawes at, gregod at, cpdaniel at, john at