Boost logo

Boost :

Subject: Re: [boost] [Geometry] Wrong results for dissolve Polygon
From: Menelaos Karavelas (menelaos.karavelas_at_[hidden])
Date: 2015-06-12 09:27:04


Dear Andreas,

On 12/06/2015 09:49 πμ, Andreas Wimmer wrote:
> Dear Boost Geometry Contributors,
>

could you please re-post to the Boost.Geometry dedicated mailing list:
geometry_at_[hidden]

Thanks.

- m.

> I am testing the boost::geometry::dissolve function upon some invalid
> polygons that are produced by a certain in-house segmentation alg.
> The fact that the algorithm is producing possibly invalid polygons cannot be
> changed easily so I thought I will fix them afterwards using dissolve from
> “geometry/extensions/algorithms/dissolve.hpp” for the latest boost 1.58 version.
> Unfortunately I stumbled over the following polygons for which dissolve
> produces wrong results.
>
> The following code illustrates the result
>
> using namespace boost::geometry;
> using namespace boost::geometry::model;
> using namespace boost::geometry::model::d2;
>
> int
> main(int argc, _TCHAR* argv[])
> {
> polygon< point_xy<float> > Poly;
> read_wkt("POLYGON((10 10, 10 20, 20 20, 15 12, 15 18, 20 10, 10 10))",
> Poly);
>
> multi_polygon< polygon< point_xy< float > > > Dissolved;
> boost::geometry::dissolve(Poly, Dissolved);
> }
>
> Which results in a polygon including the small intersection part which
> should be excluded from the polygon
>
> And even more problematic the following example (same polygon with and
> additional self-touching outer ring) results in missing the entire main part
> of the polygon
>
> int
> main(int argc, _TCHAR* argv[])
> {
> polygon< point_xy<float> > Poly;
> read_wkt("POLYGON((10 10, 10 20, 20 20, 20 25, 22 25, 20 20, 15 12, 15
> 18, 20 10, 10 10))",
> Poly);
>
> multi_polygon< polygon< point_xy< float > > > Dissolved;
> boost::geometry::dissolve(Poly, Dissolved);
> }
>
> I hope somebody can show me what I did wrong or what I can to too work
> around this problem.
>
> Best regards,
>
>
> Andreas Wimmer
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk