Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Smoothing a path: a better algorithm
#5
(04-23-2022, 04:02 PM)tmanni Wrote: @Ottia Tuota
I plan to port your G2 Continuity plugin to python3 / Gimp3.
After reading your code, I suggest that you split the code in 2 files for easier maintenance and reuse :
- one python module to handle everything related to mathematical stuff (like g2continuity.py)
- one python script for the gimp plugin (like g2continuity-plugin.py)

Since every gimp plug-in needs a dedicated folder, you simply have to put the 2 files into the zip archive.

I am no coder and my code is usually quite messy. Maintaining would be a nightmare. I am not sure I understand what you actually mean by splitting it to mathematical stuff and Gimp plugin. The mathematics concerning G2-continuity is a very small part in the code and isolated to one routine (plus the matrix inversion code). The mathematics concerning Bezier curves (paths) uses my own data structure (class) BCurve, and it is used all over the code. I don't see how the splitting could be done, except for putting that one routine and the matrix inversion code in one module. Is that what you mean?

If that is what you mean, and if you think it worth-while to do even if the module will be so very small, I can try it. Could you please give detailed instructions. This is all new to me.
  1. I take that one routine and the matrix inversion code out and make them into a new file g2continuity.py.
  2. The rest is made into a file g2continuity_plugin.py.
  3. In the file g2continuity_plugin.py I write "from g2continuity import *"?
  4. Then I make a .zip file from those two files? Or should I make one folder from those two files and a .zip from that?
  5. Then what? When I share the plugin, that .zip file is what I share?
  6. And the user unzippes it and places the contents in Gimp's plug-ins folder?
  7. From where does that "dedicated folder" of the plugin come?
Please clarify.

But to help in another way anybody else to re-use the ideas, I attach here a pdf that contains the mathematics. There you find the formulas and how they are derived. I wrote it for my own use to record it all in a better form, just in case I would later need it. Before it was all just hand-written notes on paper. Don't let the appearance of the text frighten you. It looks like a mathematics paper, but it is not and will never be published anywhere. I just like to use the style I am accustomed with.

.pdf   G2_continuity.pdf (Size: 195.39 KB / Downloads: 201)

If you want to port the plugin to Gimp3, that is great. I am a little scared of the thought what to do with all my other plugins. I hope porting to Gimp3 is not too difficult.
Reply


Messages In This Thread
RE: Smoothing a path: a better algorithm - by Ottia Tuota - 04-24-2022, 07:05 AM

Forum Jump: