Boost logo

Geometry :

Subject: Re: [geometry] distance_info function
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2013-09-30 16:32:44


Hi,

Claus Christmann wrote:
> Hi boost::geometry
>
> I only recently started to read this email list after I found http://boost-geometry.203548.n3.nabble.com/distance-between-geometries-tp4025549p4025550.html , which google dug up for me when searching for a
> method to find the closes point on a geometry.
>
> (When I say closest point, I mean the green point in http://boost-geometry.203548.n3.nabble.com/attachment/4025550/1/ffgdbgcd.png when asking for
> what is the point of the blue polygon closest to the red point.)
>
> >From what I understand from that post there currently is no "easy" way to get
> the point distance found as being the closest, i.e. something like
> "point green = bg::closest(point red, polygon blue);"
>
> My question(s) at this point are whether there is a chance to get access to
> the mentioned distance_info function, or if somebody could point me to another
> function that is able to get the closest (potentially projected) point in
> another geometry or whether I should start to hack distance.hpp and
> distance_projected_point.hpp to get me access to the closest point.
>
> Thank you very much for any and all hints and pointers.
>

AFAIK there isn't any "official" way of obtaining the closest point. For
now, as you've written, you probably can modify
bg::strategy::distance::projected_point
(boost/geometry/strategies/cartesian/distance_projected_point.hpp) to
return also the projected point, not only the distance. And above this
build your version of distance() using one or all of those structs:
bg::detail::distance::point_to_polygon ->
bg::detail::distance::point_to_ring ->
bg::detail::distance::point_to_range defined in
boost/geometry/algorithms/distance.hpp.

To get more detailed answer about the distance_info you probably should
wait for Barend.

Regards,
Adam


Geometry list run by mateusz at loskot.net