Skip to content

Instantly share code, notes, and snippets.

@GilesBathgate
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GilesBathgate/9200018 to your computer and use it in GitHub Desktop.
Save GilesBathgate/9200018 to your computer and use it in GitHub Desktop.
Gear
function getR(r,i) = (i%4==i%2)?r:r-1;
function gear(r,l=[],i=0) = i>=360?l:gear(r,concat(l,[[getR(r,i)*sin(i),getR(r,i)*cos(i)]]),i+5);
function getRange(start,finish,v=[]) = len(v)>finish?v:getRange(start+1,finish,concat(v,start));
linear_extrude(height=2)
polygon(gear(r=6),[getRange(0,360/5)]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment