]> www.fi.muni.cz Git - things.git/commitdiff
yenyalib
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 1 Nov 2023 06:19:08 +0000 (07:19 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 1 Nov 2023 06:19:08 +0000 (07:19 +0100)
yenyalib.scad [new file with mode: 0644]

diff --git a/yenyalib.scad b/yenyalib.scad
new file mode 100644 (file)
index 0000000..9c71534
--- /dev/null
@@ -0,0 +1,63 @@
+
+module round_with() {
+       if ($preview) {
+               children([1:1:$children-1]);
+       } else {
+               minkowski() {
+                       difference() {
+                               children([1:1:$children-1]);
+                               minkowski() {
+                                       difference() {
+                                               minkowski() {
+                                                       children([1:1:$children-1]);
+                                                       children(0);
+                                               }
+                                               children([1:1:$children-1]);
+                                       }
+                                       children(0);
+                               }
+                       }
+                       children(0);
+               }
+       }
+}
+
+module round_edges(r) {
+       round_with() {
+               sphere(r, $fn = 8);
+               children();
+       }
+}
+
+// deprecated
+module tx(l) { translate([l, 0, 0]) children(); }
+module ty(l) { translate([0, l, 0]) children(); }
+module tz(l) { translate([0, 0, l]) children(); }
+
+module rx(a) { rotate([a, 0, 0]) children(); }
+module ry(a) { rotate([0, a, 0]) children(); }
+module rz(a) { rotate([0, 0, a]) children(); }
+
+module sx(a) { scale([a, 1, 1]) children(); }
+module sy(a) { scale([1, a, 1]) children(); }
+module sz(a) { scale([1, 1, a]) children(); }
+
+// capital letters are ugly, but more visible in short identifiers
+module Tx(l) { translate([l, 0, 0]) children(); }
+module Ty(l) { translate([0, l, 0]) children(); }
+module Tz(l) { translate([0, 0, l]) children(); }
+
+module Rx(a) { rotate([a, 0, 0]) children(); }
+module Ry(a) { rotate([0, a, 0]) children(); }
+module Rz(a) { rotate([0, 0, a]) children(); }
+
+module Sx(a) { scale([a, 1, 1]) children(); }
+module Sy(a) { scale([1, a, 1]) children(); }
+module Sz(a) { scale([1, 1, a]) children(); }
+
+module Mx() { for (s = [-1, 1]) Sx(s) children(); }
+module My() { for (s = [-1, 1]) Sy(s) children(); }
+module Mz() { for (s = [-1, 1]) Sz(s) children(); }
+
+eps = 0.01;
+infty = 100;