scaling coordinates properly in voronoi extension
Hi, I'm the original author of the voronoi2svg extension, and it seems that it was no longer working for me. Here is my setup :
Inkscape 1.1.1 (3bf5ae0d25, 2021-09-20) GLib version: 2.70.0 GTK version: 3.24.30 glibmm version: 2.66.1 gtkmm version: 3.24.5 libxml2 version: 2.9.12 libxslt version: 1.1.34 Cairo version: 1.17.4 Pango version: 1.48.10 HarfBuzz version: 3.0.0 Poppler version: 21.09.0 OS version: Arch Linux
It seems that the handling of units got updated in inkscape a while ago, and that the handling of the units in the extension did not follow. Since the handling of units changed more than a few months ago, but the extension was still working for me up to my last system upgrade, I can't exactly say what triggered the issue, but here is a quick and dirty fix that's working for me. My issue is probably related to #403 (closed) and this fix may solve that problem too.
Here is the problem I encountered. Starting from a bunch of balls in the page
When asking for the Voronoi diagram with the page as a clipping box, I could not understand the result, but asking for a clipping box matching the bounding box of the balls, I could notice a scaling in the result
Based on this note discussing unit handling and on the suggested dimension.py file, I added a line computing the scale of one pixel in document units, and used that to scale the clipping box and path coordinates accordingly, to finally get the desired result with an automatic bounding box
and it also properly handles the page clipping box
I'm not up to date with current good practices in the repository or the proper way to handle units, but I believe this would at least lead to the proper solution. Anyway thanks for all your work in maintaining this extension, and thanks for all the work on inkscape.