From 0309699822fea9f02f696aca795dc6fe7cc1a8a9 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 27 Sep 2019 07:34:48 +0800 Subject: [PATCH] add stereographic_projection_chars --- examples/stereographic_projection_chars.scad | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 examples/stereographic_projection_chars.scad diff --git a/examples/stereographic_projection_chars.scad b/examples/stereographic_projection_chars.scad new file mode 100644 index 00000000..5f10973b --- /dev/null +++ b/examples/stereographic_projection_chars.scad @@ -0,0 +1,39 @@ +include ; +txt = ""; +square_size = 100; +font_name = "Webdings"; +font_size = 140; +fn = 24; +shadow = "YES"; // [YES, NO] +base_height = 2; + +module stereographic_projection_chars(txt, square_size, font_name, font_size) { + frame_width = 0.225 * square_size; + + for(i = [0:3]) { + offset_x = square_size * 0.8 * (i == 1 || i == 2 ? 1 : -1) + + frame_width / 2 * (i == 0 || i == 3 ? 1 : -1); + offset_y = square_size * 0.8 * (i == 0 || i == 1 ? 1 : -1) + + frame_width / 2 * (i == 0 || i == 1 ? -1 : 1); + + translate([offset_x, offset_y, 0]) intersection() { + union() { + rotate(-135 - 90 * i) scale([1.15, 1, 1]) + text(txt[i], size = font_size, font = font_name, valign = "center", halign = "center"); + + difference() { + square(square_size * 1.6, center = true); + square(square_size * 1.15, center = true); + } + } + square(square_size * 1.6, center = true); + } + } +} + +stereographic_extrude(square_size * 2.975) + stereographic_projection_chars(txt, square_size, font_name, font_size); + +if(shadow == "YES") { + color("red") linear_extrude(base_height) stereographic_projection_chars(txt, square_size, font_name, font_size); +} \ No newline at end of file