Removed orient_and_anchor() use in distributors.

This commit is contained in:
Revar Desmera
2020-02-28 21:36:10 -08:00
parent 2f8787dac5
commit 3c3318de63
2 changed files with 23 additions and 30 deletions

View File

@@ -414,9 +414,6 @@ module zdistribute(spacing=10, sizes=undef, l=undef)
// stagger = If true, make a staggered (hexagonal) grid. If false, make square grid. If `"alt"`, makes alternate staggered pattern. Default: false // stagger = If true, make a staggered (hexagonal) grid. If false, make square grid. If `"alt"`, makes alternate staggered pattern. Default: false
// scale = [X,Y] scaling factors to reshape grid. // scale = [X,Y] scaling factors to reshape grid.
// in_poly = If given a list of polygon points, only creates copies whose center would be inside the polygon. Polygon can be concave and/or self crossing. // in_poly = If given a list of polygon points, only creates copies whose center would be inside the polygon. Polygon can be concave and/or self crossing.
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0`
// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP`
// //
// Side Effects: // Side Effects:
// `$pos` is set to the relative centerpoint of each child copy, and can be used to modify each child individually. // `$pos` is set to the relative centerpoint of each child copy, and can be used to modify each child individually.
@@ -452,7 +449,7 @@ module zdistribute(spacing=10, sizes=undef, l=undef)
// zrot(180/6) // zrot(180/6)
// cylinder(h=20, d=10/cos(180/6)+0.01, $fn=6); // cylinder(h=20, d=10/cos(180/6)+0.01, $fn=6);
// } // }
module grid2d(size=undef, spacing=undef, cols=undef, rows=undef, stagger=false, scale=[1,1,1], in_poly=undef, anchor=CENTER, spin=0, orient=UP) module grid2d(size=undef, spacing=undef, cols=undef, rows=undef, stagger=false, scale=[1,1,1], in_poly=undef)
{ {
assert(in_list(stagger, [false, true, "alt"])); assert(in_list(stagger, [false, true, "alt"]));
scl = vmul(scalar_vec3(scale, 1), (stagger!=false? [0.5, sin(60), 1] : [1,1,1])); scl = vmul(scalar_vec3(scale, 1), (stagger!=false? [0.5, sin(60), 1] : [1,1,1]));
@@ -476,7 +473,6 @@ module grid2d(size=undef, spacing=undef, cols=undef, rows=undef, stagger=false,
siz = vmul(spc, [mcols-1, mrows-1, 0])+[0,0,0.01]; siz = vmul(spc, [mcols-1, mrows-1, 0])+[0,0,0.01];
staggermod = (stagger == "alt")? 1 : 0; staggermod = (stagger == "alt")? 1 : 0;
if (stagger == false) { if (stagger == false) {
orient_and_anchor(siz, orient, anchor, spin=spin) {
for (row = [0:1:mrows-1]) { for (row = [0:1:mrows-1]) {
for (col = [0:1:mcols-1]) { for (col = [0:1:mcols-1]) {
pos = [col*spc.x, row*spc.y] - point2d(siz/2); pos = [col*spc.x, row*spc.y] - point2d(siz/2);
@@ -488,10 +484,8 @@ module grid2d(size=undef, spacing=undef, cols=undef, rows=undef, stagger=false,
} }
} }
} }
}
} else { } else {
// stagger == true or stagger == "alt" // stagger == true or stagger == "alt"
orient_and_anchor(siz, orient, anchor, spin=spin) {
cols1 = ceil(mcols/2); cols1 = ceil(mcols/2);
cols2 = mcols - cols1; cols2 = mcols - cols1;
for (row = [0:1:mrows-1]) { for (row = [0:1:mrows-1]) {
@@ -512,7 +506,6 @@ module grid2d(size=undef, spacing=undef, cols=undef, rows=undef, stagger=false,
} }
} }
} }
}

View File

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