| 1 |
.PS |
| 2 |
# hexagon.m4 |
| 3 |
#https://tex.stackexchange.com/questions/708149/how-to-draw-a-regular-rounded-corners-hexagons-with-tikz |
| 4 |
gen_init |
| 5 |
command "{\tiny" |
| 6 |
|
| 7 |
CI: circle thick 4 rad 5/8 |
| 8 |
CO: circle rad CI.rad*1.35 at CI |
| 9 |
prad = CO.rad*4/5 |
| 10 |
for i=1 to 6 do { P[i]: polygon(6,rad=prad;radv=CO.rad/10) \ |
| 11 |
at CO+(Rect_(CO.rad*7/4,i*60-30)) |
| 12 |
circle rad CI.rad*2/3 at P[i] |
| 13 |
} |
| 14 |
for i=1 to 6 do { ii = pmod(i,6)+1 |
| 15 |
A: move from P[i]+(Rect_(prad,i*60)) to P[i]+(Rect_(prad,i*60+60)) |
| 16 |
B: move from P[ii]+(Rect_(prad,i*60)) to P[ii]+(Rect_(prad,i*60-60)) |
| 17 |
C: Intersect_(A,B) |
| 18 |
move to A.end; arcto(C,B,CO.rad/10); line to B.end |
| 19 |
} |
| 20 |
foreach_(`term',`r_text(eval((((m4Lx-1)*60+90)%180)-90),term, |
| 21 |
at CO+(Rect_(CO.rad*1.45,(m4Lx-1)*60)))', |
| 22 |
\sf NEUTRON,\sf ALNITAK,\sf ALNILAM,\sf MINTAKA,\sf PROTON,\sf ELECTRON) |
| 23 |
|
| 24 |
command "}%" |
| 25 |
.PE |