New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interior straight skeleton leaks on the exterior with inexact constructions #123
Comments
I realized that constructing the input polygon from WKT does not reproduce the problem due to roundup. This WKB input (in HEX form) has all the precision it takes to trigger it:
See https://en.wikipedia.org/wiki/Well-known_text#Well-known_binary for interpretation of the WKB |
Fernando? @fcacciola |
Hello. Indeed, the results you're seeing are to be expected when using inexact constructions. Robustness issues are always directly dependent on the concrete numerical values involved in the computations, which is why you discovered that a "perturbation" of the input polygon (the translation) changes things. Unfortunately, that change doesn't mean the problem goes away, just that it is hidden on this test case, so it won't work a general solution. The input modification which does do the trick in almost all cases is, as vmora found on Oslandia/SFCGAL#89, to merge almost collinear edges with a proper tolerance. So is merging very very small edges as you found here. So, the general solution is not to translate (nor rotate nor scale) the input, but to "clean" it, removing almost collinear and extremely tiny edges. In fact, in ALL practical cases, I always run a polyline simplification (for both collinearity and zero-length edges) with an application-specific threshold (which is usually MUCH larger than epsion) on every input to the straight skeleton. This not only significantly reduces the chances of incorrect vertex coordinates in the output (when using inexact constructions), but also reduces the running time by several factors in my real cases since it usually happens that lots of almost collinear vertices are found in the input due to curve sampling of the "real" input. |
@strk I want to point out that your bug report was well documented. Thanks. After the explanation from Fernando, do you accept that the bug is closed? |
I understand it is by policy that invalid results are accepted
with "inexact constructions" kernel. If you confirm, ok with me
to close the bug.
For comparison, in GEOS (http://github.com/libgeos/libgeos)
robustness issues are expected to throw an exception (at the
expense of validation steps).
|
Oh, and thanks a lot Fernando for your exhaustive explanation !
|
As reported in #42 (comment) the interior straight skeleton of polygon can end up being outside of the input polygon due to robustness issues when created with exact predicates and inexact constructions kernel.
I've reduced the testcase to this (in WKT form):
The artifact happens near segments of the boundary which are relatively short compared to the overall bounding box.
Running the skeleton builder with exact constructions kernel gives the correct answer.
Is it expected ?
The text was updated successfully, but these errors were encountered: