pushing up to continue work elsewhere. actually abstracting ISO shape

This commit is contained in:
Bob - Home - Windows 2017-11-18 16:44:35 -05:00
parent 65d6656056
commit 736f3a6d70
2 changed files with 29 additions and 23 deletions

View File

@ -197,11 +197,12 @@ module g20() {
/*$rounded_key = true;*/
}
module fake_iso_enter() {
$bottom_key_width = 18.16 * 1.9;
$bottom_key_height = 18.16 * 2;
$width_difference = 4;
$height_difference = 4;
module iso_enter() {
$bottom_key_width = 18.16;
$bottom_key_height = 18.16;
$key_length = 1.5;
$key_height = 2;
$total_depth = 7;
$top_tilt = 0;
$top_skew = 1.75;
@ -424,7 +425,7 @@ module legend(text, inset=false) {
children();
}
translate_u(1.125, 0.5) fake_iso_enter() cherry() key();
translate_u(1.125, 0.5) iso_enter() cherry() key();
translate_u(0, 0) sa_row(2) legend("q", inset=true) cherry() {
key();
/*key();*/
}

View File

@ -3,7 +3,7 @@ unit = 19.05;
module key_shape(width, height, width_difference, height_difference, corner_size) {
if ($key_shape_type == "iso_enter") {
fakeISOEnter(width_difference/2);
ISO_enter(width, height, width_difference, height_difference, corner_size);
} else if ($key_shape_type == "normal") {
roundedSquare([width - width_difference, height - height_difference], corner_size);
} else if ($key_shape_type == "circle") {
@ -26,28 +26,33 @@ module roundedSquare(size, radius, center = true) {
// corollary is roundedSquare
// NOT 3D
module fakeISOEnter(thickness_difference = 0){
// t is all modifications to the polygon array
// t used to contain a corner radius adjustment, but due to
// the offset we need that expansion back
t = (thickness_difference - (unit - 18.16));
module ISO_enter(width, height, width_difference, height_difference, corner_size){
function unit_length(length) = unit * (length - 1) + 18.16;
function unit(length) = unit * length;
// in order to make the ISO keycap shape generic, we are going to express the
// 'elbow point' in terms of ratios. an ISO enter is just a 1.5u key stuck on
// top of a 1.25u key, but since our key_shape function doesnt understand that
// and wants to pass just width and height, we make these ratios to know where
// to put the elbow joint
width_ratio = unit_length(1.25) / unit_length(1.5);
height_ratio = unit_length(1) / unit_length(2);
pointArray = [
[unit(-.625) + t, unit(-1) + t],
[unit(0.625) - t, unit(-1) + t],
[unit(0.625) - t, unit(1) - t],
[unit(-0.875) + t, unit(1) - t],
[unit(-0.875) + t, unit(0) + t],
[unit(-0.625) + t, unit(0) + t]
[ -width_difference/2, -height_difference/2],
[ -width_difference/2, -height + height_difference/2],
[-width * width_ratio + width_difference/2, -height + height_difference/2],
[-width * width_ratio + width_difference/2,-height * height_ratio + height_difference/2],
[ -width + width_difference/2,-height * height_ratio + height_difference/2],
[ -width + width_difference/2, -height_difference/2]
];
minkowski(){
circle(r=$corner_radius);
circle(r=corner_size);
// gives us rounded inner corner
offset(r=-$corner_radius*2) {
polygon(points=pointArray);
offset(r=-corner_size*2) {
translate([(width * width_ratio)/2, height/2]) polygon(points=pointArray);
}
}
}