
Geometry : 
Subject: Re: [geometry] "covered_by" for polygons
From: Volker Schöch (vschoech_at_[hidden])
Date: 20120216 04:45:15
Barend,
> > Any pros or cons for A.covered_by(B) := area(AB)==0 vs. A.covered_by(B) := (A&B)==A ?
>
> The difference and intersection do have the same complexity and precision.
Thanks, that's what I expected.
> The equalstest will cost you more than the areatest.
That's a detail I wasn't aware of. I'll prefer the AB implementation then. Given that A and B are multipolygons, and based on your reply to my earlier post < http://lists.boost.org/geometry/2012/02/1818.php> I assume that I can simply check for empty() and skip the area test altogether. In other words: Is there a guarantee that if A is covered by B, (AB) will be an empty container, rather than a container that contains one or more empty polygons?
> But area(AB)==0 is not always a good test. Suppose A is empty. Than AB = empty as well. But A is not covered by B
Sure. We will have to decide what we need in these corner cases and treat them explicitly if need be. What is your approach? Will an empty (multi)polygon be a valid input to a (currently hypothetical) implementation of covered_by?
> > Do you think there are any optimization opportunities in a dedicated covered_by algorithm?
>
> The intersection or difference operations are not necessary. Getting intersection points and some additional logic should be enough.
Ok then, I'm looking forward to a dedicated implementation some day! :)
Thanks again
Volker
 Volker Schöch  vschoech_at_[hidden] Senior Software Engineer thinkcell Software GmbH  Chausseestr. 8/E  10115 Berlin  Germany http://www.thinkcell.com  phone +49 30 66647310  US phone +1 800 891 8091 Amtsgericht BerlinCharlottenburg, HRB 85229  European Union VAT Id DE813474306 Directors: Dr. Markus Hannebauer, Dr. Arno Schoedl
Geometry list run by mateusz at loskot.net