Hi Adam,


On 11 April 2018 at 10:34, Adam Wulkiewicz via Geometry <geometry@lists.boost.org> wrote:
Hi Jeremy,

No, you can pass your segment to existing spatial predicate as usual. E.g. if you pass bgi::intersects(my_segment) into rtree::query() then internally bg::intersects(node_box, my_segment) and bg::intersects(point_value, my_segment) is called. So after overloading bg::intersects() the rtree should just work automatically. Something like this:


I ended up implementing a hemisphere geometry, because I realized that I only need to search in that finite area.


namespace boost { namespace geometry {

template <typename Point>
inline bool intersects(Point const& p, segment_side_region const& s)
{
    return s.intersects_point(p);
}

template <typename Box>
inline bool intersects(Box const& b, segment_side_region const& s)
{
    return s.intersects_box(b);
}

}}

So I implemented these, but then using them with the rtree is not 'simply' working.  :)  
 

// and then simply

segment_side_region region{p0, p1, segment_side_region::right};
some_segment_type segment{p0, p1};
rtree.query(bgi::intersects(region) && bgi::nearest(segment, 5), result);

 At this point the hemisphere geometry fails a concept check on this line from intersects():


.../boost/mpl/assert.hpp:440:42: error: no matching function for call to ‘assertion_failed(mpl_::failed************ (boost::geometry::nyi::not_implemented_error<boost::geometry::hemisphere_tag, void, void>::THIS_OPERATION_IS_NOT_OR_NOT_YET_IMPLEMENTED::************)(mpl_::assert_::types<boost::geometry::hemisphere_tag, void, void, mpl_::na>))’

I have put the geometry in bg::model and given it a tag.
The next error seems meaningful, so I'll include it:

.../boost/geometry/algorithms/detail/disjoint/interface.hpp:65:21: error: ‘value’ is not a member of ‘boost::geometry::topological_dimension<boost::geometry::model::hemisphere<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> > >’

How do I satisfy these kind of requirements?