1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-01 04:20:27 +02:00

change param

This commit is contained in:
Justin Lin
2021-06-03 10:19:42 +08:00
parent 6330473ea7
commit b8dbe53756

View File

@@ -3,20 +3,19 @@ fn = 4;
number_of_polygons = 10;
height = 20;
thickness = 1.5;
thickness_offset_factor = 1.5;
spacing = 0.5 * thickness;
extrude_ratio = 1;
fidget_polygon(beginning_radius, fn, number_of_polygons, height, thickness, thickness_offset_factor);
fidget_polygon(beginning_radius, fn, number_of_polygons, height, thickness, spacing, extrude_ratio);
module fidget_polygon(beginning_radius, fn, n, height, thickness, thickness_offset_factor) {
module fidget_polygon(beginning_radius, fn, n, height, thickness, spacing, extrude_ratio) {
theta = 180 / fn;
thickness_offset = thickness * thickness_offset_factor;
y = beginning_radius - beginning_radius * cos(theta);
dr = y / cos(theta) + thickness_offset;
dr = y / cos(theta) + thickness + spacing;
pw = pow((beginning_radius + dr) * sin(theta), 2);
function a(ri, ro, i) = acos((pow(ro, 2) + pow(ri, 2) - pw * pow(0.985, i)) / (2 * ro * ri));
// function a(ri, ro, i) = acos((pow(ro, 2) + pow(ri, 2) - pw * pow(0.985, i)) / (2 * ro * ri));
module drawPolygon(r) {
circle(r, $fn = fn);
@@ -25,10 +24,10 @@ module fidget_polygon(beginning_radius, fn, n, height, thickness, thickness_offs
rs = [for(i = [0: n]) beginning_radius + i * dr];
//as = [for(i = [1: n]) a(rs[i - 1], rs[i], i) / 2];
s = [for(i = [1: n]) (rs[i] + thickness_offset) / rs[i - 1]];
s = [for(i = [1: n]) (rs[i] + thickness + spacing) / rs[i - 1]] * extrude_ratio;
half_height = height / 2;
module half() {
translate([0, 0, -half_height]) {
linear_extrude(half_height, scale = s[0])