Boost logo

Geometry :

Subject: Re: [geometry] relate() interface
From: Mats Taraldsvik (mats.taraldsvik_at_[hidden])
Date: 2015-04-28 01:30:55


On Tue, Apr 28, 2015 at 1:47 AM, Adam Wulkiewicz <adam.wulkiewicz_at_[hidden]>
wrote:

> Hi,
>
> Recently a user requested to add a user-defined spatial predicate:
> https://svn.boost.org/trac/boost/ticket/11232
> relate() is there in the details from quite some time so I thought it's a
> good time to make it official. But before that we should think about the
> interface.
>
> First, the requirements. I think it should be possible to:
> - return a DE9IM matrix
> - check DE9IM run-time mask
> - check DE9IM compile-time mask
> - pass ORed masks and use them directly in the check
> - possible addition of other IMs though I doubt that anything else than
> DE9IM will be supported
>
> FYI, all of the above is supported in the details. But the interface need
> to be polished. I'm thinking about something like this:
>
> // basic, return DE9IM matrix
> std::string matrix = relate(g1, g2);
>
> // basic, check DE9IM run-time mask
> bool res = relate(g1, g2, "T********");
>
> We need a way to pass ORed masks. We have a few options but I'm thinking
> about this:
>
> bool res = relate(g1, g2, de9im::mask("FT*******") ||
> de9im::mask("F**T*****") ||
> de9im::mask("F***T****"));
>
> Compile-time masks:
>
> typedef de9im::static_mask<'T','*','*','*','*','*','*','*','*'> II;
> bool res = relate<II>(g1, g2);
>
> or just
>
> bool res = relate(g1, g2, II());
>
> In the second case the same technique for ORing masks could be used.
> Otherwise we'd be forced to gather them in some type like, de9im::or<M1,
> M2, M3, M4, ...>, mpl::vector<> or boost::tuple<>. Either way the compiler
> should be able to optimize I think. Besides it's implemented like this
> anyway in the details. The third parameter is just created by default using
> the default ctor. This of course can be changed. So again, we have two
> options:
>
> typedef de9im::static_mask<'T','*','*','*','*','*','*','*','*'> II;
> typedef de9im::static_mask<'*','*','*','*','T','*','*','*','*'> BB;
> bool res = relate<de9im::or<II, BB>>(g1, g2);
>
> or
>
> de9im::static_mask<'T','*','*','*','*','*','*','*','*'> ii;
> de9im::static_mask<'*','*','*','*','T','*','*','*','*'> bb;
>
> bool res = relate(g1, g2, ii || bb);
>
> What do you think?
> Do you like the names?
> Any ideas are welcome.
>
> E.g. maybe the names should be:
> - de9im::dynamic_mask and de9im::mask (instead of static_mask)
> - de9im::dmask and de9im::smask
> - de9im::mask_d and de9im::mask_s
> - ?
>
> Regards,
> Adam
>
> _______________________________________________
> Geometry mailing list
> Geometry_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/geometry
>
>



Geometry list run by mateusz at loskot.net