33 include <../console.scad>;
34 include <../math/math-base.scad>;
35 include <../math/math_oshapes.scad>;
36 include <../math/math_bitwise.scad>;
111 rotate_extrude(angle = (profile==
true ? 1 : ra) )
163 [+lx/2, +ly/2, 0, 1],
164 [-lx/2, +ly/2, 90, 3],
165 [-lx/2, -ly/2, 180, 5],
166 [+lx/2, -ly/2, 270, 7]
171 translate([i[0], i[1], 0])
180 [ +r +lx/2, +ly/2, 0, ly, 0],
181 [ -lx/2, +r +ly/2, 90, lx, 2],
182 [ -r -lx/2, -ly/2, 180, ly, 4],
183 [ lx/2, -r -ly/2, 270, lx, 6]
188 translate([i[0], i[1], 0])
189 rotate([90, 0, i[2]])
190 linear_extrude(height=i[3])
245 translate(center==
true ? [0, 0, -h/2] :
origin3d)
246 linear_extrude(height=h)
253 n1 = (len(h) >= 3) ? max(h[1], 0) : undef;
254 z1 = (len(h) >= 3) ? abs(h[2])/100 : undef;
255 x1 = (len(h) >= 4) ? h[3] /100 : -z1;
256 y1 = (len(h) >= 5) ? h[4] /100 : x1;
258 n2 = (len(h) >= 6) ? max(h[5], 0) : n1;
259 z2 = (len(h) >= 7) ? abs(h[6])/100 : z1;
260 x2 = (len(h) >= 8) ? h[7] /100 : x1;
261 y2 = (len(h) >= 9) ? h[8] /100 : y1;
263 h1 = (n1>0) ? z1 * z : 0;
264 h2 = (n2>0) ? z2 * z : 0;
267 translate(center==
true ? [0, 0, -z/2] :
origin3d)
271 translate([0, 0, h0+h2])
272 for( s = [0 : n1-1] )
274 translate([0, 0, h1/n1*s])
275 scale([1+x1/n1*(s+1), 1+y1/n1*(s+1), 1])
276 linear_extrude(height=h1/n1)
281 translate([0, 0, h2])
282 linear_extrude(height=h0)
287 for( s = [0 : n2-1] )
289 translate([0, 0, h2/n2*s])
290 scale([1+x2/n2*(n2-s), 1+y2/n2*(n2-s), 1])
291 linear_extrude(height=h2/n2)
335 translate(move==
true ? p :
origin2d)
376 if ( ( $children * c ) > ( gridx * gridy * gridz ) )
378 log_warn(
"more objects than grid capacity, shapes will overlap.");
383 "children=", $children,
385 ", objects=", $children * c
392 "grid[x,y,z]=[", gridx,
", ", gridy,
", ", gridz,
"]",
393 ", capacity=", gridx * gridy * gridz
402 -( min($children * c, gridx) -1 ) * incrx / 2,
403 -( min(ceil($children * c/gridx), gridy) -1 ) * incry / 2,
404 -( min(ceil($children * c/gridx/gridy), gridz) -1 ) * incrz / 2
413 x = [0 : ($children-1)]
416 j = y * $children + x;
422 incry * (floor(j/gridx)%gridy),
423 incrz * (floor(floor(j/gridx)/gridy)%gridz)
function rpolygon_lp(n, r, a, vr, cw=true)
Compute the coordinates for an n-sided regular polygon.
function is_scalar(v)
Test if a value is a single non-iterable value.
function edefined_or(v, i, d)
Return an iterable element when it exists or a default value when it does not.
module log_warn(m)
Output warning message to console.
module log_info(m)
Output information message to console.
function not_defined(v)
Test if a value is not defined.
origin3d
The origin point coordinate in 3-dimensional Euclidean space.
function angle_ll(l1, l2)
Compute the angle between two lines (or vectors) in a Euclidean 3d or 2d-space.
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 point coordinate in 2d Euclidean space.
x_axis2d_uv
The unit vector of the positive x-axis in 2d Euclidean space.