doc fixes and bug fixes for undef

This commit is contained in:
Adrian Mariano 2021-02-20 11:45:10 -05:00
parent 576b3ab457
commit 852eed292d
3 changed files with 15 additions and 12 deletions

View File

@ -701,6 +701,8 @@ function offset(
:
[for(i=[0:len(goodsegs)-1])
let(prevseg=select(goodsegs,i-1))
i==0 && !closed ? false // In open case first entry is bogus
:
(goodsegs[i][1]-goodsegs[i][0]) * (goodsegs[i][0]-sharpcorners[i]) > 0
&& (prevseg[1]-prevseg[0]) * (sharpcorners[i]-prevseg[1]) > 0
],

View File

@ -375,9 +375,11 @@ function _rounding_offsets(edgespec,z_dir=1) =
r = struct_val(edgespec,"r"),
cut = struct_val(edgespec,"cut"),
k = struct_val(edgespec,"k"),
radius = in_list(edgetype,["circle","teardrop"])?
(is_def(cut) ? cut/(sqrt(2)-1) : r) :
edgetype=="chamfer"? first_defined([sqrt(2)*cut,r]) : undef,
radius = in_list(edgetype,["circle","teardrop"])
? (is_def(cut) ? cut/(sqrt(2)-1) : r)
:edgetype=="chamfer"
? (is_def(cut) ? sqrt(2)*cut : r)
: undef,
chamf_angle = struct_val(edgespec, "angle"),
cheight = struct_val(edgespec, "chamfer_height"),
cwidth = struct_val(edgespec, "chamfer_width"),

View File

@ -802,8 +802,7 @@ function associate_vertices(polygons, split, curpoly=0) =
curpoly==len(polygons)-1 ? polygons :
let(
polylen = len(polygons[curpoly]),
cursplit = force_list(split[curpoly]),
fdsa= echo(cursplit=cursplit)
cursplit = force_list(split[curpoly])
)
assert(len(split)==len(polygons)-1,str(split,"Split list length mismatch: it has length ", len(split)," but must have length ",len(polygons)-1))
assert(polylen<=len(polygons[curpoly+1]),str("Polygon ",curpoly," has more vertices than the next one."))
@ -1169,7 +1168,7 @@ module sweep(shape, transforms, closed=false, caps, convexity=10,
// points = 50; // points per loop
// R = 400; r = 150; // Torus size
// p = 2; q = 5; // Knot parameters
// %torus(r=R,r2=r);
// %torus(r_maj=R,r_min=r);
// k = max(p,q) / gcd(p,q) * points;
// knot_path = [ for (i=[0:k-1]) knot(360*i/k/gcd(p,q),R,r,p,q) ];
// path_sweep(rot(90,p=ushape),knot_path, method="natural", closed=true);
@ -1186,7 +1185,7 @@ module sweep(shape, transforms, closed=false, caps, convexity=10,
// points = 50; // points per loop
// R = 400; r = 150; // Torus size
// p = 2; q = 5; // Knot parameters
// %torus(r=R,r2=r);
// %torus(r_maj=R,r_min=r);
// k = max(p,q) / gcd(p,q) * points;
// knot_path = [ for (i=[0:k-1]) knot(360*i/k/gcd(p,q),R,r,p,q) ];
// normals = [ for (i=[0:k-1]) knot_normal(360*i/k/gcd(p,q),R,r,p,q) ];