Boost logo

Geometry :

Subject: [ggl] Point in triangle test available?
From: Hartmut Kaiser (hartmut.kaiser)
Date: 2010-12-02 15:09:11


Barend,

> > 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.
>
> Thanks Mateusz!
>
> I think we can include this in the c04_b_custom_triangle_example.
>
> I don't think we should introduce any triangle concept or refinement in
> the library at this stage. The sample sufficiently shows how things can be
> specialized for triangles.
>
> Hartmut, note that it barycentric approach is working only for Cartesian
> coordinates. I mention that because you asked for point_ll_deg.

Right, at the point when I realized this I fell back to the bg::within() algorithm as shown in the code I posted before. Even more, I believe I'm fine with treating the degrees as being Cartesian for now as the triangles I'm dealing with are really small. Using point_xy<> works just fine, I'll stick to it for the time being.

Thanks for the other posts as well!
Regards Hartmut
---------------
http://boost-spirit.com


Geometry list run by mateusz at loskot.net