| 1 |
.PS |
| 2 |
# rose.m4 |
| 3 |
gen_init |
| 4 |
ifelse( |
| 5 |
ifpstricks(T)`'ifmpost(T)`'ifpostscript(T)`'ifpdf(T)`'ifpgf(T)`'ifsvg(T),, |
| 6 |
`This diagram is for PSTricks, postscript, PDF, MetaPost, or svg', |
| 7 |
` |
| 8 |
|
| 9 |
scale = 1.25 |
| 10 |
Rose: [ |
| 11 |
define(`gold_',`1,0.84,0') |
| 12 |
|
| 13 |
define(`rose',`point_(`$2'); CC: (vec_(`$1',0)); rrad = `$3' |
| 14 |
move to CC |
| 15 |
tmp = rrad-stripwid |
| 16 |
{circle shaded rgbstring(gold_) rad rrad-sthick at CC} |
| 17 |
{circle shaded rgbstring(gold_) rad tmp-sthick at CC} |
| 18 |
{line to rvec_(rrad,0) chop tmp chop 0 } |
| 19 |
{line to rvec_(-rrad,0) chop tmp chop 0 } |
| 20 |
{line to rvec_(0,rrad) chop tmp chop 0 } |
| 21 |
{line to rvec_(0,-rrad) chop tmp chop 0 } |
| 22 |
{line from rvec_(-tmp/sqrt(2),-tmp/sqrt(2)) to rvec_(tmp/sqrt(2),tmp/sqrt(2))} |
| 23 |
{line from rvec_(-tmp/sqrt(2),tmp/sqrt(2)) to rvec_(tmp/sqrt(2),-tmp/sqrt(2))} |
| 24 |
{circle shaded rgbstring(gold_) rad tmp-stripwid-sthick at CC} |
| 25 |
tmp = last circle.rad/sqrt(2) |
| 26 |
line thick stripthick from rvec_(-tmp,0) to rvec_(0,-tmp) \ |
| 27 |
then to rvec_(tmp,0) then to rvec_(0,tmp) then to rvec_(-tmp,0) \ |
| 28 |
shaded rgbstring(gold_) |
| 29 |
') |
| 30 |
|
| 31 |
define(`spt_',`/72.27') |
| 32 |
|
| 33 |
[ lsk = 1.2 |
| 34 |
sector = 360*dtor_/16 |
| 35 |
exterior = 2.49 |
| 36 |
outer_circle = exterior-0.55 |
| 37 |
inner_circle = 1.1 |
| 38 |
spoke_tail = 0.41 |
| 39 |
spokethick = 0.09/(1spt_) # points |
| 40 |
stripwid = 0.05 |
| 41 |
stripthick = 1.6/1.2 |
| 42 |
midroserad = inner_circle*sin(sector/2)-stripwid/2 |
| 43 |
outerroserad = outer_circle*sin(sector/4)-stripwid/2 |
| 44 |
del = 0.05 |
| 45 |
|
| 46 |
C: (0,0) |
| 47 |
circle rad exterior fill_(0) at C |
| 48 |
circle shaded rgbstring(gold_) rad outer_circle at C |
| 49 |
circle rad spoke_tail fill_(0) at C |
| 50 |
linethick = stripthick |
| 51 |
sthick = linethick/2 spt_ |
| 52 |
for i=0 to 15 do { |
| 53 |
move to rect_(spoke_tail+1.5*stripwid,sector*i); |
| 54 |
for j=-1 to 1 by 2 do { |
| 55 |
{point_(sector*(i+j*0.5)) |
| 56 |
line to rvec_(outer_circle-spoke_tail,0) } |
| 57 |
{ point_(sector*i) |
| 58 |
move to rvec_(0,j*spokethick spt_) |
| 59 |
line to rvec_(outer_circle-spoke_tail,0) \ |
| 60 |
chop outer_circle-inner_circle chop 0 |
| 61 |
} |
| 62 |
} |
| 63 |
crad = 0.25 +1.5*stripwid |
| 64 |
cthick = 1.5*stripwid/(1spt_) |
| 65 |
X: rect_(inner_circle+midroserad,sector*i) |
| 66 |
circle outlined rgbstring(gold_) rad crad-(cthick/2 spt_) thick cthick at X |
| 67 |
circle rad crad - sthick at X |
| 68 |
} |
| 69 |
for i=0 to 15 do { |
| 70 |
X: rect_(inner_circle+midroserad,sector*i) |
| 71 |
circle fill_(0) rad crad-1.5*stripwid-sthick at X |
| 72 |
|
| 73 |
for j = -1 to 1 by 2 do { move to X+vec_(0.20,j*0.14) |
| 74 |
point_(sector*(i+j*0.25)) |
| 75 |
line to rvec_(1.5*stripwid,0) } |
| 76 |
|
| 77 |
circle shaded rgbstring(gold_) rad midroserad*2/3-sthick at X |
| 78 |
circle rad midroserad*2/3-stripwid-sthick at X |
| 79 |
line from X to -(midroserad*2/3/(inner_circle+midroserad))<X,C> |
| 80 |
} |
| 81 |
|
| 82 |
crad = spoke_tail+7*stripwid |
| 83 |
cthick = 2*stripwid/(1spt_) |
| 84 |
circle outlined rgbstring(gold_) rad crad-cthick/2 spt_ thick cthick at C |
| 85 |
circle rad spoke_tail+1.5*stripwid-sthick at C |
| 86 |
for i=5 to 7 do { circle rad spoke_tail+i*stripwid-sthick at C } |
| 87 |
# Spokes and roses |
| 88 |
for i=0 to 15 do { |
| 89 |
rose(inner_circle,sector*i,midroserad) |
| 90 |
line thick spokethick/lsk from C to rect_(outer_circle,sector*(i-0.5)) |
| 91 |
line thick spokethick/lsk from C to rect_(outer_circle,sector*i) \ |
| 92 |
chop inner_circle+midroserad*2 chop 0 |
| 93 |
for j=-1 to 1 by 2 do { |
| 94 |
X: rect_(outer_circle+outerroserad-linethick spt_,sector*(i+j*0.25)) |
| 95 |
linethick = 1/lsk |
| 96 |
circle colored rgbstring(gold_) rad outerroserad*1/2-1/lsk/2 spt_ at X |
| 97 |
linethick = stripthick |
| 98 |
circle fill_(0) rad outerroserad*1/3-sthick at X |
| 99 |
point_(sector*(i+j*0.25)) |
| 100 |
line from X to X + vec_(outerroserad,0) |
| 101 |
rose(outer_circle,sector*(i+j*0.25),outerroserad) |
| 102 |
} |
| 103 |
} |
| 104 |
# Outer decorations |
| 105 |
for i=0 to 31 do { |
| 106 |
move to rect_(exterior-0.25,sector*i/2); point_(sector*i/2) |
| 107 |
{ line thick stripthick from rvec_(del,3.5*del) to rvec_(-del,0) \ |
| 108 |
then to rvec_(del,-3.5*del) then to rvec_(del,3.5*del) \ |
| 109 |
shaded rgbstring(gold_) } |
| 110 |
circle rad stripwid-sthick at Here |
| 111 |
} |
| 112 |
smrad = 0.08 |
| 113 |
for i=0 to 7 do { |
| 114 |
point_(sector*2*i) |
| 115 |
move to C + vec_(midroserad+smrad/4,0) |
| 116 |
{ circle shaded rgbstring(gold_) rad smrad-sthick at Here} |
| 117 |
{ circle shaded rgbstring(gold_) rad smrad/2-sthick at Here} |
| 118 |
line from rvec_(smrad/2,0) to rvec_(smrad,0) |
| 119 |
} |
| 120 |
|
| 121 |
tmp = midroserad-stripwid |
| 122 |
circle shaded rgbstring(gold_) rad midroserad-sthick at C |
| 123 |
circle shaded rgbstring(gold_) rad tmp-sthick at C |
| 124 |
CQ: circle invis rad tmp-linethick*4/2 spt_ at C |
| 125 |
line from CQ.e to CQ.n to CQ.w to CQ.s to CQ.e to CQ.n |
| 126 |
CQ: 0.5<CQ.e,CQ.n> |
| 127 |
tmp = (distance(CQ,C) - linethick*3/2 spt_)*sqrt(2) |
| 128 |
box wid tmp ht tmp at C |
| 129 |
] with .sw at 1,1 |
| 130 |
|
| 131 |
] # Rose |
| 132 |
|
| 133 |
Halftone: [ |
| 134 |
#.PS |
| 135 |
# SpiralHalftoneDPV.m4 |
| 136 |
# https://tex.stackexchange.com/questions/584455/how-to-draw-this-spiral-made-of-circles-in-latex |
| 137 |
# gen_init |
| 138 |
|
| 139 |
r = 133/255; g = 196/255; b = 100/255 |
| 140 |
skale = 2/3*scale |
| 141 |
skale = 2.49/4.25 |
| 142 |
|
| 143 |
holerad = 1*skale |
| 144 |
outerrad = 4.25*skale |
| 145 |
{ circle thick 0.8 rad outerrad+2bp__ at Here outlined rgbstring(r,g,b) } |
| 146 |
|
| 147 |
define grcirc {circle diam $1 colored rgbstring(r,g,b)} |
| 148 |
|
| 149 |
npts = 200 |
| 150 |
outercdiam = (outerrad/npts)*twopi_ |
| 151 |
angoffset = -5*pi_/4 |
| 152 |
da = twopi_/npts*10/3 |
| 153 |
radc = outerrad |
| 154 |
for x = 0 to 1 do { |
| 155 |
cdiam = outercdiam*radc/outerrad |
| 156 |
for i=0 to npts-1 do { ang = i/npts*twopi_ |
| 157 |
grcirc(cdiam*abs(ang-pi_)/pi_) at rect_(radc,ang+angoffset) } |
| 158 |
angoffset += da |
| 159 |
radc -= cdiam*2/3 |
| 160 |
if radc < holerad then { x = 1 } else { x = 0 } |
| 161 |
} |
| 162 |
|
| 163 |
#.PE |
| 164 |
] with .sw at Rose.se+(0.2,0) |
| 165 |
|
| 166 |
') |
| 167 |
.PE |