scad/pressfit_catears.scad
2025-06-27 09:00:23 +02:00

70 lines
2.1 KiB
OpenSCAD

include <globals.scad>;
include <primitives.scad>;
use <headband.scad>;
use <catear_headband.scad>;
use <pressfit_headband.scad>;
use <chamfer.scad>;
EAR_SCALE = 1.5;
EAR_BEND_FACTOR = 0.15;
EAR_STRETCH_FACTOR = 1.2;
STEP_SIZE = 100;
translate([50, 0, 0]) difference() {
translate([20*pow(0.99, SIZE/2*EAR_SCALE-1-THICKNESS), 0, -THICKNESS/2])
union() for (i=[0:STEP_SIZE:SIZE/2*EAR_SCALE-1]) {
j=pow(0.99, i);
chamfer_ = floor(abs(2*i/(SIZE/2*EAR_SCALE-1)-1));
translate([-j*20, 0, 0])
rotate(90, [0, 1, 0])
/*chamfer(size=1, child_h=1, child_bot=-0.5, shape=CHAMFER_SHAPE)*/
catear_v1(
debug=DEBUG,
height=INSERTICLE_Z*1.2,
thickness=THICKNESS,
side_len=SIZE/2*EAR_SCALE-i,
bend_factor=EAR_BEND_FACTOR,
stretch_factor=EAR_STRETCH_FACTOR,
chamfer=0, //chamfer_,
chamfer_shape=CHAMFER_SHAPE,
end_caps=false
);
}
translate([0, 0, -THICKNESS]) cube([100, 100, THICKNESS], center=true);
scale([1, 1, 2]) inserticle();
}
side_len=SIZE/2*EAR_SCALE;
r=side_len/2;
E=1.6*EAR_STRETCH_FACTOR;
e=E*(r+THICKNESS/4)/(r-THICKNESS/4);
T=side_len+THICKNESS;
S=side_len-THICKNESS;
xremap = function (x) pow(x, EAR_STRETCH_FACTOR);
yremap = function (y) pow(y, 1);
//f = function (p) [j((p.x+T/2)/T)*T-T/2, pow(p.y, 2)/r*E, p.z];
//g = function (p) [j((p.x+S/2)/S)*S-S/2, pow(p.y, 2)/r*E*(T+THICKNESS)/S, p.z];
f = function (p) [scalc(xremap, p.x, -T/2, T/2), scalc(yremap, p.y, 0, T/2)*E, p.z];
g = function (p) [scalc(xremap, p.x, -S/2, S/2), scalc(yremap, p.y, 0, S/2)*e, p.z];
rotate([0, 90, 0]) color("yellow") arc(0.5, r, THICKNESS, HEIGHT, outer_remap=f, inner_remap=g);
color("red") catear_v2(
height=HEIGHT,
thickness=THICKNESS,
side_len=SIZE/2*EAR_SCALE,
stretch_factor=EAR_STRETCH_FACTOR
);
// a = b + c
// x * a = y * b + c
// y * b = x * a - c
// y =(x * a - c)/ b
// 100 = 95 + 5
// x * 100 = y * 95 + 5
// 5 * 100 = y * 95 + 5
// 500 = y * 95 + 5
// 495 = y * 95
// y = 495 / 95