columns fixes

This commit is contained in:
Adrian Mariano 2021-10-26 18:30:57 -04:00
parent a75a368dd5
commit b60123a886
4 changed files with 8 additions and 8 deletions

View File

@ -1121,7 +1121,7 @@ module sp_neck(diam,type,wall,id,style="L",bead=false, anchor, spin, orient)
isect400 = [for(seg=pair(beadpts)) let(segisect = line_intersection([[T/2,0],[T/2,1]] , seg, LINE, SEGMENT)) if (is_def(segisect)) segisect.y]; isect400 = [for(seg=pair(beadpts)) let(segisect = line_intersection([[T/2,0],[T/2,1]] , seg, LINE, SEGMENT)) if (is_def(segisect)) segisect.y];
extra_bot = type==400 && bead ? -min(columns(beadpts,1))+max(isect400) : 0; extra_bot = type==400 && bead ? -min(column(beadpts,1))+max(isect400) : 0;
bead_shift = type==400 ? H+max(isect400) : entry[5]+W/2; // entry[5] is L bead_shift = type==400 ? H+max(isect400) : entry[5]+W/2; // entry[5] is L
attachable(anchor,spin,orient,r=bead ? beadmax : T/2, l=H+extra_bot){ attachable(anchor,spin,orient,r=bead ? beadmax : T/2, l=H+extra_bot){

View File

@ -1994,7 +1994,7 @@ function align_polygon(reference, poly, angles, cp, trans, return_ind=false) =
return_error=true return_error=true
) )
], ],
scores = columns(alignments,1), scores = column(alignments,1),
minscore = min(scores), minscore = min(scores),
minind = [for(i=idx(scores)) if (scores[i]<minscore+EPSILON) i], minind = [for(i=idx(scores)) if (scores[i]<minscore+EPSILON) i],
dummy = is_def(angles) ? echo(best_angles = select(list(angles), minind)):0, dummy = is_def(angles) ? echo(best_angles = select(list(angles), minind)):0,

View File

@ -926,8 +926,8 @@ module generic_threaded_rod(
assert(higang1 < twist/2); assert(higang1 < twist/2);
assert(higang2 < twist/2); assert(higang2 < twist/2);
prof3d = path3d(profile); prof3d = path3d(profile);
pdepth = -min(columns(profile,1)); pdepth = -min(column(profile,1));
pmax = pitch * max(columns(profile,1)); pmax = pitch * max(column(profile,1));
rmax = max(_r1,_r2)+pmax; rmax = max(_r1,_r2)+pmax;
depth = pdepth * pitch; depth = pdepth * pitch;
dummy1 = assert(_r1>depth && _r2>depth, "Screw profile deeper than rod radius"); dummy1 = assert(_r1>depth && _r2>depth, "Screw profile deeper than rod radius");
@ -1087,7 +1087,7 @@ module generic_threaded_nut(
bevel1 = first_defined([bevel1,bevel,false]); bevel1 = first_defined([bevel1,bevel,false]);
bevel2 = first_defined([bevel2,bevel,false]); bevel2 = first_defined([bevel2,bevel,false]);
dummy1 = assert(is_num(pitch) && pitch>0); dummy1 = assert(is_num(pitch) && pitch>0);
depth = -pitch*min(columns(profile,1)); depth = -pitch*min(column(profile,1));
attachable(anchor,spin,orient, size=[od/cos(30),od,h]) { attachable(anchor,spin,orient, size=[od/cos(30),od,h]) {
difference() { difference() {
cyl(d=od/cos(30), h=h, center=true, $fn=6,chamfer1=bevel1?depth:undef,chamfer2=bevel2?depth:undef); cyl(d=od/cos(30), h=h, center=true, $fn=6,chamfer1=bevel1?depth:undef,chamfer2=bevel2?depth:undef);

View File

@ -366,7 +366,7 @@ function vnf_from_polygons(polygons) =
function _path_path_closest_vertices(path1,path2) = function _path_path_closest_vertices(path1,path2) =
let( let(
dists = [for (i=idx(path1)) let(j=closest_point(path1[i],path2)) [j,norm(path2[j]-path1[i])]], dists = [for (i=idx(path1)) let(j=closest_point(path1[i],path2)) [j,norm(path2[j]-path1[i])]],
i1 = min_index(columns(dists,1)), i1 = min_index(column(dists,1)),
i2 = dists[i1][0] i2 = dists[i1][0]
) [dists[i1][1], i1, i2]; ) [dists[i1][1], i1, i2];
@ -396,7 +396,7 @@ function _cleave_connected_region(region) =
for (i=[1:1:len(region)-1]) for (i=[1:1:len(region)-1])
_path_path_closest_vertices(region[0],region[i]) _path_path_closest_vertices(region[0],region[i])
], ],
idxi = min_index(columns(dists,0)), idxi = min_index(column(dists,0)),
newoline = _join_paths_at_vertices( newoline = _join_paths_at_vertices(
region[0], region[idxi+1], region[0], region[idxi+1],
dists[idxi][1], dists[idxi][2] dists[idxi][1], dists[idxi][2]
@ -584,7 +584,7 @@ function vnf_slice(vnf,dir,cuts) =
function _split_polygon_at_x(poly, x) = function _split_polygon_at_x(poly, x) =
let( let(
xs = columns(poly,0) xs = column(poly,0)
) (min(xs) >= x || max(xs) <= x)? [poly] : ) (min(xs) >= x || max(xs) <= x)? [poly] :
let( let(
poly2 = [ poly2 = [