You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Hand-drawn lines often look shaky...
Describe the solution you'd like
...applying some smoothing algorithm can clean-up such lines
Possible solution
Since I have been playing with the gromit source code, I have also implemented a smoothing option.
Basically, when a line is completed, it first applies a point reduction using the Douglas-Peucker algorithm, and then interpolates among the remaining points with centripetal Catmull-Rom splines.
The general shape and start and end points are preserved, and the smoothing degree can be set.
Here is an example with relatively strong smoothing.
Before spamming this repo with PRs, I wanted to discuss (1) whether such an option is useful, and, if yes, (2) how it is best integrated. For the moment, I just have an additional tool called SMOOTH, but there could be a "smooth=..." option for the PEN tool.
To provide a perspective on the extent of code addition, the entire smoothing logic is a bit less than 200 lines of code, in an additional file smooth.c.
The text was updated successfully, but these errors were encountered:
@pascal-niklaus Neat idea! Sorry for the delay, I was busy with €€€-work. I guess a separate tool aka GromitPaintContext makes sense as the smoothing is not applicable to ERASER, RECOLOR OR LINE. Maybe call it SMOOTH_PEN ?
Is your feature request related to a problem? Please describe.
Hand-drawn lines often look shaky...
Describe the solution you'd like
...applying some smoothing algorithm can clean-up such lines
Possible solution
Since I have been playing with the gromit source code, I have also implemented a smoothing option.
Basically, when a line is completed, it first applies a point reduction using the Douglas-Peucker algorithm, and then interpolates among the remaining points with centripetal Catmull-Rom splines.
The general shape and start and end points are preserved, and the smoothing degree can be set.
Here is an example with relatively strong smoothing.
Before spamming this repo with PRs, I wanted to discuss (1) whether such an option is useful, and, if yes, (2) how it is best integrated. For the moment, I just have an additional tool called SMOOTH, but there could be a "smooth=..." option for the PEN tool.
To provide a perspective on the extent of code addition, the entire smoothing logic is a bit less than 200 lines of code, in an additional file smooth.c.
The text was updated successfully, but these errors were encountered: