-
Notifications
You must be signed in to change notification settings - Fork 216
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
Invalid turns generation (detected as inconsistency in set and relational operations). #588
Comments
Thanks for the report. As far as I know, for within calculations rescaling is not used? Then it might be influenced by my recent changes indeed. |
It looks indeed like the start turn can cause this, and also some false positives about validity. |
I can exclude the start-turns for non-overlay operations, and I will. About the calculated turn, that (resulting coordinates) is all not affected (as far as I'm aware) by my changes. I only changed things in turns, not in the calculations themselves. |
Ok but will then set operations and relational operations be consistent with each other?
Yes. C = A \ B <=> C in A
I only checked that the result is different in 1.69 and 1.70. It may be something different. I'll try to find the specific commit when the behavior changes.
Turns generated now are different than the ones before. It's not only the coordinates. |
Btw, my test program is more or less:
|
Thanks for your testprogram!
Good point - I have to check that indeed. Will come back to this, but cannot do that right now. |
I checked the cases failing with starting points and I'm able to solve them differently now. |
I've checked the case reported in this issue with your branch ( |
@barendgehrels I found the cause. It seems my commit introduced this regression and your initial thought about rescaling was correct. Here is the commit: 5ea1abc Reverting it fixes the problem however this was a change made in this PR: #550 so it needs re-testing in case it was important and not only made for consistency. I don't remember exactly. The issue is caused by rescaling. It also affects set operations. I checked the result of the difference of
|
Reverting 5ea1abc causes the following
So I'm not sure what is the correct course of action here. |
The above means this issue is still on the table. |
@barendgehrels I'm ok with leaving it as it is for now, with this case failing, this issue open (as a reminder) and waiting for the disabling of rescaling in the whole library consistently. |
OK, is fine for me - I probably will include this case in my tests for removing the rescalnig. |
Just an update. This issue is in 1.72. |
@barendgehrels I've noticed that some operations became inconsistent after recent changes in set operations (with VS2015, msvc-14.0, x86). Consider:
where:
blue
should therefore be withinred
:but it is not. Here it is how it looks like with turns calculated internally in
within
orrelation
:The lower right
blue
triangle has the following points:the lower right arm of the
red
star is formed from the points:and the corresponding turns are:
(note: turns indexes are different than in
within
)So it looks like at
{25, 0}
(turn 0) the blue triangle goes outside the red and then crosses it from the outside at{20.000001500000678, 2.5000007500003396}
(turn 1), goes inside and then at{23.695651652173520, 4.3478258260867602}
(turn 2) outside again. Also the coordinates looks consistent with topology since{20.000001500000678, 2.5000007500003396}
is above and on the right of{20.000000000000000, 2.5000000000000000}
and{23.695651652173520, 4.3478258260867602}
is below and on the left of{23.695652173913043, 4.3478260869565215}
.However this should not be the case. All turns for this triangle should be detected as lying on the edges. And this is not some numerical floating point error. Consider the
POINT(20.0 2.5)
. It's exactly in the half of theSEGMENT(25 0, 15 5)
but the turn point calculated for this point is{20.000001500000678, 2.5000007500003396}
. The error is huge.Btw, turns in relate are calculated like this: https://github.com/boostorg/geometry/blob/develop/include/boost/geometry/algorithms/detail/relate/areal_areal.hpp#L225
Or am I missing something?
EDIT:
Is this a bug?
Should turns be generated in a different way now?
Is this low accuracy expected?
Note that if such low accuracy was expected (e.g. was a side effect of your changes) we would have to for instance compare all of the points (for equality) in the library WRT to this accuracy.
The text was updated successfully, but these errors were encountered: