Boost logo

Geometry :

Subject: Re: [geometry] [Search Point in MultiPolygon]
From: Barend Gehrels (barend_at_[hidden])
Date: 2013-08-05 12:22:17


Hi,

On 5-8-2013 17:17, Ederson de Moura wrote:
> Hello guys,
>
> I need to find a point within "MultiPolygon". I'm trying to apply the
> same logic of the "polygon" example:
>
> http://www.boost.org/doc/libs/1_54_0/libs/geometry/doc/html/geometry/reference/algorithms/within/within_2.html
>
> But not to the point the result is always not found. Could someone
> help me?
>
>
> boost::geometry::read_wkt( "MULTIPOLYGON(((0 0, 0 10, 10 10, 10 0, 0
> 0)), ((10 5, 10 15, 20 15, 20 5, 10 5)))", p_multi );
>
> int x = 10;
> int y = 10;

Your point is a cornerpoint of the specified multi-polygon. So it is not
"within". You can use covered_by to detect if a point is
within-or-on-the-border of a (multi)polygon.

Regards, Barend


Geometry list run by mateusz at loskot.net