mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 00:09:41 +00:00
Regressions fixes.
This commit is contained in:
parent
d9691b3b4a
commit
05aee1bf7b
4 changed files with 17 additions and 17 deletions
|
@ -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) =
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue