Buffer algorithm

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Buffer algorithm

Michael Winkelmann
Hi,

I really appreciate the boost geometry library, as its fast and
well-designed.
However, I miss a buffer/offset algorithm for rings and polygons.

Are there already attempts for implementations?
I need this algorithm very soon (within the next month), so I would
implement it on my own.
If its good enough, I could contribute it to the library.

Kind regards,
Michael
_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry
Reply | Threaded
Open this post in threaded view
|

Re: Buffer algorithm

joan
Hello,

I also need the feature to have a buffer feature in order to go from a linestring to a polygon.  
I have read many posts on the subject but I couldn't manage to compute a buffer using boost 1.54 or trunk.

When will the feature be planned ?
Is there some hacks (using buffer_inserter ...) that enable this computing in the trunk ?

Regards.

Joan Abadie
Reply | Threaded
Open this post in threaded view
|

Re: Buffer algorithm

Barend
Hi Joan,

joan wrote On 21-10-2013 16:08:

> Hello,
>
> I also need the feature to have a buffer feature in order to go from a
> linestring to a polygon.
> I have read many posts on the subject but I couldn't manage to compute a
> buffer using boost 1.54 or trunk.
>
> When will the feature be planned ?
> Is there some hacks (using buffer_inserter ...) that enable this computing
> in the trunk ?
>

Sure, in trunk it is possible, using extensions. The best "example" is
the testcode in test_buffer.hpp

Let me know if I can help more, I did plan to work in this in the near
future again.

It is not yet ready, there are some issues, you may encounter them, but
depending on your cases it might be useful for you.

I cannot yet say when it will be in Release.

Regards, Barend

_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry
Reply | Threaded
Open this post in threaded view
|

Re: Buffer algorithm

joan
Hi Barend,
I have looked at test_buffer.hpp.
It gave me some tips on how to compute a buffer with buffer_inserter but I can't figure out how to define 2 templates : JoinStrategy and EndStrategy.
Could you help me to define them ?

Here is an easy code sample to go from a linestring to a buffered polygon.

typedef boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian> Point_type; 
typedef boost::geometry::model::polygon<Point_type> Polygon_type;///CCW closed cartesian polygon	
typedef boost::geometry::model::linestring<Point_type> LineString_type;///CCW closed cartesian polygon	
typedef boost::geometry::coordinate_type<LineString_type>::type coordinate_type;
typedef Point_type point_type;
typedef Point_type output_point_type;

LineString_type boostTrajectory; //my line string to buffer
//to be initialized here

boost::geometry::strategy::buffer::distance_asymmetric
    <
    coordinate_type
    > 
    distance_strategy(bufferDistance, bufferDistance);

std::vector<Polygon_type> buffered; //buffered result

boost::geometry::buffer_inserter<Polygon_type>(boostTrajectory, std::back_inserter(buffered),
    distance_strategy, 
     ???join_strategy???,
     ???end_strategy???
    );
regards.

Joan Abadie



2013/10/21 Barend Gehrels <[hidden email]>
Hi Joan,

joan wrote On 21-10-2013 16:08:

Hello,

I also need the feature to have a buffer feature in order to go from a
linestring to a polygon.
I have read many posts on the subject but I couldn't manage to compute a
buffer using boost 1.54 or trunk.

When will the feature be planned ?
Is there some hacks (using buffer_inserter ...) that enable this computing
in the trunk ?


Sure, in trunk it is possible, using extensions. The best "example" is the testcode in test_buffer.hpp

Let me know if I can help more, I did plan to work in this in the near future again.

It is not yet ready, there are some issues, you may encounter them, but depending on your cases it might be useful for you.

I cannot yet say when it will be in Release.

Regards, Barend


_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry


_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry
Reply | Threaded
Open this post in threaded view
|

Re: Buffer algorithm

Barend
Hi Joan,

joan ABADIE wrote On 22-10-2013 16:38:
It gave me some tips on how to compute a buffer with buffer_inserter but I can't figure out how to define 2 templates : JoinStrategy and EndStrategy.

They were template-template-parameters, declared in the main program

Anyway, herewith a complete sample program, will be added to the SVN as doc-example.

Be aware that both Join and End strategy will change soon (they will not have the point_type parameter anymore).

Note also that buffer is not yet tested with CCW or Open polygons, better test with CW/Closed.

Regards, Barend



_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry

buffer_linestring.cpp (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Buffer algorithm

joan
Hi Barend,

This is a great example !
Thank you very much.

Joan


2013/10/22 Barend Gehrels <[hidden email]>
Hi Joan,

joan ABADIE wrote On 22-10-2013 16:38:
It gave me some tips on how to compute a buffer with buffer_inserter but I can't figure out how to define 2 templates : JoinStrategy and EndStrategy.

They were template-template-parameters, declared in the main program

Anyway, herewith a complete sample program, will be added to the SVN as doc-example.

Be aware that both Join and End strategy will change soon (they will not have the point_type parameter anymore).

Note also that buffer is not yet tested with CCW or Open polygons, better test with CW/Closed.

Regards, Barend



_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry



_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry