Boost logo

Geometry :

Subject: [ggl] Point in triangle test available?
From: Barend Gehrels (barend.gehrels)
Date: 2010-12-02 13:38:35


hi Hartmut,

> It compiles fine as long as I use a point_xy<double>, but fails to compile
> the algorithms when using point_ll_deg as the point type. Is that not
> implemented yet? Or did I miss some header file for the concept mapping?

No, it is true that it didn't compile. Sorry for that.

The winding algorithm is agnostic and depends only on the "side"
algorithm. Which is there for cartesian and spherical (and, so,
geographic). Therefore it should run.

Unfortunately the side-for-spherical was in first phase and not really
tested, I just relooked at it and it needs some extra care. It does not
always gives the correct results. At least not for my Wrangel case,
which is actually a quite challenging case (most tools I used today fail
in a way for it...).

Do you need the point_ll_deg?

If you do, you can include the lines below somewhere in your code as a
temporary fix, it just defines the types to be used.

Regards, Barend

#include <boost/geometry/strategies/spherical/side_by_cross_track.hpp>

namespace boost { namespace geometry
{

// Register side-by-cross-track for geographic type
template <typename Type>
struct strategy_side<geographic_tag, Type>
{
     typedef strategy::side::side_by_cross_track<Type> type;
};

// Register winding for geographic type
namespace strategy { namespace within { namespace services
{

template <typename Point, typename PointOfSegment, typename AnyPolygonTag>
struct default_strategy<point_tag, AnyPolygonTag, geographic_tag,
geographic_tag, Point, PointOfSegment>
{
     typedef winding<Point, PointOfSegment> type;
};

}}} // namespace strategy::within::services
}} // namespace boost::geometry


Geometry list run by mateusz at loskot.net