Bug 459829

Summary: Line tool improperly adjusts pressure points to new line length when end is above the start
Product: [Applications] krita Reporter: Ralek Kolemios <info>
Component: ToolsAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: griffinvalley
Priority: NOR    
Version First Reported In: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Examples
Example #2 5c98a

Description Ralek Kolemios 2022-09-29 17:41:19 UTC
Created attachment 152501 [details]
Examples

When using the line tool and drawing from bottom to top, the pressure data is scooted the wrong way if:
- The end point is above the start point
- The line has been shortened since the last update

I believe this is a problem related to negative vectors in the adjustPointsToDDA function in the line tool helper.
Comment 1 Ralek Kolemios 2022-09-29 21:23:14 UTC
Checking out the math of the tool, it looks like the points along the line slowly get adjusted up and to the left due to floor rounding errors when the angle of the line changes. The same mathematical issue that causes the rotate tool to slide the canvas up and to the left.
Comment 2 wolthera 2023-01-16 14:29:16 UTC
Hey,

I cannot reproduce with the Krita Version: 5.2.0-prealpha (git 5c98a72) Appimage with Qt 5.15.7

Is this still relevant?
Comment 3 Ralek Kolemios 2023-01-16 19:59:39 UTC
Unfortunately 5c98a and newer builds don't work on my system because of bug #464255 , but it is still a problem on my last available working build of 8e8c855

I took a look at the code a while ago and it appears that every movement of the mouse calls a function which 'repositions' the pen pressure readings onto the new line as the user moves the preview around. Unfortunately because there is a floor() in this function, and the positions are pulled from the last result of the function, and it's called several hundred times a second, the pen pressure readings naturally move up and to the left of the origin of the line as they get rounded down constantly.

This effect isn't visible if you're not using pen pressure, and it becomes more noticeable as canvas FPS increases.
Comment 4 Ralek Kolemios 2023-01-16 20:06:01 UTC
Created attachment 155358 [details]
Example #2 5c98a

(In reply to Ralek Kolemios from comment #3)
> Unfortunately 5c98a and newer builds don't work on my system because of bug
> #464255 , but it is still a problem on my last available working build of
> 8e8c855

I realize now 5c is the build right before the nonworking one, I've tried it out on that one just now and the problem still persists. See attachment.
Comment 5 Ralek Kolemios 2024-08-01 18:39:03 UTC
This was likely fixed by 1af06cbd which limited usage of adjustPointsToDDA() and does not seem to occur anymore.