Switch focus to 2d to avoid 3d mink
This commit is contained in:
+6
-14
@@ -56,28 +56,20 @@ function throw_faces(points) = let(length = len(points), half = len(points) / 2)
|
||||
|
||||
function lerp(a,b,t) = a + (b - a) * t;
|
||||
|
||||
module shape_gate (shape, throw, shaft_r, sharpness = 0) {
|
||||
sharpness = lerp(1, shaft_r, max(0, min(sharpness, 1)));
|
||||
|
||||
corner_r = shaft_r / sharpness;
|
||||
corner_offset = corner_r * (sharpness - 1);
|
||||
module shape_gate (shape, throw, shaft_r, sharpness = 1) {
|
||||
corner_r = shaft_r * sharpness;
|
||||
corner_offset = shaft_r - corner_r;
|
||||
|
||||
points = throw_points(shape, throw, corner_offset);
|
||||
echo(points);
|
||||
echo(corner_offset);
|
||||
echo(abs(corner_offset) * tan(throw));
|
||||
|
||||
difference(){
|
||||
minkowski(){
|
||||
polyhedron(points, throw_faces(points));
|
||||
cylinder(1, corner_r);
|
||||
}
|
||||
translate([0,0,gate_height + 16])
|
||||
cube(32, true);
|
||||
}
|
||||
}
|
||||
|
||||
sharpness = sin(180 * $t);
|
||||
sharpness = $t;
|
||||
echo(sharpness);
|
||||
|
||||
shape_gate(sq_poly, 10, 9 / 2, sharpness);
|
||||
shape_gate(sq_poly, 10, 9 / 2, 1);
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
$fn=32;
|
||||
|
||||
scale = 1;
|
||||
card = scale;
|
||||
corn = scale / sqrt(2);
|
||||
|
||||
function scale_xy(xy, m) = [ for (i = m) [i.x * xy, i.y * xy]];
|
||||
|
||||
function normalize(vec) = vec / norm(vec);
|
||||
|
||||
function grow(shape, mag) = [ for (i = shape) i + normalize(i) * mag];
|
||||
|
||||
function add_radius(shape, rad) = grow(shape, rad/cos(180/len(shape)));
|
||||
|
||||
function lerp(a,b,t) = a + (b - a) * t;
|
||||
|
||||
module round_poly(shape, radius, sharpness = 0){
|
||||
corner_r = lerp(radius, 0, sharpness);
|
||||
corner_offset = lerp(0, radius, sharpness);
|
||||
|
||||
|
||||
minkowski(){
|
||||
polygon(add_radius(shape,corner_offset));
|
||||
circle(max(corner_r, 0.0001));
|
||||
}
|
||||
}
|
||||
|
||||
oct = [
|
||||
[card,0],
|
||||
[corn,corn],
|
||||
[0,card],
|
||||
[-corn,corn],
|
||||
[-card,0],
|
||||
[-corn,-corn],
|
||||
[0,-card],
|
||||
[corn,-corn]
|
||||
];
|
||||
|
||||
radius = 1;
|
||||
|
||||
round_poly(oct,radius, 1);
|
||||
Reference in New Issue
Block a user