diff --git a/utils/catenary.scad b/utils/catenary.scad index 879c58c..fdac11b 100644 --- a/utils/catenary.scad +++ b/utils/catenary.scad @@ -35,7 +35,7 @@ function catenary_ds_by_da(d, a) = 2 * sinh(d / a) - 2 * d / a * cosh(d / a); // function catenary_find_a(d, l, a = 1, best_e = inf, best_a = 1) = //! Find the catenary constant ```a```, given half the horizontal span and the length. assert(l > 2 * d, "Not long enough to span the gap") assert(d) let(error = abs(catenary_s(d, a) - l)) - error >= best_e && error < 0.0001 ? /*echo(best=best_e, a = best_a)*/ best_a + error >= best_e && error < 0.0001 ? best_a : catenary_find_a(d, l, max(a - (catenary_s(d, a) - l) / catenary_ds_by_da(d, a), d / argsinh(1e99)), error, a); function catenary_points(l, x, y, steps = 100) = //! Returns a list of 2D points on the curve that goes from the origin to ```(x,y)``` and has length ```l```.