mirror of
https://github.com/rsheldiii/KeyV2.git
synced 2025-01-22 17:30:57 +00:00
tweak ISO_enter.scad
backporting some changes I made a while ago on the new key structure branch
This commit is contained in:
parent
24e280fe3c
commit
d4321abd40
1 changed files with 27 additions and 24 deletions
|
@ -2,6 +2,10 @@
|
|||
// NOT 3D
|
||||
function unit_length(length) = unit * (length - 1) + 18.16;
|
||||
|
||||
width_ratio = unit_length(1.25) / unit_length(1.5);
|
||||
height_ratio = unit_length(1) / unit_length(2);
|
||||
|
||||
|
||||
module ISO_enter_shape(size, delta, progress){
|
||||
width = size[0];
|
||||
height = size[1];
|
||||
|
@ -13,43 +17,42 @@ module ISO_enter_shape(size, delta, progress){
|
|||
// 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);
|
||||
delta = delta / 2;
|
||||
|
||||
pointArray = [
|
||||
[ 0, 0], // top right
|
||||
[ 0, -height], // bottom right
|
||||
[-width * width_ratio, -height], // bottom left
|
||||
[-width * width_ratio,-height * height_ratio], // inner middle point
|
||||
[ -width,-height * height_ratio], // outer middle point
|
||||
[ -width, 0] // top left
|
||||
[ 0-delta.x, 0-delta.y], // top right
|
||||
[ 0-delta.x, -height+delta.y], // bottom right
|
||||
[-width * width_ratio+delta.x, -height+delta.y], // bottom left
|
||||
[-width * width_ratio + delta.x,-height * height_ratio+delta.y], // inner middle point
|
||||
[ -width + delta.x,-height * height_ratio + delta.y], // outer middle point
|
||||
[ -width + delta.x, 0-delta.y] // top left
|
||||
];
|
||||
|
||||
minkowski(){
|
||||
circle(r=corner_size);
|
||||
circle(r=$corner_radius);
|
||||
// gives us rounded inner corner
|
||||
offset(r=-corner_size*2) {
|
||||
offset(r=-$corner_radius*2) {
|
||||
translate([(width * width_ratio)/2, height/2]) polygon(points=pointArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function iso_enter_vertices(width, height, width_ratio, height_ratio, wd, hd) = [
|
||||
[ 0-wd, 0-hd], // top right
|
||||
[ 0-wd, -height+hd], // bottom right
|
||||
[-width * width_ratio+wd, -height+hd], // bottom left
|
||||
[-width * width_ratio+wd,-height * height_ratio+hd], // inner middle point
|
||||
[ -width+wd,-height * height_ratio+hd], // outer middle point
|
||||
[ -width+wd, 0-hd] // top left
|
||||
function iso_enter_vertices(size, delta, progress, thickness_difference) = [
|
||||
[ 0-delta.x/2 * progress - thickness_difference/2, 0 - delta.y / 2 * progress - thickness_difference/2], // top right
|
||||
[ 0-delta.x/2 * progress - thickness_difference/2, -size[1] + delta.y / 2 * progress + thickness_difference/2], // bottom right
|
||||
[-size[0] * width_ratio + delta.x/2 * progress + thickness_difference/2, -size[1] + delta.y / 2 * progress + thickness_difference/2], // bottom left
|
||||
[-size[0] * width_ratio + delta.x/2 * progress + thickness_difference/2,-size[1] * height_ratio + delta.y / 2 * progress + thickness_difference/2], // inner middle point
|
||||
[ -size[0] + delta.x/2 * progress + thickness_difference/2,-size[1] * height_ratio + delta.y / 2 * progress + thickness_difference/2], // outer middle point
|
||||
[ -size[0] + delta.x/2 * progress + thickness_difference/2, 0 - delta.y / 2 * progress - thickness_difference/2] // top left
|
||||
] + [
|
||||
[(width * width_ratio)/2, height/2 ],
|
||||
[(width * width_ratio)/2, height/2 ],
|
||||
[(width * width_ratio)/2, height/2 ],
|
||||
[(width * width_ratio)/2, height/2 ],
|
||||
[(width * width_ratio)/2, height/2 ],
|
||||
[(width * width_ratio)/2, height/2 ]
|
||||
[(size[0] * width_ratio)/2, size[1]/2 ],
|
||||
[(size[0] * width_ratio)/2, size[1]/2 ],
|
||||
[(size[0] * width_ratio)/2, size[1]/2 ],
|
||||
[(size[0] * width_ratio)/2, size[1]/2 ],
|
||||
[(size[0] * width_ratio)/2, size[1]/2 ],
|
||||
[(size[0] * width_ratio)/2, size[1]/2 ]
|
||||
];
|
||||
|
||||
// no rounding on the corners at all
|
||||
function skin_iso_enter_shape(size, delta, progress, thickness_difference) =
|
||||
iso_enter_vertices(size.x, size.y, unit_length(1.25) / unit_length(1.5), unit_length(1) / unit_length(2), thickness_difference/2 + delta.x * progress/2, thickness_difference/2 + delta.y * progress/2);
|
||||
iso_enter_vertices(size, delta, progress, thickness_difference);
|
||||
|
|
Loading…
Reference in a new issue