Skip to content

Instantly share code, notes, and snippets.

@tedyapo
Created July 27, 2022 01:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tedyapo/16ab0fc7fe8ce904ac340d3d3b72db9a to your computer and use it in GitHub Desktop.
Save tedyapo/16ab0fc7fe8ce904ac340d3d3b72db9a to your computer and use it in GitHub Desktop.
// chirp screw: parameterized on 0 <= t <= 1
t_steps = 500;
major_d = 50;
major_facets = 71;
minor_d = 4;
minor_facets = 17;
turns = 10;
length = 50;
//function z_func(t) = length * t;
function z_func(t) = 3*length * t*t;
function freq_func(t) = turns * t;
module spiral(){
for (i = [0:(t_steps+1)]){
t = i/t_steps;
theta = 360 * freq_func(t);
x = 0.5 * major_d * cos(theta);
y = 0.5 * major_d * sin(theta);
z = z_func(t);
t1 = (i-1)/t_steps;
theta1 = 360 * freq_func(t1);
x1 = 0.5 * major_d * cos(theta1);
y1 = 0.5 * major_d * sin(theta1);
z1 = z_func(t1);
hull(){
translate([x, y, z]){
rotate([90, 0, theta])
cylinder($fn=minor_facets, d=minor_d, h=0.1);
}
translate([x1, y1, z1]){
rotate([90, 0, theta1])
cylinder($fn=minor_facets, d=minor_d, h=0.1);
}
}
}
}
difference(){
cylinder($fn=major_facets, d=major_d, h=z_func(1));
spiral();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment