35 include <math_bitwise.scad>;
110 rotate_extrude(angle = (profile==
true ? 1 : ra) )
162 [+lx/2, +ly/2, 0, 1],
163 [-lx/2, +ly/2, 90, 3],
164 [-lx/2, -ly/2, 180, 5],
165 [+lx/2, -ly/2, 270, 7]
170 translate([i[0], i[1], 0])
179 [ +r +lx/2, +ly/2, 0, ly, 0],
180 [ -lx/2, +r +ly/2, 90, lx, 2],
181 [ -r -lx/2, -ly/2, 180, ly, 4],
182 [ lx/2, -r -ly/2, 270, lx, 6]
187 translate([i[0], i[1], 0])
188 rotate([90, 0, i[2]])
189 linear_extrude(height=i[3])
241 translate(center==
true ? [0, 0, -h/2] :
origin3d)
242 linear_extrude(height=h)
249 n1 = (len(h) >= 3) ? max(h[1], 0) : undef;
250 z1 = (len(h) >= 3) ? abs(h[2])/100 : undef;
251 x1 = (len(h) >= 4) ? h[3] /100 : -z1;
252 y1 = (len(h) >= 5) ? h[4] /100 : x1;
254 n2 = (len(h) >= 6) ? max(h[5], 0) : n1;
255 z2 = (len(h) >= 7) ? abs(h[6])/100 : z1;
256 x2 = (len(h) >= 8) ? h[7] /100 : x1;
257 y2 = (len(h) >= 9) ? h[8] /100 : y1;
259 h1 = (n1>0) ? z1 * z : 0;
260 h2 = (n2>0) ? z2 * z : 0;
263 translate(center==
true ? [0, 0, -z/2] :
origin3d)
267 translate([0, 0, h0+h2])
268 for( s = [0 : n1-1] )
270 translate([0, 0, h1/n1*s])
271 scale([1+x1/n1*(s+1), 1+y1/n1*(s+1), 1])
272 linear_extrude(height=h1/n1)
277 translate([0, 0, h2])
278 linear_extrude(height=h0)
283 for( s = [0 : n2-1] )
285 translate([0, 0, h2/n2*s])
286 scale([1+x2/n2*(n2-s), 1+y2/n2*(n2-s), 1])
287 linear_extrude(height=h2/n2)
329 for ( p =
ngon_vp( r=r, n=n ) )
331 translate(move==
true ? p :
origin2d)
371 if ( ( $children * copy ) > ( gridx * gridy * gridz ) )
373 log_warn(
"more objects than grid capacity, shapes will overlap.");
378 "children=", $children,
380 ", objects=", $children * copy
387 "grid[x,y,z]=[", gridx,
", ", gridy,
", ", gridz,
"]",
388 ", capacity=", gridx * gridy * gridz
397 -( min($children * copy, gridx) -1 ) * incrx / 2,
398 -( min(ceil($children * copy/gridx), gridy) -1 ) * incry / 2,
399 -( min(ceil($children * copy/gridx/gridy), gridz) -1 ) * incrz / 2
408 x = [0 : ($children-1)]
411 i = y * $children + x;
417 incry * (floor(i/gridx)%gridy),
418 incrz * (floor(floor(i/gridx)/gridy)%gridz)
function angle_vv(v1t, v2t, v1i, v2i)
Compute the angle between two vectors in a Euclidean 2 or 3D-space.
module log_info(m)
Output information message to console.
function not_defined(v)
Test if a value is not defined.
module log_warn(m)
Output warning message to console.
function ngon_vp(n, r, vr)
Compute the vertices for an n-sided equiangular/equilateral regular polygon.
origin3d
The origin coordinates in 3-dimensional Euclidean space.
function edefined_or(v, i, d)
Return a defined vector element or default value.
function is_scalar(v)
Test if a value is a single non-iterable value.
function bitwise_is_equal(v, b, t=1)
Test if a base-two bit position of an integer value equals a test bit.
origin2d
The origin coordinates in 2-dimensional Euclidean space.
x_axis2d_uv
The unit vector of the positive x-axis in 2-dimensional Euclidean space.