-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Use fuzzy comparison for stroke join determination. #10077
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
Conversation
@@ -391,7 +391,8 @@ namespace agg | |||
vc.remove_all(); | |||
|
|||
double cp = cross_product(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y); | |||
if(cp != 0 && (cp > 0) == (m_width > 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the operator prescience in c++? Would
if(cp != 0 && ((cp > 0) == (m_width > 0)))
also work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cp
is non-zero on the other arches; it doesn't really have to do with precedence. The switch to two separate comparisons is so that -eps < cp < eps
is considered 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See this comment from the issue.
There's another call to |
Unfortunately, it looks like Windows is producing |
4720fb3
to
4aaf1ef
Compare
4aaf1ef
to
6c5f213
Compare
This sometimes produces something just slightly different from 0 compared to x86(_64).
The problem arises in some other location that is more difficult to determine than the previous one.
6c5f213
to
7216b8c
Compare
Would like this in so we don't need too many downstream patches. |
@@ -391,7 +391,8 @@ namespace agg | |||
vc.remove_all(); | |||
|
|||
double cp = cross_product(v0.x, v0.y, v1.x, v1.y, v2.x, v2.y); | |||
if(cp != 0 && (cp > 0) == (m_width > 0)) | |||
if ((cp > agg::vertex_dist_epsilon && m_width > 0) || | |||
(cp < -agg::vertex_dist_epsilon && m_width < 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not claiming to understand what you are doing here....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simply treating -eps < 0 < eps
as 0 instead of strictly 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems logical and worth a try, though I'm puzzled that apparently it required raising the tolerance on Windows.
Yea, I'm not happy about raising the tolerance for Windows either. Maybe I should try an increased epsilon instead? Edit: that just causes more failures on x86_64 Linux, so maybe not. |
The test image was re-generated and the tolerance removed in #10077. Re-store the tolerance on 2.1.x to gets tests passing, this should not be merged into master branch.
Backport PR #10077 on branch v2.1.x
PR Summary
This sometimes produces something just slightly different from 0 compared to x86(_64). I don't really know how to write a test for this as it only seems to be triggered on alternate arches, but a few test images got 'corrected', so I guess that's good enough.
Fixes #7797.
PR Checklist