Boost logo

Geometry :

Subject: Re: [geometry] is it possible to get (more) information from bg::intersects?
From: Barend Gehrels (barend_at_[hidden])
Date: 2013-12-11 08:37:25


Hi Mats,

Mateusz Loskot wrote On 11-12-2013 13:00:
> On 11 December 2013 11:27, Mats Taraldsvik <mats.taraldsvik_at_[hidden]> wrote:
>>> I'm not sure, perhaps you mean this internal utility?
>>> boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp
>> Perhaps. I must admit I do not fully understand TurnInfo. Could you give me
>> an example of how to use it to get the location(s) of intersections, please?
>> Ideally, it would be exposed in a user-facing algorithm/feature.
> It is an internal detail of overlay algos, AFAIU, it's deliberately
> not exposed to public,
> so I have no idea if it could be exposed as a feature.
> AFAIR, this utility has changed over time.
> It used to return range (i.e. std::vector) of simply intersection points,
> now it returns a richer structure, turn_info, but it contains point,
> turn_info::point member.
>
> I haven't tested it after the changes, but it should work something like this:
>
> // G is your BG-enabled geometry type
> typedef bg::detail::overlay::turn_info<typename
> bg::point_type<G>::type> turn_info;
> std::vector<turn_info> turns;
> bg::get_intersection_points(g1, g2, turns);
> for (auto t : turns)
> t.point;
>
> Hopefully, it works as I understand it, otherwise sorry for confusion :)

Additionally, see also:
05_b_overlay_linestring_polygon_example.cpp
where it is used in the context of an example. For the single-geometry
version, use self_turns instead of get_turns

Regards, Barend


Geometry list run by mateusz at loskot.net