SFCGAL icon indicating copy to clipboard operation
SFCGAL copied to clipboard

Enhance covers()

Open mhugo opened this issue 10 years ago • 3 comments

The implementation of Covers() is very naive. It is used internally to "cleanup" geometries after splitting them into geometry sets. There must be ways to have a better covers implementation, especially one that do not use constructions, but only predicates

mhugo avatar Apr 24 '14 07:04 mhugo

@mhugo @lbartoletti this is of particular interest as the algorithm is particularly expensive and frequently used. Consequently, I am currently looking into this issue. If there has been any more progress please can it be posted here? Thanks.

danielcu888 avatar Jun 24 '20 11:06 danielcu888

What is Covers() doing (input -> output) ?

sloriot avatar Jun 24 '20 11:06 sloriot

It effectively checks that for two geometries A and B, covers(A,b) checks if the intersection of A and B is "equal" to B. The equality check is done using comparisons of point count, segment lengths, surface areas, solid volume, where appropriate, according to the dimension of the inputs. The todo in the implementation suggests the following improvement as indicated in the ticket description:

// // This is a very naive (not efficient) implementation of covers() ! // // covers(A,B) <=> A inter B == B // '==' is here implemented with comparison of length, area and volumes // TODO use only predicates if possible

danielcu888 avatar Jun 24 '20 11:06 danielcu888