Oslandia / SFCGAL

MOVED TO GITLAB: https://gitlab.com/sfcgal/SFCGAL. A wrapper around CGAL that intents to implement 2D and 3D operations on OGC standards models
https://sfcgal.org
Other
112 stars 54 forks source link

Improve isValid #123

Open mhugo opened 8 years ago

mhugo commented 8 years ago

The isValid algorithm seems very slow.

Identified points to improve so far:

vmora commented 8 years ago

Maybe SFS validity and pre-condition validity should be uncoupled (especially usefull for conversion of polygons SFS-Valid <-> CGAL-Valid)

mborne commented 8 years ago

@vmora It's possible to do approximate computation with Epeck kernel :

See this example from Sébastien : https://github.com/Oslandia/SFCGAL/blob/sprint/doc/devnotes/cgal-approximate.md

(should be "just" twice slower than pure double operations)

mhugo commented 8 years ago

approx() takes the centre of the interval boxes, which is here enough to compute a distance, right ?

mhugo commented 8 years ago

"Maybe SFS validity and pre-condition validity should be uncoupled (especially usefull for conversion of polygons SFS-Valid <-> CGAL-Valid)" I like this idea. But are you able to explicit those CGAL preconditions ?

mhugo commented 8 years ago

hmmm : just the list of assertions in CGAL ?

vmora commented 8 years ago

are you able to explicit those CGAL preconditions

the only ones I know about is the polygon hole-touching ring case and the "plane polygon" required by SFS

just the list of assertions in CGAL

maybe an idea... if not complete to ensure robustness -> upstream the problem ;)

danielcu888 commented 4 years ago

Validation caching can make great improvements to the performance of this algorithm. In summary, once a geometry has been validated, the result need not be recalculated if it has not been mutated, yet this is repeatedly done, and is very expensive, in particular for Polygons. Included in the list of mutations that dispose of any cached validation result is the access to non-const geometry components of a given Geometry, which may, via the non-const reference, be mutated. Of course there is no certainty that the client would mutate through use of these accessors, but there is no way to tell. A solution is to offer const& accessors to ensure preservation of the Geometry and hence avoid clearing any cached validation state. Its expected that speedups as a result of this are of order 1000.

In addition, minor improvements include:

Its expected that such caching provides significant speedups where applicable.