Bugfix for rounding_angled_edge_mask() with r1/r2=0

This commit is contained in:
Revar Desmera 2020-04-26 00:55:36 -07:00
parent 22f8d65991
commit 1e3f18f695
2 changed files with 14 additions and 10 deletions

View file

@ -604,22 +604,26 @@ module rounding_angled_edge_mask(h=1.0, r=undef, r1=undef, r2=undef, ang=90, anc
];
sweep = 180-ang;
n = ceil(segs(max(r1,r2))*sweep/360);
x = r1*sin(90-(ang/2))/sin(ang/2);
r1 = get_radius(r1=r1, r=r, dflt=1);
r2 = get_radius(r1=r2, r=r, dflt=1);
attachable(anchor,spin,orient, size=[2*x,2*r1,h], size2=[2*x*r2/r1,2*r2]) {
if(r1<r2) {
zflip()
linear_extrude(height=h, convexity=4, center=true, scale=r1/r2) {
polygon(_mask_shape(r2));
n = ceil(segs(max(r1,r2))*sweep/360);
x = sin(90-(ang/2))/sin(ang/2) * (r1<r2? r2 : r1);
if(r1<r2) {
attachable(anchor,spin,orient, size=[2*x*r1/r2,2*r1,h], size2=[2*x,2*r2]) {
zflip() {
linear_extrude(height=h, convexity=4, center=true, scale=r1/r2) {
polygon(_mask_shape(r2));
}
}
} else {
children();
}
} else {
attachable(anchor,spin,orient, size=[2*x,2*r1,h], size2=[2*x*r2/r1,2*r2]) {
linear_extrude(height=h, convexity=4, center=true, scale=r2/r1) {
polygon(_mask_shape(r1));
}
children();
}
children();
}
}

View file

@ -8,7 +8,7 @@
//////////////////////////////////////////////////////////////////////
BOSL_VERSION = [2,0,281];
BOSL_VERSION = [2,0,282];
// Section: BOSL Library Version Functions