c++ - User defined spatial predicate within Boost Geometry -
i need determine whether interiors of 2 geometries intersect. interiorsintersect predicate not specified ogc or boost geometry defined de-9im matrix (see also):
t * * * * * * * *
i've created own predicate using 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. concern relate
function , static_mask
type not documented part of boost geometry api , implementation details far can tell. safe use relate
in way? there alternative achieving same goal using boost geometry? ideally see relate
algorithm within boost/geometry/algorithms
.
the relate()
, relation()
functions planned release in boost 1.59. interface silghtly different 1 mentioned in question:
namespace bg = boost::geometry; using ii = bg::de9im::static_mask<'t','*','*','*','*','*','*','*','*'>; bool check1 = bg::relate(geom1, geom2, ii()); bg::de9im::mask ii("t********"); bool check2 = bg::relate(geom1, geom2, ii); bg::de9im::matrix m = bg::relation(geom1, geom2); std::cout << m.str();
it possible pass more complex masks:
bg::de9im::mask ii1("1********"); bg::de9im::mask ii2("2********"); // check if intersection of interiors linear or areal bool check2 = bg::relate(geom1, geom2, ii1 || ii2);
Comments
Post a Comment