Drawing a spiral/snail cam

For the past couple of days I’ve been (re-)familiarising myself with B4J as well as learning a bit about SVG files. I’ve been working on an application that will generate a spiral in SVG format. I usually develop my apps in Lazarus but wanted this to be cross-platform because there are LB users running on Windows, MacOS, and Linux. Lazarus will create cross-platform apps but I don’t think it is very straightforward hence I’ve written this in B4J. I haven’t managed to work out the cross-platform stuff yet but you’ll find a link to a zip file containing the Windows executable and support files here. Just download it and unzip it somewhere convenient, there’s no installer at the moment but there might be in the future.

Here’s a screenshot:

image

I think the app should be fairly self-explanatory. It’s crude as far as error checking is concerned - i.e. there isn’t much right now, but as long as you put sensible values in you should get sensible results. The curve that’s generated uses circular arcs to approximate a proper spline as from what I’ve read it’s pretty complicated to do the latter. I might revisit that at a later date if I’m looking for something to do! The arc based curve should be good enough for most purposes.

The image checkbox when checked will also draw two circles representing the min and max radii as well as lines from each endpoint back to the centre. I’ve included this as it makes it easier to find the centre once imported or pasted into LB (or any other app you potentially use it with).

You can save the SVG to a file or you can copy it to the clipboard where you can paste it directly into LB without having to save & import an SVG file.

I plan on making some improvements but I just wanted to get something usable out there as quickly as I could.

Hopefully @stixstudios will find this more convenient than using FreeCAD, and others will find it useful as well. If you have any problems with it just let me know.

Hope you find it useful.

3 Likes