Boost logo

Geometry :

Subject: [ggl] Point in triangle test available?
From: Mateusz Loskot (mateusz)
Date: 2010-12-02 08:45:29


On 02/12/10 02:44, Hartmut Kaiser wrote:
>>> Does Boost.Geometry have a pre-canned 'point in triangle' test
>>> available? I could come up with one myself easily, but asking might
>>> allow me to stay lazy :-P
>>
>> There is point in polygon, of course. I'm not sure of the syntax
>> required, however.
>
> For the sake of simplicity, I implemented this function for my use case:
>[...]

Yesterday, I tried the barycentric approach I mentioned and it seems to
work, though not with the boundary cases. It does not use the within
algorithm, thus may perform slightly faster. I've attached my version.

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
Member of ACCU, http://accu.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geometry_point_in_triangle.cpp
Type: text/x-c++src
Size: 2376 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/ggl/attachments/20101202/cf5348a2/geometry_point_in_triangle.bin

Geometry list run by mateusz at loskot.net