mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
Fixed bogus rotation in grid2d()
This commit is contained in:
parent
f25fdc975d
commit
6ce93f75e0
1 changed files with 5 additions and 4 deletions
|
@ -1113,7 +1113,7 @@ module zdistribute(spacing=10, sizes=undef, l=undef)
|
||||||
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, anchor=CENTER, spin=0, orient=UP)
|
||||||
{
|
{
|
||||||
assert_in_list("stagger", stagger, [false, true, "alt"]);
|
assert_in_list("stagger", stagger, [false, true, "alt"]);
|
||||||
scl = vmul(scalar_vec3(scale, 1), (stagger!=false? [0.5, sin(60), 0] : [1,1,0]));
|
scl = vmul(scalar_vec3(scale, 1), (stagger!=false? [0.5, sin(60), 1] : [1,1,1]));
|
||||||
if (!is_undef(size)) {
|
if (!is_undef(size)) {
|
||||||
siz = scalar_vec3(size);
|
siz = scalar_vec3(size);
|
||||||
if (!is_undef(spacing)) {
|
if (!is_undef(spacing)) {
|
||||||
|
@ -1131,7 +1131,8 @@ module grid2d(size=undef, spacing=undef, cols=undef, rows=undef, stagger=false,
|
||||||
bnds = !is_undef(bounds)? [for (a=[0,1]) 2*max(vabs([ for (i=[0,1]) bounds[i][a] ]))+1 ] : undef;
|
bnds = !is_undef(bounds)? [for (a=[0,1]) 2*max(vabs([ for (i=[0,1]) bounds[i][a] ]))+1 ] : undef;
|
||||||
mcols = !is_undef(cols)? cols : (!is_undef(spc) && !is_undef(bnds))? quantup(ceil(bnds[0]/spc[0])-1, 4)+1 : undef;
|
mcols = !is_undef(cols)? cols : (!is_undef(spc) && !is_undef(bnds))? quantup(ceil(bnds[0]/spc[0])-1, 4)+1 : undef;
|
||||||
mrows = !is_undef(rows)? rows : (!is_undef(spc) && !is_undef(bnds))? quantup(ceil(bnds[1]/spc[1])-1, 4)+1 : undef;
|
mrows = !is_undef(rows)? rows : (!is_undef(spc) && !is_undef(bnds))? quantup(ceil(bnds[1]/spc[1])-1, 4)+1 : undef;
|
||||||
siz = vmul(spc, [mcols-1, mrows-1, 0]);
|
siz = vmul(spc, [mcols-1, mrows-1, 0.01]);
|
||||||
|
echo(siz=siz, spc=spc, spacing=spacing, scl=scl, mcols=mcols, mrows=mrows);
|
||||||
staggermod = (stagger == "alt")? 1 : 0;
|
staggermod = (stagger == "alt")? 1 : 0;
|
||||||
if (stagger == false) {
|
if (stagger == false) {
|
||||||
orient_and_anchor(siz, orient, anchor, spin=spin) {
|
orient_and_anchor(siz, orient, anchor, spin=spin) {
|
||||||
|
@ -1142,7 +1143,7 @@ module grid2d(size=undef, spacing=undef, cols=undef, rows=undef, stagger=false,
|
||||||
$col = col;
|
$col = col;
|
||||||
$row = row;
|
$row = row;
|
||||||
$pos = pos;
|
$pos = pos;
|
||||||
translate(pos) rot(orient,reverse=true) children();
|
translate(pos) children();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1162,7 +1163,7 @@ module grid2d(size=undef, spacing=undef, cols=undef, rows=undef, stagger=false,
|
||||||
$col = col * 2 + ((row%2!=staggermod)? 1 : 0);
|
$col = col * 2 + ((row%2!=staggermod)? 1 : 0);
|
||||||
$row = row;
|
$row = row;
|
||||||
$pos = pos;
|
$pos = pos;
|
||||||
translate(pos) rot(orient,reverse=true) children();
|
translate(pos) children();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue