92 translate(center==
true ? [-rx/2, -ry/2] :
origin2d)
100 for ( i = [ [0, 0, 1, 0, 1, 0],
101 [1, 1, -1, 0, 1, 90],
102 [2, 1, -1, 1, -1, 180],
103 [3, 0, 1, 1, -1, 270] ] )
105 translate([rx*i[1] + vr * i[2], ry*i[3] + vr * i[4]])
113 polygon(points=[[
eps,-vr], [
eps,
eps], [-vr,
eps]], paths=[[0,1,2]]);
118 square([rx, ry] - [0, vr*2]);
121 square([rx, ry] - [vr*2, 0]);
130 for ( i = [ [0, 0, 1, 0, 1],
137 translate([rx*i[1] + crv[i[0]] * i[2], ry*i[3] + crv[i[0]] * i[4]])
157 [rx*i[1] + crv[i[0]] * i[2], ry*i[3] + crv[i[0]] * i[4]]
160 polygon( points=ppv, paths=[ [0,1,2,3,4,5,6,7] ] );
230 translate(center==
true ?
origin2d : [rx/2, ry/2])
233 rectangle(size=od, vr=or, vrm=om, center=
true);
237 rectangle(size=
id, vr=ir, vrm=im, center=
true);
242 rectangle(size=od, vr=or, vrm=om, center=center);
275 translate(center==
true ?
origin2d : [rx, ry])
281 points=[ [rx,0], [0,ry], [-rx,0], [0,-ry] ],
294 a1 =
angle_ll([[rx,0], [0,ry]], [[rx,0], [0,-ry]]) / 2;
297 for ( i = [ [0, 1, -1, 0, 0],
304 [ rx*i[1] + crv[i[0]]/sin(a1) * i[2], ry*i[3] + crv[i[0]]/sin(a2) * i[4] ]
306 circle (r=crv[i[0]]);
314 [0, 0, 1, -1, 0, -1],
317 [1, 1, 0, -1, 1, -1],
319 [2, 0, -1, 1, 0, -1],
320 [3, 1, 0, -1, -1, 1],
321 [3, 1, 0, +1, -1, +1]
326 rx*i[2] + crv[i[0]] * (1/sin(a1)-sin(a1)) * i[3],
327 ry*i[4] + crv[i[0]] * cos(a1) * i[5]
330 rx*i[2] + crv[i[0]] * cos(a2) * i[3],
331 ry*i[4] + crv[i[0]] * (1/sin(a2)-sin(a2)) * i[5]
335 polygon( points=ppv, paths=[ [0,1,2,3,4,5,6,7] ] );
479 trx = rx * sqrt(2) + 1;
480 try = ry * sqrt(2) + 1;
482 pa0 = (4 * a1 + 0 * a2) / 4;
483 pa1 = (3 * a1 + 1 * a2) / 4;
484 pa2 = (2 * a1 + 2 * a2) / 4;
485 pa3 = (1 * a1 + 3 * a2) / 4;
486 pa4 = (0 * a1 + 4 * a2) / 4;
497 [trx * cos(pa0),
try * sin(pa0)],
498 [trx * cos(pa1),
try * sin(pa1)],
499 [trx * cos(pa2),
try * sin(pa2)],
500 [trx * cos(pa3),
try * sin(pa3)],
501 [trx * cos(pa4),
try * sin(pa4)],
origin2d
<point-2d> The origin point coordinate in 2d Euclidean space.
eps
<decimal> Epsilon, small distance to deal with overlapping shapes.
function binary_bit_is(v, b, t=1)
Test if a binary bit position of an integer value equals a test bit.
function angle_ll(l1, l2, s=true)
Compute the angle between two lines or vectors in a 3d or 2d-space.
function defined_e_or(v, i, d)
Return an element of an iterable when it exists or a default value otherwise.
function all_defined(v)
Test if no element of an iterable value has an undefined value.
function defined_or(v, d)
Return given value, if defined, or a secondary value, if primary is not defined.
function is_scalar(v)
Test if a value is a single non-iterable value.
function is_defined(v)
Test if a value is defined.
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_round_eve_all_p(c, vr=0, vrm=1, vfn, w=true, cw=true)
Compute coordinates that round all of the vertices between each adjacent edges in 2D.
function triangle2d_sss2ppp(v, a=x_axis_ci, cw=true)
Compute a set of vertex coordinates for a triangle given its side lengths in 2D.
module ellipse_cs(size, core, t, a1=0, a2=0, co, cr=0)
A sector of an ellipse with a removed elliptical core.
module ngon(n, r, vr)
An n-sided equiangular/equilateral regular polygon.
module star2d(size, n=5, vr)
A two-dimensional star.
module ellipse(size)
An ellipse.
module rectangle_c(size, core, t, co, cr=0, vr, vr1, vr2, vrm=0, vrm1, vrm2, center=false)
A rectangle with a removed rectangular core.
module ellipse_s(size, a1=0, a2=0)
An ellipse sector.
module rhombus(size, vr, center=false)
A rhombus.
module ellipse_c(size, core, t, co, cr=0)
An ellipse with a removed elliptical core.
module rectangle(size, vr, vrm=0, center=false)
A rectangle with corner rounds or chamfers.
function angle(a, from=angle_unit_default, to=angle_unit_base)
Convert an angle from some units to another.