JustinSDK / dotSCAD

Reduce the burden of mathematics when playing OpenSCAD
https://openhome.cc/zh-tw/openscad/
GNU Lesser General Public License v3.0
784 stars 107 forks source link

Archimedean spiral with non-approximated spacing #21

Closed alexose closed 2 years ago

alexose commented 2 years ago

Hi there,

I'm currently working on a project that involves your excellent Archimedean spiral code. It's sort of a locking gear mechanism, and requires that things line up perfectly:

image

As you can see, the holes are spaced just a bit too close together, which I think is due to the approximation you mention in the document above.

I'll continue trying to work out the math on my own, but I haven't had much success so far.

Thanks!

JustinSDK commented 2 years ago

Arc length for Archimedean spiral is rather complex. https://mathworld.wolfram.com/ArchimedesSpiral.html

Even though it might be possible to space points accurately, the method might not be suitable or hard for implementation in OpenSCAD.

The archimedean_spiral implementation of dotSCAD takes an approximation for satisfying most situations. Different approximations, however, are inaccurate in different ranges. You may check them in the following link to see what is more suitable for your case. https://stackoverflow.com/questions/68735124/code-for-archimedean-spiral-with-equidistant-points-is-inaccurate-near-center

Hope it helps.

alexose commented 2 years ago

Fantastic. I'll review those formulas and see if I can't get something more exact.