Opened 3 years ago

Closed 3 years ago

#11232 closed Feature Requests (fixed)

User defined spatial predicate within Boost Geometry

Reported by: Frank Hippmann <frank.hippmann@…> Owned by: Barend Gehrels
Milestone: Boost 1.59.0 Component: geometry
Version: Boost 1.56.0 Severity: Problem
Keywords: geometry relate Cc:

Description

I need to determine whether the interiors of two geometries intersect. An InteriorsIntersect? predicate is not specified by OGC or Boost Geometry but is defined by the DE-9IM matrix:

T * *
* * *
* * *

I've created my own predicate using the relate function in Boost Geometry.

namespace bgr = boost::geometry::detail::relate;
using InteriorsIntersectMask = bgr::static_mask<'T','*','*','*','*','*','*','*','*'>;

template<typename Geom1, typename Geom2>
inline bool interiorsIntersect(const Geom1& geom1, const Geom2& geom2)
{
    return bgr::relate<InteriorsIntersectMask>(geom1, geom2);
}

This works great. My only concern is that the relate function and static_mask type are not documented as part of the Boost Geometry API and are implementation details as far as I can tell. Is it safe to use relate in this way? Is there an alternative to achieving the same goal using Boost Geometry? Ideally I would like to see relate be an algorithm within boost/geometry/algorithms.

Change History (3)

comment:1 Changed 3 years ago by awulkiew

Milestone: To Be DeterminedBoost 1.59.0

Yes, this was planned some time ago already. This is a GitHub? pull request with the change: https://github.com/boostorg/geometry/pull/288

The interface is the same for run-time and compile-time masks.

namespace bg = boost::geometry;
using InteriorsIntersectMask = bg::de9im::static_mask<'T','*','*','*','*','*','*','*','*'>;

bg::relate(geom1, geom2, InteriorsIntersectMask());

Does it satisfy your needs?

comment:2 Changed 3 years ago by Frank Hippmann <frank.hippmann@…>

Thanks, that's exactly what I am after.

comment:3 Changed 3 years ago by awulkiew

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.