Bug 434803 - brush with snapping to any curved assistants (ellipse, spline) creates tangent lines
Summary: brush with snapping to any curved assistants (ellipse, spline) creates tangen...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tool/Assistants (other bugs)
Version First Reported In: 4.4.2
Platform: Other Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: vanyossi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-22 23:22 UTC by mikelezhnin@gmail.com
Modified: 2022-11-10 01:42 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
krita log (3.07 KB, text/plain)
2021-03-22 23:22 UTC, mikelezhnin@gmail.com
Details
Screenshot of the issue (both lines between different parts of the spline, and worse, lines between the spline and canvas edges) (262.42 KB, image/png)
2021-03-28 00:42 UTC, Tiar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mikelezhnin@gmail.com 2021-03-22 23:22:04 UTC
Created attachment 136958 [details]
krita log

SUMMARY
When using snapping to assistants with a spline one gets lines tangent to the spline - see https://imgur.com/a/uEy14G1
Also here is the video recording - https://youtu.be/YZ1jumL1wmE

STEPS TO REPRODUCE
1. Create a spline with Assistant Tool - just a normal parabola looking one.
2. Choose a brush tool and tick "Snap to Assistants"
3. This step is somewhat hard to reproduce - I don't have a 
consistent setup, but it is not too hard to repeat. Just by doing multiple strokes next to the spline one can randomly get a line tangent to the spline going outside the canvas. One can also try forcing that by using a mouse with rapidfire clicks by clicking somewhere next to the spline.

OBSERVED RESULT
Random lines tangent to the spline, going all the way outside the canvas.

EXPECTED RESULT
None of the above, only curve next to the spline.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Ahab Greybeard 2021-03-23 16:21:50 UTC
I don't see this with 4.4.2 on Debian 10.
With Magnetism set to 1000, the drawn line follows the spline assistant with mouse or stylus when doing the short rapid movements as shown in in the attached video.

With Magnetism set to lower values, the drawn line does drift away from the assistant but there are no long tangent lines drawn.

For long rapid movements of the mouse or stylus, going away from the assistant, there is 'corner cutting' if the cursor is a long way from the spline but otherwise it works as it should.
Comment 2 mikelezhnin@gmail.com 2021-03-23 20:17:39 UTC
(In reply to Ahab Greybeard from comment #1)
Well, that is unfortunate.

Meanwhile I found a more consistent way of reproducing the same effect, maybe that can be of some help:
1. start with a spline looking more or less as a semicircle.
2. choose the brush with snap to assistants; use Magnetism at max.
3. as for the mouse movement, while holding the mouse down, start near the center of the "circle" and go leftwards, constantly slightly stroking up and down.

At the start it would draw straight arcs connecting parts of the spline; then, a bit more to the left, when one no longer gets those jumps - that is the sweet spot.
Again, a recording for the process - https://youtu.be/t5MBT-hhIlU

On the bright side, it looks like lowering Magnetism makes this appear less often, so I am quite satisfied.
Comment 3 Tiar 2021-03-28 00:42:26 UTC
Created attachment 137118 [details]
Screenshot of the issue (both lines between different parts of the spline, and worse, lines between the spline and canvas edges)

I can confirm this behaviour.
Comment 4 Bug Janitor Service 2022-10-23 01:10:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1628
Comment 5 vanyossi 2022-11-10 01:42:35 UTC
Git commit dc474d91150e9da37fe431c33014153605adde81 by Ivan Yossi.
Committed on 10/11/2022 at 00:32.
Pushed by ivany into branch 'master'.

First attempt at fixing tangent lines for spline Assitant

M  +144  -11   plugins/assistants/Assistants/SplineAssistant.cc
M  +6    -1    plugins/assistants/Assistants/SplineAssistant.h

https://invent.kde.org/graphics/krita/commit/dc474d91150e9da37fe431c33014153605adde81
Comment 6 vanyossi 2022-11-10 01:42:43 UTC
Git commit 6069fd80e1914640381a345639e9cf8185f208d9 by Ivan Yossi.
Committed on 10/11/2022 at 00:32.
Pushed by ivany into branch 'master'.

Use KisBezierUtils for finding nearest point

We use goldenSearch for local region search as it is faster than cutting
the curve using deCastelJau and recalculating nearestPoint for the new
subcurves.

M  +12   -19   plugins/assistants/Assistants/SplineAssistant.cc

https://invent.kde.org/graphics/krita/commit/6069fd80e1914640381a345639e9cf8185f208d9