More parameterization of sculpting

This commit is contained in:
Lenbok 2018-05-18 23:40:56 +12:00
parent 9cdc930eb3
commit aaf8bf10aa
2 changed files with 9 additions and 3 deletions

View File

@ -77,6 +77,12 @@ $height_slices = 1;
$enable_side_sculpting = false; $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) // 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; $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. radius of sphere used in minkowski sum for minkowski_key function. 1.75 for G20
$minkowski_radius = .33; $minkowski_radius = .33;

View File

@ -1,8 +1,8 @@
// side sculpting functions // side sculpting functions
// bows the sides out on stuff like SA and DSA keycaps // 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 // 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) { module rounded_square_shape(size, delta, progress, center = true) {
width = size[0]; 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]; 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) { offset(r = extra_corner_radius_this_slice) offset(r = -extra_corner_radius_this_slice) {
if ($enable_more_side_sculpting != false && progress > 0) { 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 { } else {
square(square_size, center=center); square(square_size, center=center);
} }