mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-08 15:56:42 +02:00
change param
This commit is contained in:
@@ -3,20 +3,19 @@ fn = 4;
|
|||||||
number_of_polygons = 10;
|
number_of_polygons = 10;
|
||||||
height = 20;
|
height = 20;
|
||||||
thickness = 1.5;
|
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;
|
theta = 180 / fn;
|
||||||
|
|
||||||
thickness_offset = thickness * thickness_offset_factor;
|
|
||||||
|
|
||||||
y = beginning_radius - beginning_radius * cos(theta);
|
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);
|
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) {
|
module drawPolygon(r) {
|
||||||
circle(r, $fn = fn);
|
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];
|
rs = [for(i = [0: n]) beginning_radius + i * dr];
|
||||||
//as = [for(i = [1: n]) a(rs[i - 1], rs[i], i) / 2];
|
//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;
|
half_height = height / 2;
|
||||||
|
|
||||||
module half() {
|
module half() {
|
||||||
translate([0, 0, -half_height]) {
|
translate([0, 0, -half_height]) {
|
||||||
linear_extrude(half_height, scale = s[0])
|
linear_extrude(half_height, scale = s[0])
|
||||||
|
Reference in New Issue
Block a user