From 05aee1bf7b5847c03912dd9b296cb14bddcc817d Mon Sep 17 00:00:00 2001 From: Garth Minette Date: Wed, 6 Apr 2022 20:13:39 -0700 Subject: [PATCH] Regressions fixes. --- geometry.scad | 4 ++-- shapes3d.scad | 4 ++-- tests/test_geometry.scad | 18 +++++++++--------- walls.scad | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/geometry.scad b/geometry.scad index 8ce20bd..90e9299 100644 --- a/geometry.scad +++ b/geometry.scad @@ -1060,7 +1060,7 @@ function circle_circle_intersection(r1, cp1, r2, cp2, eps=EPSILON, d1, d2) = // color("blue") move_copies(select(circ,2,3)) circle(d=2); // Example(3D): Fit into 3D path corner. // pts = [[45,5,10], [10,10,15], [30,40,30]]; rad = 10; -// circ = circle_2tangents(r=rad, pt1=pts[0], pt2=pts[1], pt3=pts[2]); +// circ = circle_2tangents(rad, [pts[0], pts[1], pts[2]]); // stroke(pts, endcaps="arrow2"); // color("red") move(circ[0]) cyl(h=10, r=rad, orient=circ[1]); // Example(3D): @@ -1068,7 +1068,7 @@ function circle_circle_intersection(r1, cp1, r2, cp2, eps=EPSILON, d1, d2) = // stroke(path, closed=true); // for (i = [0:1:5]) { // crn = select(path, i*2-1, i*2+1); -// ci = circle_2tangents(r=5, crn[0], crn[1], crn[2]); +// ci = circle_2tangents(5, crn[0], crn[1], crn[2]); // move(ci[0]) cyl(h=10,r=5,,orient=ci[1]); // } function circle_2tangents(r, pt1, pt2, pt3, tangents=false, d) = diff --git a/shapes3d.scad b/shapes3d.scad index 1636f34..d730d85 100644 --- a/shapes3d.scad +++ b/shapes3d.scad @@ -1223,7 +1223,7 @@ module cyl( ) [p1,p2] ) : !is_undef(fil2)? ( let( - cn = circle_2tangents(r=abs(fil2), [r2-fil2,l/2], [r2,l/2], [r1,-l/2]), + cn = circle_2tangents(abs(fil2), [r2-fil2,l/2], [r2,l/2], [r1,-l/2]), ang = fil2<0? phi : phi-180, steps = ceil(abs(ang)/360*segs(abs(fil2))), step = ang/steps, @@ -1238,7 +1238,7 @@ module cyl( ) [p1,p2] ) : !is_undef(fil1)? ( let( - cn = circle_2tangents(r=abs(fil1), [r1-fil1,-l/2], [r1,-l/2], [r2,l/2]), + cn = circle_2tangents(abs(fil1), [r1-fil1,-l/2], [r1,-l/2], [r2,l/2]), ang = fil1<0? 180-phi : -phi, steps = ceil(abs(ang)/360*segs(abs(fil1))), step = ang/steps, diff --git a/tests/test_geometry.scad b/tests/test_geometry.scad index f3f31df..d68dee6 100644 --- a/tests/test_geometry.scad +++ b/tests/test_geometry.scad @@ -424,15 +424,15 @@ module test_line_closest_point() { module test_circle_2tangents() { //** missing tests with arg tangent=true - assert(approx(circle_2tangents(r=10/sqrt(2),[10,10],[0,0],[10,-10])[0], [10,0])); - assert(approx(circle_2tangents(r=10/sqrt(2),[-10,10],[0,0],[-10,-10])[0], [-10,0])); - assert(approx(circle_2tangents(r=10/sqrt(2),[-10,10],[0,0],[10,10])[0], [0,10])); - assert(approx(circle_2tangents(r=10/sqrt(2),[-10,-10],[0,0],[10,-10])[0], [0,-10])); - assert(approx(circle_2tangents(r=10,[0,10],[0,0],[10,0])[0], [10,10])); - assert(approx(circle_2tangents(r=10,[10,0],[0,0],[0,-10])[0], [10,-10])); - assert(approx(circle_2tangents(r=10,[0,-10],[0,0],[-10,0])[0], [-10,-10])); - assert(approx(circle_2tangents(r=10,[-10,0],[0,0],[0,10])[0], [-10,10])); - assert_approx(circle_2tangents(r=10,polar_to_xy(10,60),[0,0],[10,0])[0], polar_to_xy(20,30)); + assert(approx(circle_2tangents(10/sqrt(2),[10,10],[0,0],[10,-10])[0], [10,0])); + assert(approx(circle_2tangents(10/sqrt(2),[-10,10],[0,0],[-10,-10])[0], [-10,0])); + assert(approx(circle_2tangents(10/sqrt(2),[-10,10],[0,0],[10,10])[0], [0,10])); + assert(approx(circle_2tangents(10/sqrt(2),[-10,-10],[0,0],[10,-10])[0], [0,-10])); + assert(approx(circle_2tangents(10,[0,10],[0,0],[10,0])[0], [10,10])); + assert(approx(circle_2tangents(10,[10,0],[0,0],[0,-10])[0], [10,-10])); + assert(approx(circle_2tangents(10,[0,-10],[0,0],[-10,0])[0], [-10,-10])); + assert(approx(circle_2tangents(10,[-10,0],[0,0],[0,10])[0], [-10,10])); + assert_approx(circle_2tangents(10,polar_to_xy(10,60),[0,0],[10,0])[0], polar_to_xy(20,30)); } *test_circle_2tangents(); diff --git a/walls.scad b/walls.scad index daf0d65..62bd9c6 100644 --- a/walls.scad +++ b/walls.scad @@ -183,10 +183,10 @@ module thinning_wall(h=50, l=100, thick=5, ang=30, braces=false, strut, wall, an wall = is_num(wall)? wall : thick/2; bevel_h = strut + (thick-wall)/2/tan(ang); - cp1 = circle_2tangents(r=strut, [0,0,+h/2], [l2/2,0,+h/2], [l1/2,0,-h/2])[0]; - cp2 = circle_2tangents(r=bevel_h, [0,0,+h/2], [l2/2,0,+h/2], [l1/2,0,-h/2])[0]; - cp3 = circle_2tangents(r=bevel_h, [0,0,-h/2], [l1/2,0,-h/2], [l2/2,0,+h/2])[0]; - cp4 = circle_2tangents(r=strut, [0,0,-h/2], [l1/2,0,-h/2], [l2/2,0,+h/2])[0]; + cp1 = circle_2tangents(strut, [0,0,+h/2], [l2/2,0,+h/2], [l1/2,0,-h/2])[0]; + cp2 = circle_2tangents(bevel_h, [0,0,+h/2], [l2/2,0,+h/2], [l1/2,0,-h/2])[0]; + cp3 = circle_2tangents(bevel_h, [0,0,-h/2], [l1/2,0,-h/2], [l2/2,0,+h/2])[0]; + cp4 = circle_2tangents(strut, [0,0,-h/2], [l1/2,0,-h/2], [l2/2,0,+h/2])[0]; z1 = h/2; z2 = cp1.z;