From 08085b60c4de43f192dabbd8e21bf85419f5269c Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Mon, 26 Oct 2020 10:20:13 +0800 Subject: [PATCH] add archimedean_text_sphere --- examples/archimedean_text_sphere.scad | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 examples/archimedean_text_sphere.scad diff --git a/examples/archimedean_text_sphere.scad b/examples/archimedean_text_sphere.scad new file mode 100644 index 00000000..104ee563 --- /dev/null +++ b/examples/archimedean_text_sphere.scad @@ -0,0 +1,35 @@ +use ; + +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"); + } +} +