Boost logo

Geometry :

Subject: [geometry] distance between geometries
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2013-09-01 09:36:37


I'd like to expose some functionalities that are currently in
index::detail to the user, the algorithms calculating:
- the shortest and longest comparable distance,
- the comparable distance on a path (linestring or segment) to the first
intersected geometry from the first path's point or even from some
intermediate position on the path.

I'd like to expose them to allow users passing a strategy to nearest()
predicate. The user would be able to define how the distance is
calculated. The same predicate would work as knn queries (1) or ray
queries (2).

The use case would e.g. look like this:

1. return 5 buildings (Box) nearest to the river (LineString)

tree.query(nearest(river, 5, shortest_distance), out_it);

2. return 5 bridges (Box) nearest to the begin point(or current
location) along the river (LineString) to the north.

tree.query(nearest(river, 5, path_distance), out_it);
tree.query(nearest(river, 5, path_distance(location)), out_it); // maybe

The user would also be able to use the distance to the Geometry related
to the stored bounding box, not only the distance to the bounding box.

Do you think that they're good candidates not only for the BGI but also
for the entire BG? In other words should they be implemented in the
boost::geometry or boost::geometry::index namespace? Also do you have an
idea for the name? Currently I'm using comparable_distance_near() and
comparable_distance_far(). Should they have separate names or e.g. be
implemented as bg::comparable_distance with strategy (probably empty)?


Geometry list run by mateusz at