Geometry :

Subject: Re: [geometry] Index distance predicates names
Date: 2012-08-26 16:56:24

Hi,

I'm testing the r-tree implementation and have problem with some names.
I've been using near() and far() but these are macros defined in
windows.h. Since the r-tree isn't released yet, the simplest way of
fixing it is to change names. But first, I'll explain what are those
predicates.

R-tree allows to store volumetric values (boxes) and find some number of
them nearest to some point. It is possible to define which point of
volumetric object is taken in distance calculation. It may be the
nearest point, the centroid or the furthest point. This corresponds to
functions bgi::near(), bgi::centroid() and bgi::far().

bgi stands for boost::geometry::index namespace.

To complicate things. There is also a method rtree.nearest(Predicate)
and function bgi::nearest(rtree, Predicate). So knn query may look like
this:

tree.nearest(bgi::near(pt), output);
bgi::nearest(tree, bgi::near(pt), output);
tree | bgi::filters::nearest_filtered(bgi::near(pt))

or this:

bgi::nearest(
tree,
bgi::bounded(
bgi::near(pt),
bgi::centroid(10),
bgi::far(20)
), output);

Some names may form non-intuitive query, e.g.:

bgi::nearest(tree, bgi::nearest(pt), output);

What is more, I'd rather avoid furthest() because it is nice antonym of
nearest() and may be used as similar function name.

To the point. Possible names are:

near -> nearest, close, closest
far -> furthest, distant, most_distant

Do you have any preferences or other ideas?

Regards,