Graphite icon indicating copy to clipboard operation
Graphite copied to clipboard

Deleting (dissolving) a point should scale its adjacent handles to minimize curvature change

Open Keavon opened this issue 7 months ago • 4 comments

Currently, using Delete to dissolve a selected point causes it to change shape:

Image

The default deletion mode for dissolving a point should aim to rescale the adjacent handles to best approximate the original curvature. See the algorithm described at https://math.stackexchange.com/a/879213/94039 which will hopefully work decently even in cases where an approximation of the original is required.

Keavon avatar May 18 '25 08:05 Keavon

This should work on single point deletion or also for multiple points selected and then deleted?

4adex avatar Jun 22 '25 09:06 4adex

Ideally it should work on multiple selected points, not just one. Regarding shortcuts, let's assign it to ShiftDelete and reassign that currently occupied key combination ("Cut Anchor") to AltDelete:

Image

This can be called "Re-Fit" when it's added to those hints.

Keavon avatar Jun 22 '25 10:06 Keavon

i am not so sure that this is rly that straight forward: This approximation for disolving a single pt seems good enough in most cases, but it also can get quite bad if the segments differ too much.

Also i think the transformations do not commute, so for me it seems not entirely clear how to dissolve multiple pts at once. The only viable option seem sequentially but it's somewhat strange, that the result can vary when deleting the same points

And also from my playing around (but might be i made sth. completely wrong). A couple "bad" transformations after another - let's say handles might get pretty big at some point.[^1]

[^1]: Not surprisingly really, because using that formula the handles next to the dissolving nodes are scaled with k (1/k resp.) - so possible very big and if one tries to disolve one of those nodes next...

HWienhold avatar Jun 24 '25 23:06 HWienhold

@4adex already has most of this completed, so we are likely to use his implementation unless it hits some snags. I see your PR is still a draft @HWienhold so I'd suggest focusing on something else in the meantime to avoid duplicating more work. Let me know if you need any suggestions.

Keavon avatar Jun 25 '25 01:06 Keavon