Boost logo

Geometry :

Subject: Re: [geometry] is it possible to get (more) information from bg::intersects?
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2013-12-11 07:00:11


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 :)

Best regards,

-- 
Mateusz  Łoskot, http://mateusz.loskot.net

Geometry list run by mateusz at loskot.net