Boost logo

Boost :

Subject: [boost] [Boost.Geometry] Extend spatial predicates to 1D segments?
From: Lukas Barth (lists_at_[hidden])
Date: 2016-02-17 01:28:37


Hi,

I'm using the rtree in Boost.Geometry to store one-dimensional intervals
(as segments of one-dimensional points). There may be better suited
libraries out there for this task, but I had Boost.Geometry in my
project for some 2D-Rtree anyways, and since it is generic, it should be
up to the task.

I needed to query the 1D segments in the rtree for overlaps and got a
nasty looking "not implemented" error when trying to compile. Basically,
this is what I tried to do:

typedef bgm::point<double, 1, coordinate_system_type> Point1D;
typedef bgm::segment<Point1D> Interval;
typedef bgi::rtree<Interval, bgi::quadratic<3>> Tree;

mytree.query(bgi::intersects(make_interval(from,to)));

(where "make_interval" is a helper that returns an interval from two
doubles)

Digging through the Boost.Geometry code (and I won't claim I fully
understood the template magic), I found in

/usr/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp

the following piece:

template <typename Segment1, typename Segment2>
struct disjoint<Segment1, Segment2, 2, segment_tag, segment_tag, false>
    : detail::disjoint::disjoint_segment<Segment1, Segment2>
{};

And, more importantly, I did not find a similar piece of code with a "1"
as third template parameter. Thus, I assume that the 'disjoint'
predicate is just not implemented for one-dimensional segments.

I added that predicate for my project, and now I'm wondering whether a
full set of spatial predicates would be desirable for one-dimensional
segments.

In other words: If I came up with a patch adding those predicates, would
it be considered?

Regards,

Lukas


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk