Created
August 13, 2023 01:58
-
-
Save ali1234/60f1b5e220d221a7be1e6c5b7cc1a96e to your computer and use it in GitHub Desktop.
OpenSCAD rounding with offset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Animation showing what the 4x offset rounding trick does. | |
$fs = 0.1; | |
$fa = 0.1; | |
function clamp(x) = min(max(x, 0), 1); | |
module timed_offset(t) { | |
a = clamp(t-1); | |
b = clamp(t-2.5); | |
c = clamp(t-4); | |
d = clamp(t-5.5); | |
offset(d) offset(-c) offset(-b) offset(a) children(); | |
} | |
module some_shape() { | |
difference() { | |
square(10, center=true); | |
translate([2, 0]) square([8, 4], center=true); | |
} | |
} | |
timed_offset($t * 7.5) some_shape(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(You might have to click play on the above to see the animation.)