Gimp-Forum.net
Tip to speed up your plug-in if you have to walk along a long Path - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: Other topics (https://www.gimp-forum.net/Forum-Other-topics)
+--- Forum: Watercooler (https://www.gimp-forum.net/Forum-Watercooler)
+--- Thread: Tip to speed up your plug-in if you have to walk along a long Path (/Thread-Tip-to-speed-up-your-plug-in-if-you-have-to-walk-along-a-long-Path)



Tip to speed up your plug-in if you have to walk along a long Path - trandoductin - 01-18-2023

[Image: file.php?id=43149]
it's been so long since I visited this forum.
Just wanted to share this here if anyone has slow code due to having to walk along a path.
That's all for now, cheers.


RE: Tip to speed up your plug-in if you have to walk along a long Path - Ofnuts - 01-18-2023

Never had the problem. How many calls are you doing in a single path?


RE: Tip to speed up your plug-in if you have to walk along a long Path - trandoductin - 01-18-2023

Too many,
to get all the points based on user option to specify speed to walk along the path while applying 3D wobble.


RE: Tip to speed up your plug-in if you have to walk along a long Path - Ofnuts - 01-19-2023

(01-18-2023, 11:54 PM)trandoductin Wrote: Too many,
to get all the points based on user option to specify speed to walk along the path while applying 3D wobble.

If you apply a wobble, you don't need much accuracy. I would look into pdb.gimp_vectors_stroke_interpolate(path ,stroke,precision). This gives you [length / (2 *precision)] points that approximate the stroke with a polygon (for  instance, a 800px stroke with precision 5 yields about 80 points, spaced 10px **on average**). So you get a very fast (even if less accurate) point_at_dist by getting the point in the array (or interpolating between two points in the array).


RE: Tip to speed up your plug-in if you have to walk along a long Path - trandoductin - 01-19-2023

Thanks for the details...I'll look into it when I feel up to it..
right now I am too excited about something else  Big Grin