Boost logo

Geometry :

Subject: Re: [geometry] Compiling intersection() after registering custom point for use with the model box, ring and polygon
From: Andrew Hundt (athundt_at_[hidden])
Date: 2014-06-03 14:40:06


On Mon, Jun 2, 2014 at 4:06 PM, Adam Wulkiewicz <adam.wulkiewicz_at_[hidden]>
wrote:

> Hi Andrew,
>
> To compile it I was forced to add some missing headers. Sorry that I
> didn't write it in the last email. The following code compiles for me
> (using Boost.Geometry develop branch) on Linux GCC 4.8 and Clang 3.4:
>
> #include <boost/geometry.hpp>
> #include <boost/geometry/multi/geometries/multi_polygon.hpp>
> #include <boost/geometry/geometries/register/point.hpp>
>
>
> struct legacy_point
> {
>
> double x, y;
>
> };
>
> BOOST_GEOMETRY_REGISTER_POINT_2D(legacy_point, double,
> boost::geometry::cs::cartesian, x, y)
>
> int main()
>
> {
> boost::geometry::model::box<legacy_point> box;
> boost::geometry::model::ring<legacy_point> ring;
> boost::geometry::model::multi_polygon<
> boost::geometry::model::polygon<legacy_point> > mpoly;
>
> boost::geometry::intersection(box, ring, mpoly);
>
> }
>
> If case the above doesn't help, please write which compiler do you use and
> which Boost version?
>

That worked perfectly, thanks! I guess I got confused by the Behavior:
GeometryOut is a polygon section. Perhaps it should read Behavior:
GeometryOut is a MultiPolygon?

Also, while the error messages do make it clear that the geometry type I'm
passing isn't supported, what if there were comments or documentation
explaining how to work around or diagnose such issues?

Cheers!
Andrew Hundt



Geometry list run by mateusz at loskot.net