# 螺旋字塔

March 8, 2022

``````use <polyline_join.scad>;

\$fn = 36;

levels = 10;
level_distance = 3;

a_step = 360 / \$fn;
l_step = level_distance / \$fn;

for(a = [0:a_step:360 * levels]) {
cube(1);
}

points = [
for(a = [0:a_step:360 * levels])
];

polyline_join(points)
cube(1);
``````

## 參數間的約束

``````use <polyline_join.scad>;

\$fn = 36;

levels = 10;
level_distance = 3;

points = helix(
levels = levels,
level_dist = level_distance,
vt_dir = "SPI_DOWN"
);

for(p = points) {
translate(p)
cube(1, center = true);
}

polyline_join(points)
cube(1, center = true);
``````

``````use <polyline_join.scad>;

t = "3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006";
\$fn = 36;
thickness = 1;

// 參數與變數間的約束
font_size = 2 * PI * radius / \$fn;
level_distance = font_size + thickness;
levels = floor(len(t) / \$fn);

points = helix(
levels = levels,
level_dist = level_distance,
vt_dir = "SPI_DOWN"
);

// 文字螺旋
for(i = [0:len(points) - 1]) {
p = points[i];
a = atan2(p.y, p.x);
translate(p)
rotate([90, 0, 90 + a])  // 依序繞 x 軸、y 軸、z 軸旋轉
linear_extrude(thickness, center = true)
text(
t[i],
size = font_size,
font = "Arial Black",
valign = "center",
halign = "center"
);
}

// 螺旋線
rotate(-180 / \$fn)
translate([0, 0, level_distance / 2])
polyline_join(points)
cube(thickness * 1.05, center = true);
``````

## 螺旋字球

``````use <sphere_spiral.scad>;

points_angles = sphere_spiral(
za_step = 20,
z_circles = 40,
begin_angle = 900
);

for(pa = points_angles) {
translate(pa[0]) rotate(pa[1])
rotate([90, 0, 90]) linear_extrude(1)
text("A", valign = "center", halign = "center");
}

%sphere(40);
``````

``````use <bauer_spiral.scad>;

n = 200;

for(p = pts) {
translate(p)
sphere(1, \$fn = 24);
}

polyline_join(pts)
sphere(0.5);
``````