From 31b93e0e378f831201aaa0d0299d0085c2202579 Mon Sep 17 00:00:00 2001
From: Garth Minette <revarbat@gmail.com>
Date: Sun, 24 Apr 2022 19:22:18 -0700
Subject: [PATCH] Fixed weird default excess= in masks2d.scad.

---
 joiners.scad | 14 ++++++++++++--
 masks2d.scad | 40 +++++++++++++++++-----------------------
 2 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/joiners.scad b/joiners.scad
index 0fb0cdc..0e56590 100644
--- a/joiners.scad
+++ b/joiners.scad
@@ -20,6 +20,7 @@ include <rounding.scad>
 //   half_joiner_clear(l, w, [ang=], [clearance=], [overlap=]) [ATTACHMENTS];
 // Usage: As Function
 //   vnf = half_joiner_clear(l, w, [ang=], [clearance=], [overlap=]);
+// Topics: Joiners, Parts
 // Description:
 //   Creates a mask to clear an area so that a half_joiner can be placed there.
 // Arguments:
@@ -32,6 +33,7 @@ include <rounding.scad>
 //   anchor = Translate so anchor point is at origin (0,0,0).  See [anchor](attachments.scad#subsection-anchor).  Default: `CENTER`
 //   spin = Rotate this many degrees around the Z axis after anchor.  See [spin](attachments.scad#subsection-spin).  Default: `0`
 //   orient = Vector to rotate top towards, after spin.  See [orient](attachments.scad#subsection-orient).  Default: `UP`
+// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner()
 // Example:
 //   half_joiner_clear();
 function half_joiner_clear(l=20, w=10, ang=30, clearance=0, overlap=0.01, anchor=CENTER, spin=0, orient=UP) =
@@ -62,6 +64,7 @@ module half_joiner_clear(l=20, w=10, ang=30, clearance=0, overlap=0.01, anchor=C
 //   half_joiner(l, w, [base=], [ang=], [screwsize=], [$slop=]) [ATTACHMENTS];
 // Usage: As Function
 //   vnf = half_joiner(l, w, [base=], [ang=], [screwsize=], [$slop=]);
+// Topics: Joiners, Parts
 // Description:
 //   Creates a half_joiner object that can be attached to a matching half_joiner2 object.
 // Arguments:
@@ -75,12 +78,13 @@ module half_joiner_clear(l=20, w=10, ang=30, clearance=0, overlap=0.01, anchor=C
 //   spin = Rotate this many degrees around the Z axis after anchor.  See [spin](attachments.scad#subsection-spin).  Default: `0`
 //   orient = Vector to rotate top towards, after spin.  See [orient](attachments.scad#subsection-orient).  Default: `UP`
 //   $slop = Printer specific slop value to make parts fit more closely.
+// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner()
 // Examples(FlatSpin,VPD=75):
 //   half_joiner(screwsize=3);
 //   half_joiner(l=20,w=10,base=10);
 // Example(3D):
 //   diff()
-//   cuboid(50)
+//   cuboid(30)
 //       attach([FWD,TOP,RIGHT])
 //           xcopies(30) half_joiner();
 function half_joiner(l=20, w=10, base=10, ang=30, screwsize, anchor=CENTER, spin=0, orient=UP) =
@@ -241,6 +245,7 @@ module half_joiner(l=20, w=10, base=10, ang=30, screwsize, anchor=CENTER, spin=0
 //   half_joiner2(l, w, [base=], [ang=], [screwsize=])
 // Usage: As Function
 //   vnf = half_joiner2(l, w, [base=], [ang=], [screwsize=])
+// Topics: Joiners, Parts
 // Description:
 //   Creates a half_joiner2 object that can be attached to half_joiner object.
 // Arguments:
@@ -253,12 +258,13 @@ module half_joiner(l=20, w=10, base=10, ang=30, screwsize, anchor=CENTER, spin=0
 //   anchor = Translate so anchor point is at origin (0,0,0).  See [anchor](attachments.scad#subsection-anchor).  Default: `CENTER`
 //   spin = Rotate this many degrees around the Z axis after anchor.  See [spin](attachments.scad#subsection-spin).  Default: `0`
 //   orient = Vector to rotate top towards, after spin.  See [orient](attachments.scad#subsection-orient).  Default: `UP`
+// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner()
 // Examples(FlatSpin,VPD=75):
 //   half_joiner2(screwsize=3);
 //   half_joiner2(w=10,base=10,l=20);
 // Example(3D):
 //   diff()
-//   cuboid(50)
+//   cuboid(30)
 //       attach([FWD,TOP,RIGHT])
 //           xcopies(30) half_joiner2();
 function half_joiner2(l=20, w=10, base=10, ang=30, screwsize, anchor=CENTER, spin=0, orient=UP) =
@@ -442,6 +448,7 @@ module half_joiner2(l=20, w=10, base=10, ang=30, screwsize, anchor=CENTER, spin=
 //   Creates a mask to clear an area so that a joiner can be placed there.
 // Usage:
 //   joiner_clear(l, w, [ang=], [clearance=], [overlap=]) [ATTACHMENTS];
+// Topics: Joiners, Parts
 // Arguments:
 //   l = Length of the joiner to clear space for.
 //   w = Width of the joiner to clear space for.
@@ -452,6 +459,7 @@ module half_joiner2(l=20, w=10, base=10, ang=30, screwsize, anchor=CENTER, spin=
 //   anchor = Translate so anchor point is at origin (0,0,0).  See [anchor](attachments.scad#subsection-anchor).  Default: `CENTER`
 //   spin = Rotate this many degrees around the Z axis after anchor.  See [spin](attachments.scad#subsection-spin).  Default: `0`
 //   orient = Vector to rotate top towards, after spin.  See [orient](attachments.scad#subsection-orient).  Default: `UP`
+// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner()
 // Example:
 //   joiner_clear();
 function joiner_clear(l=40, w=10, ang=30, clearance=0, overlap=0.01, anchor=CENTER, spin=0, orient=UP) = no_function("joiner_clear");
@@ -476,6 +484,7 @@ module joiner_clear(l=40, w=10, ang=30, clearance=0, overlap=0.01, anchor=CENTER
 // Module: joiner()
 // Usage:
 //   joiner(l, w, base, [ang=], [screwsize=], [$slop=]) [ATTACHMENTS];
+// Topics: Joiners, Parts
 // Description:
 //   Creates a joiner object that can be attached to another joiner object.
 // Arguments:
@@ -489,6 +498,7 @@ module joiner_clear(l=40, w=10, ang=30, clearance=0, overlap=0.01, anchor=CENTER
 //   spin = Rotate this many degrees around the Z axis after anchor.  See [spin](attachments.scad#subsection-spin).  Default: `0`
 //   orient = Vector to rotate top towards, after spin.  See [orient](attachments.scad#subsection-orient).  Default: `UP`
 //   $slop = Printer specific slop value to make parts fit more closely.
+// See Also: half_joiner_clear(), half_joiner(), half_joiner2(), joiner_clear(), joiner()
 // Examples(FlatSpin,VPD=125):
 //   joiner(screwsize=3);
 //   joiner(l=40, w=10, base=10);
diff --git a/masks2d.scad b/masks2d.scad
index 99ac0c3..f1fbf65 100644
--- a/masks2d.scad
+++ b/masks2d.scad
@@ -51,12 +51,11 @@ module mask2d_roundover(r, inset=0, excess=0.01, d, anchor=CENTER,spin=0) {
 }
 
 function mask2d_roundover(r, inset=0, excess=0.01, d, anchor=CENTER,spin=0) =
-    assert(is_num(r)||is_num(d))
-    assert(is_undef(excess)||is_num(excess))
-    assert(is_num(inset)||(is_vector(inset)&&len(inset)==2))
+    assert(is_finite(r)||is_finite(d))
+    assert(is_finite(excess))
+    assert(is_finite(inset)||(is_vector(inset)&&len(inset)==2))
     let(
         inset = is_list(inset)? inset : [inset,inset],
-        excess = default(excess,$overlap),
         r = get_radius(r=r,d=d,dflt=1),
         steps = quantup(segs(r),4)/4,
         step = 90/steps,
@@ -106,12 +105,11 @@ module mask2d_cove(r, inset=0, excess=0.01, d, anchor=CENTER,spin=0) {
 }
 
 function mask2d_cove(r, inset=0, excess=0.01, d, anchor=CENTER,spin=0) =
-    assert(is_num(r)||is_num(d))
-    assert(is_undef(excess)||is_num(excess))
-    assert(is_num(inset)||(is_vector(inset)&&len(inset)==2))
+    assert(is_finite(r)||is_finite(d))
+    assert(is_finite(excess))
+    assert(is_finite(inset)||(is_vector(inset)&&len(inset)==2))
     let(
         inset = is_list(inset)? inset : [inset,inset],
-        excess = default(excess,$overlap),
         r = get_radius(r=r,d=d,dflt=1),
         steps = quantup(segs(r),4)/4,
         step = 90/steps,
@@ -174,12 +172,11 @@ module mask2d_chamfer(edge, angle=45, inset=0, excess=0.01, x, y, anchor=CENTER,
 
 function mask2d_chamfer(edge, angle=45, inset=0, excess=0.01, x, y, anchor=CENTER,spin=0) =
     let(dummy=one_defined([x,y,edge],["x","y","edge"]))
-    assert(is_num(angle))
-    assert(is_undef(excess)||is_num(excess))
-    assert(is_num(inset)||(is_vector(inset)&&len(inset)==2))
+    assert(is_finite(angle))
+    assert(is_finite(excess))
+    assert(is_finite(inset)||(is_vector(inset)&&len(inset)==2))
     let(
         inset = is_list(inset)? inset : [inset,inset],
-        excess = default(excess,$overlap),
         x = is_def(x)? x :
             is_def(y)? adj_ang_to_opp(adj=y,ang=angle) :
             hyp_ang_to_opp(hyp=edge,ang=angle),
@@ -229,10 +226,9 @@ module mask2d_rabbet(size, excess=0.01, anchor=CENTER,spin=0) {
 }
 
 function mask2d_rabbet(size, excess=0.01, anchor=CENTER,spin=0) =
-    assert(is_num(size)||(is_vector(size)&&len(size)==2))
-    assert(is_undef(excess)||is_num(excess))
+    assert(is_finite(size)||(is_vector(size)&&len(size)==2))
+    assert(is_finite(excess))
     let(
-        excess = default(excess,$overlap),
         size = is_list(size)? size : [size,size],
         path = [
             [size.x, -excess],
@@ -290,13 +286,12 @@ module mask2d_dovetail(edge, angle=30, inset=0, shelf=0, excess=0.01, x, y, anch
 
 function mask2d_dovetail(edge, angle=30, inset=0, shelf=0, excess=0.01, x, y, anchor=CENTER, spin=0) =
     assert(num_defined([x,y,edge])==1)
-    assert(is_num(first_defined([x,y,edge])))
-    assert(is_num(angle))
-    assert(is_undef(excess)||is_num(excess))
-    assert(is_num(inset)||(is_vector(inset)&&len(inset)==2))
+    assert(is_finite(first_defined([x,y,edge])))
+    assert(is_finite(angle))
+    assert(is_finite(excess))
+    assert(is_finite(inset)||(is_vector(inset)&&len(inset)==2))
     let(
         inset = is_list(inset)? inset : [inset,inset],
-        excess = default(excess,$overlap),
         x = !is_undef(x)? x :
             !is_undef(y)? adj_ang_to_opp(adj=y,ang=angle) :
             hyp_ang_to_opp(hyp=edge,ang=angle),
@@ -342,9 +337,9 @@ function mask2d_dovetail(edge, angle=30, inset=0, shelf=0, excess=0.01, x, y, an
 //       edge_profile(BOT)
 //           mask2d_teardrop(r=10, angle=40);
 function mask2d_teardrop(r, angle=45, excess=0.01, d, anchor=CENTER, spin=0) =  
-    assert(is_num(angle))
+    assert(is_finite(angle))
     assert(angle>0 && angle<90)
-    assert(is_num(excess))
+    assert(is_finite(excess))
     let(
         r = get_radius(r=r, d=d, dflt=1),
         n = ceil(segs(r) * angle/360),
@@ -427,7 +422,6 @@ function mask2d_ogee(pattern, excess=0.01, anchor=CENTER, spin=0) =
     assert(len(pattern)%2==0,"pattern must be a list of TYPE, VAL pairs.")
     assert(all([for (i = idx(pattern,step=2)) in_list(pattern[i],["step","xstep","ystep","round","fillet"])]))
     let(
-        excess = default(excess,$overlap),
         x = concat([0], cumsum([
             for (i=idx(pattern,step=2)) let(
                 type = pattern[i],