Skip to content

Instantly share code, notes, and snippets.

@feromes
Last active June 16, 2024 11:49
Show Gist options
  • Save feromes/2c5243a6183c7c6000987ee7b22db086 to your computer and use it in GitHub Desktop.
Save feromes/2c5243a6183c7c6000987ee7b22db086 to your computer and use it in GitHub Desktop.
Fibonacci's spiral in OpenScad using a simple polar equation
//fibonacci_golden_spiral.scad - Simple implementation of the Fibonacci Spiral's polar equation
phi = (1 + sqrt(5)) / 2; // =~ 1.618
function radius(angle) = 10 * pow(phi, (angle / 90));
for(i = [0:1:720]) {
translate([sin(i) * radius(i), cos(i) * radius(i)]) circle(3);
}
echo(version=version());
// Written by Fernando Gomes <feromes@gmail.com>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to the
// public domain worldwide. This software is distributed without any
// warranty.
//
// You should have received a copy of the CC0 Public Domain
// Dedication along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment