Refactor scallops some more

This commit is contained in:
Luke Hubmayer-Werner 2024-04-03 00:28:06 +10:30
parent 95edbc60f9
commit 094c9d98c7
1 changed files with 24 additions and 20 deletions

View File

@ -19,6 +19,21 @@ x_min = standard_profile_center_x - tube_radius;
// minimum_y_width = 26.4517;
// standard_y_width = 28;
// Create a circle containing all 3 points, then plot the arc between the first two points
function arc_points(tri_points, fragments_per_mm=5) =
let(
cc = tri_circumcenter(tri_points),
r = norm(tri_points[0] - cc),
steps = ceil((norm(tri_points[2] - tri_points[0]) + norm(tri_points[2] - tri_points[1]))*fragments_per_mm),
normalized0 = (tri_points[0] - cc)/r,
normalized1 = (tri_points[1] - cc)/r,
a_start = atan2(normalized0[1], normalized0[0]),
a_end = atan2(normalized1[1], normalized1[0]),
a_sweep = a_end - a_start,
a_step = a_sweep/steps
)
[for (i = [0:steps]) r*[cos(a_start+i*a_step), sin(a_start+i*a_step)] + cc];
module fret_tube(from_fret, to_fret, scale_offset = 0, nut_spacing = 10, bridge_spacing = 20, strings = 3, y_width_extra_mm = 8, fingerboard_min_thick = 2.5, fingerboard_max_thick = 5, place_on_z0 = false, string_mms = false) {
spacing_scale = bridge_spacing/nut_spacing;
@ -88,27 +103,16 @@ module fret_tube(from_fret, to_fret, scale_offset = 0, nut_spacing = 10, bridge_
o = fret_width/2 * sin(fret_angle);
y0 = fingerboard_min_thick;
y1 = fingerboard_max_thick - (fret_width/2 * cos(fret_angle));
rotate([-90,-90,0]) linear_extrude(height = w, center = true)
for (fret = [from_fret+1:to_fret])
let(
x0 = fsl(fret-1) - o,
x1 = fsl(fret) + o,
x_mid = (x0+x1)/2,
pts = [[x0, y1], [x1, y1], [x_mid, y0]],
cc = tri_circumcenter(pts),
r = norm([x0, y1] - cc),
// r2 = r^2,
a_start = acos((x0 - cc[0])/r),
a_end = acos((x1 - cc[0])/r),
a_sweep = a_end - a_start,
a_step = a_sweep/10
points = arc_points(pts)
) {
// echo(a_start=a_start, x0=x0, cc=cc);
translate([cc[1], 0, cc[0]])
rotate([90,0,0])
// cylinder(h = w, r = r, center = true);
linear_extrude(height = w, center = true)
polygon([for (i = [0:10]) [-r*sin(a_start+i*a_step), r*cos(a_start+i*a_step)]]);
// polygon([for (x = [x1-x_mid:0.05:x0-x_mid]) [-sqrt(r2 - x^2), x]]);
polygon(points);
}
}
@ -181,9 +185,9 @@ module fret_tube(from_fret, to_fret, scale_offset = 0, nut_spacing = 10, bridge_
// Long Bass (34")
fret_tube(from_fret=0, to_fret=36, scale_offset=-5, nut_spacing=10, bridge_spacing=20, strings=3, string_mms=[2.54, 2.159, 1.651]);
// Strat scale (25.5")
translate([50, 0])
fret_tube(from_fret=0, to_fret=30, scale_offset=0, nut_spacing=7, bridge_spacing=11, strings=6, string_mms=[0.8938, 0.8128, 0.6096, 0.4064, 0.2794, 0.2286]);
// Smaller
translate([100, 0])
fret_tube(from_fret=0, to_fret=24, scale_offset=3, nut_spacing=7, bridge_spacing=11, strings=5, string_mms=[0.8938, 0.8128, 0.6096, 0.4064, 0.2794]);
// // Strat scale (25.5")
// translate([50, 0])
// fret_tube(from_fret=0, to_fret=30, scale_offset=0, nut_spacing=7, bridge_spacing=11, strings=6, string_mms=[0.8938, 0.8128, 0.6096, 0.4064, 0.2794, 0.2286]);
// // Smaller
// translate([100, 0])
// fret_tube(from_fret=0, to_fret=24, scale_offset=3, nut_spacing=7, bridge_spacing=11, strings=5, string_mms=[0.8938, 0.8128, 0.6096, 0.4064, 0.2794]);