Round poly now perfectly fits radius
This commit is contained in:
+3
-4
@@ -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);
|
||||
Reference in New Issue
Block a user