[WIP][DEBUG]

This commit is contained in:
djerun 2025-06-15 16:30:38 +02:00
commit 519a41c7a4
4 changed files with 71 additions and 24 deletions

View file

@ -0,0 +1,15 @@
a=90;
module bezier_curve(p0, p1, p2, p3) {
// TODO
}
module /*TODO*/ {
c = /*TODO*/;
bezier_curve(
[0, 1],
[c, 1],
[1, c],
[1, 0]
);
}

View file

@ -4,7 +4,7 @@ use <chamfer.scad>
module headband(debug=DEBUG, size=SIZE, height=HEIGHT, thickness=THICKNESS, part=PART, stretch_len=STRETCH_LEN, tip_len=TIP_LEN, tip_bend=TIP_BEND, rake_depth=RAKE_DEPTH, rake_width=RAKE_WIDTH, rake_stretch=RAKE_STRETCH, rake_chamfer=RAKE_CHAMFER, chamfer=CHAMFER, chamfer_shape=CHAMFER_SHAPE, with_rake=true, details=true) { module headband(debug=DEBUG, size=SIZE, height=HEIGHT, thickness=THICKNESS, part=PART, stretch_len=STRETCH_LEN, tip_len=TIP_LEN, tip_bend=TIP_BEND, rake_depth=RAKE_DEPTH, rake_width=RAKE_WIDTH, rake_stretch=RAKE_STRETCH, rake_chamfer=RAKE_CHAMFER, chamfer=CHAMFER, chamfer_shape=CHAMFER_SHAPE, with_rake=true, details=true) {
union() { union() {
chamfer(size=(details)?chamfer:0, child_h=height, child_bot=-height/2, shape=chamfer_shape) union() { /*chamfer(size=(details)?chamfer:0, child_h=height, child_bot=-height/2, shape=chamfer_shape)*/ union() {
color("purple") color("purple")
partial_ring(part, radius=size, thickness=thickness, height=height); partial_ring(part, radius=size, thickness=thickness, height=height);
rotate( 90-180*part, [0, 0, 1]) rotate( 90-180*part, [0, 0, 1])

View file

@ -8,30 +8,38 @@ $fn=90;
EAR_SCALE = 0.5; EAR_SCALE = 0.5;
EAR_BEND_FACTOR = 0.2; EAR_BEND_FACTOR = 0.2;
EAR_STRETCH_FACTOR = 8; EAR_STRETCH_FACTOR = 8;
STEP_SIZE = .5; STEP_SIZE = .25;
module loop(i) {
j=pow(0.99, i);
//chamfer_ = floor(abs(2*i/(SIZE/2*EAR_SCALE-1)-1));
translate([-j*20, 0, 0])
difference() {
rotate(90, [0, 1, 0])
/*chamfer(size=1, child_h=1, child_bot=-0.5, shape=CHAMFER_SHAPE)*/ {
//echo("i", i, "j", j, "chamfer_", chamfer_);
union() catear(
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,
details=false,
end_caps=true
);
}
cube([100, 100, THICKNESS], center=true);
}
}
//difference() { //difference() {
translate([20*pow(0.99, SIZE/2*EAR_SCALE-1-THICKNESS), 0, -THICKNESS/2]) 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]) { union() for (i=[0:STEP_SIZE:0/*SIZE/2*EAR_SCALE-1*/]) {
j=pow(0.99, i); loop(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)*/ {
echo("i", i, "j", j, "chamfer_", chamfer_);
catear(
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,
details=false,
end_caps=false
);
}
} }
// translate([0, 0, -THICKNESS]) cube([100, 100, THICKNESS], center=true); // translate([0, 0, -THICKNESS]) cube([100, 100, THICKNESS], center=true);
// scale([1, 1, 2]) inserticle(); // scale([1, 1, 2]) inserticle();

View file

@ -1,5 +1,7 @@
include <globals.scad>; include <globals.scad>;
include <primitives.scad>;
use <headband.scad>;
use <catear_headband.scad>; use <catear_headband.scad>;
use <pressfit_headband.scad>; use <pressfit_headband.scad>;
use <chamfer.scad>; use <chamfer.scad>;
@ -7,9 +9,9 @@ use <chamfer.scad>;
EAR_SCALE = 1.5; EAR_SCALE = 1.5;
EAR_BEND_FACTOR = 0.15; EAR_BEND_FACTOR = 0.15;
EAR_STRETCH_FACTOR = 1.2; EAR_STRETCH_FACTOR = 1.2;
STEP_SIZE = 1; STEP_SIZE = 100;
difference() { translate([50, 0, 0]) difference() {
translate([20*pow(0.99, SIZE/2*EAR_SCALE-1-THICKNESS), 0, -THICKNESS/2]) 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]) { union() for (i=[0:STEP_SIZE:SIZE/2*EAR_SCALE-1]) {
j=pow(0.99, i); j=pow(0.99, i);
@ -32,3 +34,25 @@ difference() {
translate([0, 0, -THICKNESS]) cube([100, 100, THICKNESS], center=true); translate([0, 0, -THICKNESS]) cube([100, 100, THICKNESS], center=true);
scale([1, 1, 2]) inserticle(); 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, THICKNESS, side_len=SIZE/2*EAR_SCALE, stretch_factor=EAR_STRETCH_FACTOR);
// a = b + c
// x * a = y * b + c
// y / x = a /(b + c)
// y = x * a /(b + c)