Boost logo

Geometry :

Subject: [ggl] Within polygon detection including the polygon borders
From: Bruno Lalande (bruno.lalande)
Date: 2009-09-19 14:08:01


As said by Ivan, he contacted me privately and I was able to
reproduce. The within algorithm returns positive results for some
points that are obviously outside (the sample program sent by Ivan
shows it quite clearly). Unfortunately I'm very busy and was not able
to debug further (I had only debugged until the within applied on the
outer ring of the polygon, which erroneously returns true in some

I hope I'll have the time to see that tomorrow.


On Fri, Sep 18, 2009 at 10:50 PM, Ivan Marin <ispmarin_at_[hidden]> wrote:
> Hello Mr. Barends,
> 2009/9/18 Barend Gehrels <Barend.Gehrels_at_[hidden]>
>> Hi Ivan,
>> Sorry for my very late reaction. I was on holiday from Sep 3 on.
>>> I successfully compiled the examples
>> Does this mean I can ignore your other question of Sep 3?
> I was able to compile the examples, but what I did was kind of a hack: I've
> just copied the directory geometry to /usr/include. Putting it on the local
> directory or inside the boost directory did not work, and I was puzzled by
> that. But it is working.
>>> and now I'm trying to use the ggl. I need to check if a point is inside a
>>> polygon, and I want to consider de borders as part of the polygon. Is this
>>> possible in ggl? All the tests that I've made showed me that this is not
>>> possible.
>> That is right, currently it is not possible. We will have another function
>> which can be used for this question. It will either be an option of
>> "within", or it you could use the "distance" function on point-polygon,
>> which is zero or if the polygon is on the border or inside. Actually the
>> last one can also be discussed, if the point is inside the polygon, it could
>> be less than zero or also as an option.
> Ok, I see. Now I've developed my theory that if I can say if the point is
> just inside the polygon will suffice. The problem now that I was discussing
> with Bruno is that there is a case where the routine within is not working
> properly: if I define a polygon with vertices 100 100, 200 100, 200 200, 100
> 200, and search for all the points inside the polygon, the routine outputs
> points that are not inside the polygon as inside. Bruno was able to
> reproduce this bug. I attached the code that I used to produce this problem.
> Is there a proper place to submit a bug report, or is any more data needed?
> I'm willing to help, and if possible, even debug.
>> But both are currently not implemented.
> Thank you very much!
> Best regards,
> Ivan Marin
> Laborat?rio de Hidr?ulica Computacional - Computational Hydraulics Lab - LHC
> Depto de Hidr?ulica e Saneamento - Sanitation and Hydraulics Dept.
> Escola de Engenharia de S?o Carlos - Universidade de S?o Paulo - EESC - USP
>> Best regards,
>> Barend Gehrels
>> Geodan, Amsterdam
>> _______________________________________________
>> ggl mailing list
>> ggl_at_[hidden]

Geometry list run by mateusz at