1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-21 14:04:53 +02:00

add archimedean_text_sphere

This commit is contained in:
Justin Lin
2020-10-26 10:20:13 +08:00
parent d8dfd241dd
commit 08085b60c4

View File

@@ -0,0 +1,35 @@
use <experimental/bauer_spiral.scad>;
txt = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051";
radius = 20;
font_name = "Liberation Sans:style=Bold";
font_size = 2.5;
$fn = 48;
archimedean_text_sphere(radius, font_name, font_size);
module archimedean_text_sphere(radius, font_name, font_size) {
n = len(txt);
pts = bauer_spiral(n, radius);
render()
sphere(radius * 0.9);
for(i = [0:n - 1]) {
x = pts[i][0];
y = pts[i][1];
z = pts[i][2];
ya = atan2(z, sqrt(x * x + y * y));
za = atan2(y, x);
render()
translate(pts[i])
rotate([0, -ya, za])
rotate([90, 0, -90])
linear_extrude(radius * 0.125, scale = 1.15)
mirror([-1, 0, 0])
text(txt[i], size = font_size, font = font_name, valign = "center", halign = "center");
}
}