Merge pull request #427 from adrianVmariano/master

This commit is contained in:
Revar Desmera 2021-02-20 12:46:54 -08:00 committed by GitHub
commit 799686b7ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 12 deletions

View file

@ -701,6 +701,8 @@ function offset(
: :
[for(i=[0:len(goodsegs)-1]) [for(i=[0:len(goodsegs)-1])
let(prevseg=select(goodsegs,i-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 (goodsegs[i][1]-goodsegs[i][0]) * (goodsegs[i][0]-sharpcorners[i]) > 0
&& (prevseg[1]-prevseg[0]) * (sharpcorners[i]-prevseg[1]) > 0 && (prevseg[1]-prevseg[0]) * (sharpcorners[i]-prevseg[1]) > 0
], ],

View file

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

View file

@ -801,8 +801,7 @@ function associate_vertices(polygons, split, curpoly=0) =
curpoly==len(polygons)-1 ? polygons : curpoly==len(polygons)-1 ? polygons :
let( let(
polylen = len(polygons[curpoly]), polylen = len(polygons[curpoly]),
cursplit = force_list(split[curpoly]), cursplit = force_list(split[curpoly])
fdsa= echo(cursplit=cursplit)
) )
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(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.")) assert(polylen<=len(polygons[curpoly+1]),str("Polygon ",curpoly," has more vertices than the next one."))
@ -1168,7 +1167,7 @@ module sweep(shape, transforms, closed=false, caps, convexity=10,
// points = 50; // points per loop // points = 50; // points per loop
// R = 400; r = 150; // Torus size // R = 400; r = 150; // Torus size
// p = 2; q = 5; // Knot parameters // 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; // 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) ]; // 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); // path_sweep(rot(90,p=ushape),knot_path, method="natural", closed=true);
@ -1185,7 +1184,7 @@ module sweep(shape, transforms, closed=false, caps, convexity=10,
// points = 50; // points per loop // points = 50; // points per loop
// R = 400; r = 150; // Torus size // R = 400; r = 150; // Torus size
// p = 2; q = 5; // Knot parameters // 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; // 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) ]; // 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) ]; // normals = [ for (i=[0:k-1]) knot_normal(360*i/k/gcd(p,q),R,r,p,q) ];