From aaf8bf10aa64e3f8d4ddb43de20c9b7fb2593bb3 Mon Sep 17 00:00:00 2001 From: Lenbok Date: Fri, 18 May 2018 23:40:56 +1200 Subject: [PATCH] More parameterization of sculpting --- src/settings.scad | 6 ++++++ src/shapes/rounded_square.scad | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/settings.scad b/src/settings.scad index afdf788..67fb9cc 100644 --- a/src/settings.scad +++ b/src/settings.scad @@ -77,6 +77,12 @@ $height_slices = 1; $enable_side_sculpting = false; // this enables even more fancy and hardcoded logic for corner bowing of SA keycaps. (Also needs enable_side_sculpting to be true) $enable_more_side_sculpting = false; +// When sculpting sides, how much in should the tops come +$side_sculpting_factor = 2.5; +// When sculpting corners, how much extra radius should be added +$corner_sculpting_factor = 1; +// When doing more side sculpting corners, how much extra radius should be added +$more_side_sculpting_factor = 0.4; //minkowski radius. radius of sphere used in minkowski sum for minkowski_key function. 1.75 for G20 $minkowski_radius = .33; diff --git a/src/shapes/rounded_square.scad b/src/shapes/rounded_square.scad index bdf6c48..bc51f78 100644 --- a/src/shapes/rounded_square.scad +++ b/src/shapes/rounded_square.scad @@ -1,8 +1,8 @@ // side sculpting functions // bows the sides out on stuff like SA and DSA keycaps -function side_sculpting(progress) = (1 - progress) * 2.5; +function side_sculpting(progress) = (1 - progress) * $side_sculpting_factor; // makes the rounded corners of the keycap grow larger as they move upwards -function corner_sculpting(progress) = pow(progress, 2); +function corner_sculpting(progress) = pow(progress, 2) * $corner_sculpting_factor; module rounded_square_shape(size, delta, progress, center = true) { width = size[0]; @@ -23,7 +23,7 @@ module rounded_square_shape(size, delta, progress, center = true) { square_size = [width - extra_width_this_slice, height - extra_height_this_slice]; offset(r = extra_corner_radius_this_slice) offset(r = -extra_corner_radius_this_slice) { if ($enable_more_side_sculpting != false && progress > 0) { - side_rounded_square(square_size, r = 0.4 * progress); + side_rounded_square(square_size, r = $more_side_sculpting_factor * progress); } else { square(square_size, center=center); }