99 function draft_sheet_get_window
133 ldx = sll ? sdy : sdx,
134 ldy = sll ? sdx : sdy,
148 iox = (zox > 0) ? ix : len(zlx)-1-ix
150 iox * fdx/len(zlx) -fdx/2
155 iox = (zox > 0) ? zxi : len(zlx)-1-zxi
157 iox * fdx/len(zlx) -fdx/2
162 ioy = (zoy > 0) ? iy : len(zly)-1-iy
164 ioy * fdy/len(zly) -fdy/2
169 ioy = (zoy > 0) ? zyi : len(zly)-1-zyi
171 ioy * fdy/len(zly) - fdy/2
176 [zxs, zxs + fdx/len(zlx)]
181 [zys, zys + fdy/len(zly)]
190 : [[wx[0],wy[0]], [wx[0],wy[1]], [wx[1],wy[1]], [wx[1],wy[0]]];
237 wl = !is_list(rx) && !is_list(ix) && !is_list(ry) && !is_list(iy) ?
239 draft_sheet_get_window( rx=rx, ry=ry, ix=ix, iy=iy, frame=frame, limits=true )
246 w1 = draft_sheet_get_window( ix=
first(ix), frame=frame, limits=true ),
247 w2 = draft_sheet_get_window( ix=
last(ix), frame=frame, limits=true )
249 [min(w1[0][0], w2[0][0]), max(w1[0][1], w2[0][1])]
253 w1 = draft_sheet_get_window( rx=
first(rx), frame=frame, limits=true ),
254 w2 = draft_sheet_get_window( rx=
last(rx), frame=frame, limits=true )
256 [min(w1[0][0], w2[0][0]), max(w1[0][1], w2[0][1])]
259 w1 = draft_sheet_get_window( rx=rx, ix=ix, frame=frame, limits=true )
267 w1 = draft_sheet_get_window( iy=
first(iy), frame=frame, limits=true ),
268 w2 = draft_sheet_get_window( iy=
last(iy), frame=frame, limits=true )
270 [min(w1[1][0], w2[1][0]), max(w1[1][1], w2[1][1])]
274 w1 = draft_sheet_get_window( ry=
first(ry), frame=frame, limits=true ),
275 w2 = draft_sheet_get_window( ry=
last(ry), frame=frame, limits=true )
277 [min(w1[1][0], w2[1][0]), max(w1[1][1], w2[1][1])]
280 w1 = draft_sheet_get_window( ry=ry, iy=iy, frame=frame, limits=true )
290 [wl[0][0], wl[1][0]],
291 [wl[0][0], wl[1][1]],
292 [wl[0][1], wl[1][1]],
302 cx = ( px * (wl[0][1]-wl[0][0]) + (wl[0][0]+wl[0][1]) )/2,
303 cy = ( py * (wl[1][1]-wl[1][0]) + (wl[1][0]+wl[1][1]) )/2
328 function draft_table_get_point
351 xu = is_undef(ix) ? 0
353 :
sum([for( i=[1:ix] ) cols[i-1]]),
359 yu = is_undef(iy) ? 0
362 : (iy == 2) ?
sum( [yt, yh] )
371 [xu*cmh*coh, yu*cmv*cov];
421 lv = is_undef(ix) ? [0, len(cols)]
422 : (iy <= 0) ? [0, len(cols)]
426 lh = is_undef(iy) ? [0, len(rows)+2]
432 [ for( i=[0, 1] ) draft_table_get_point( ix=lv[i], map=map, fmap=fmap )[0] ],
433 [ for( i=[0, 1] ) draft_table_get_point( iy=lh[i], map=map, fmap=fmap )[1] ]
442 [wl[0][0], wl[1][0]],
443 [wl[0][0], wl[1][1]],
444 [wl[0][1], wl[1][1]],
454 cx = ( px * (wl[0][1]-wl[0][0]) + (wl[0][0]+wl[0][1]) )/2,
455 cy = ( py * (wl[1][1]-wl[1][0]) + (wl[1][0]+wl[1][1]) )/2
521 function erdefined_or (v, r, d) = [
for (i = r)
defined_or( v[i], d[i] )];
534 sf = is_string(text) ? [text]
539 tv = is_string(text) ? [text]
541 : is_list(text[0]) ? text[0]
545 df = erdefined_or( sf, [0:11], dfmt );
547 for ( l=[0:len(tv)-1] )
553 + [ df[2][0], df[2][1] ] * size * df[5]
555 + df[3] * size * df[5] * l
584 function draft_ztable_get_point
602 x = is_undef(ix) ? 0 :
sum([
for( i=[0:ix] ) vlines[i][0]]) * cmh * coh,
603 y = is_undef(iy) ? 0 :
sum([
for( i=[0:iy] ) hlines[i][0]]) * cmv * cov
650 zx = is_undef(i) ? [0, len(
map_get_value(map,
"vlines"))-1] : zones[i][0],
653 zy = is_undef(i) ? [0, len(
map_get_value(map,
"hlines"))-1] : zones[i][1],
658 [
for( i=[1, 0] ) draft_ztable_get_point( ix=zx[i], map=map )[0] ],
659 [
for( i=[0, 1] ) draft_ztable_get_point( iy=zy[i], map=map )[1] ]
668 [wl[0][0], wl[1][0]],
669 [wl[0][0], wl[1][1]],
670 [wl[0][1], wl[1][1]],
680 cx = ( px * (wl[0][1]-wl[0][0]) + (wl[0][0]+wl[0][1]) )/2,
681 cy = ( py * (wl[1][1]-wl[1][0]) + (wl[1][0]+wl[1][1]) )/2
745 function erdefined_or (v, r, d) = [
for (i = r)
defined_or( v[i], d[i] )];
748 tv = is_list(text) ? text : [text];
751 df = erdefined_or( fmt, [0:11], dfmt );
753 for ( l=[0:len(tv)-1] )
759 + [ df[2][0], df[2][1] ] * size * df[5]
761 + df[3] * size * df[5] * l
813 hull() { translate(i) circle(d=p); translate(t) circle(d=p); }
946 xl1 =
line2d_new(m=+al/3*2, a=alx+180-ca*2, p1=pah);
947 xl2 =
line2d_new(m=-al/3*2, a=alx+180-ca*2, p1=pah);
954 xl1 =
line2d_new(m=+al/3*2, a=alx-180+ca*2, p1=pah);
955 xl2 =
line2d_new(m=-al/3*2, a=alx-180+ca*2, p1=pah);
1097 for (j = [1:len(mp)-2])
1120 for (i = [1:len(bp)-2])
1127 [ lp[1], xp[0], xp[1], lp[0] ]
x_axis2d_ul
<line-2d> A positively-directed unit line centered on the x-axis in 2d Euclidean space.
origin2d
<point-2d> The origin point coordinate in 2d Euclidean space.
y_axis3d_ul
<line-3d> A positively-directed unit line centered on the y-axis in 3d Euclidean space.
x_axis2d_uv
<vector-2d> The unit vector of the positive x-axis in 2d Euclidean space.
function binary_bit_is(v, b, t=1)
Test if a binary bit position of an integer value equals a test bit.
function line_tp(l)
Return the terminal point of a line or vector.
function angle_ll(l1, l2, s=true)
Compute the angle between two lines or vectors in a 3d or 2d-space.
function line_ip(l)
Return the initial point of a line or vector.
function line2d_new(m=1, a=0, p1=origin2d, p2, v)
Construct a 2 dimensional directed line.
function distance_pp(p1, p2)
Compute the distance between two points.
function firstn(v, n=1)
Return a list containing the first n elements of an iterable value.
function find(mv, v, c=1, i, i1=0, i2)
Find the occurrences of a match value in an iterable value.
function defined_e_or(v, i, d)
Return an element of an iterable when it exists or a default value otherwise.
function last(v)
Return the last element of an iterable value.
function exists(mv, v, s=true, i)
Check for the existence of a match value in an iterable value.
function second(v)
Return the second element of an iterable value.
function lastn(v, n=1)
Return a list containing the last n elements of an iterable value.
function first(v)
Return the first element of an iterable value.
function sequence_ns(v, n=1, s=1, w=false)
Return a list of all n-element sequential-subsets of an iterable value.
function reverse(v)
Reverse the elements of an iterable value.
function all_equal(v, cv)
Test if all elements of an iterable value equal a comparison value.
function all_strings(v, c=0)
Test if all elements of an iterable value are strings.
function index_gen(l, s=true, rs)
Create a element selection index list for a given list of values.
function consts(l, v, u=false)
Create a list of constant or incrementing elements.
function merge_s(v, r=false)
Serially merge the elements of a list.
function sum(v, i1, i2)
Compute the sum of a list of numbers.
function map_get_value(m, k)
Get the map value associated with a key.
function map_get_firstof2_or(m1, m2, k, d)
Get the the first value associated with an existing key in one of two maps.
function defined_or(v, d)
Return given value, if defined, or a secondary value, if primary is not defined.
function is_defined(v)
Test if a value is defined.
function polygon_arc_p(r=1, c=origin2d, v1=x_axis2d_uv, v2=x_axis2d_uv, fn, cw=true)
Compute coordinates of an arc with constant radius between two vectors in 2D.
function polygon_regular_p(n, r, a, c=origin2d, o=0, vr, cw=true)
Compute coordinates for an n-sided regular polygon in 2D.
function polygon_line_p(p1=origin2d, p2=x_axis2d_uv, l, x, y, r, fs, ft, fn=1)
Compute coordinates along a line in 2D.
function polytope_faces2edges(f)
List the edge coordinate index pairs of a polytope.