diff --git a/round_polygon.scad b/round_polygon.scad index 7ad5a35..f850ccd 100644 --- a/round_polygon.scad +++ b/round_polygon.scad @@ -14,7 +14,7 @@ oct = [ [corn,-corn] ]; -function scale_xy(xy, m) = let(nz_xy = sign(xy == 0 ? 1 : xy) * max(abs(xy), 0.0000001)) [ for (i = m) [i.x * nz_xy, i.y * nz_xy]]; +function scale_xy(shape, xy, allow_zero = false) = let(s = allow_zero ? xy : sign(xy == 0 ? 1 : xy) * max(abs(xy), 0.0001)) [ for (i = shape) [i.x * s, i.y * s]]; function normalize(vec) = vec / norm(vec); @@ -28,14 +28,13 @@ module round_poly(shape, radius, sharpness = 0){ corner_r = lerp(radius, 0, sharpness); corner_offset = lerp(0, radius, sharpness); - minkowski(){ - polygon(add_radius(scale_xy(0, shape),corner_offset)); + polygon(add_radius(scale_xy(shape,0),corner_offset)); circle(max(corner_r, 0.0001)); } } -radius = 3; +radius = 1; round_poly(oct,radius, $t); \ No newline at end of file