RVPaint fix segment edge intersection when path has variable widths #439
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes an issue when using the annotation tools and having strokes with variable widths.
Variable widths happen when you use a stylus/wacom tablet with pen pressure. When widths can vary, it is possible for the widths of the stroke be just right so that the extruded edges become nearly parallel. This case currently isn't being handled. This creates "spikes" on your brush stroke that can seemly appear at random.
Example Of The Spikes Occurring
321366638-4e34798a-e64f-40a8-a400-9209c8c5c0e0.1.mp4
Isolated Case
Here is a minimal isolated case of the issue happening spike_isolated.rv.
I also graphed the polygons in desmos so its easier to see
https://www.desmos.com/calculator/gxmkrpdr2o
The issue occurs when the point of intersection is calculated between line segments AB and CD.
As we can see the two lines are is nearly parallel.
When intersection point is calculated, away we go!
The Solution
To fix this issue, I changed the code to perform the intersection as if the line has a constant width. This was the simplest thing I could think of. The spikes never seem to happen with constant width strokes.