| 1 |
.PS |
| 2 |
gen_init |
| 3 |
[ |
| 4 |
# TR_fill.m4 |
| 5 |
# https://tex.stackexchange.com/questions/654117/fill-parts-of-a-shape |
| 6 |
B: (0,0); "B" at B below |
| 7 |
C: (5,0); "C" at C below |
| 8 |
A: Cintersect(B,4,C,3); "A" at A above |
| 9 |
line from B to C then to A then to B |
| 10 |
RightAngle(B,A,C,0.25) |
| 11 |
|
| 12 |
rgbfill(0.5,0.5,0.5, |
| 13 |
arc from A to B rad 2 |
| 14 |
arc cw to C rad 2.5 |
| 15 |
arc to A rad 1.5 ) |
| 16 |
] |
| 17 |
[ |
| 18 |
# Fillbetween |
| 19 |
# https://tex.stackexchange.com/questions/688273/polar-curve-shading-error-with-fillbetween |
| 20 |
NeedDpicTools |
| 21 |
|
| 22 |
sc = 0.5 |
| 23 |
define coord {(($1,$2)*sc)} |
| 24 |
define X1 {coord(Rect_(6*sind($1),$1))} |
| 25 |
define X2 {coord(Rect_(2+2*sind($1),$1))} |
| 26 |
define interp {$1+($2-($1))*($3)} |
| 27 |
define axes { |
| 28 |
arrow from coord(-6,0) to coord(6,0) |
| 29 |
"$x$" rjust above |
| 30 |
for x=-5 to 5 do {line up_ 0.1 at coord(x,0)} |
| 31 |
"${-}5$" at coord(-5,-0.05/sc) below |
| 32 |
"${}5$" at coord(5,-0.05/sc) below |
| 33 |
arrow from coord(0,-2) to coord(0,7) |
| 34 |
"$y$" at Here+(8bp__,-10bp__) |
| 35 |
for y=-1 to 5 do {line right 0.1 at coord(0,y)} |
| 36 |
"${}5$" at coord(-0.05/sc,5) rjust |
| 37 |
} |
| 38 |
|
| 39 |
n = 36 |
| 40 |
for i=0 to n do { t = interp(30,150,i/n); C3[i]: X1(t) } |
| 41 |
for i=0 to n do { t = interp(150,150-360,i/n); C4[i]: X2(t) } |
| 42 |
for i=0 to n do { t = interp(150,210,i/n); C5[i]: X1(t) } |
| 43 |
rgbfill(0.9,0.9,0.9, |
| 44 |
fitcurve(C3,n) |
| 45 |
fitcurve(C4,n) |
| 46 |
fitcurve(C5,n) ) |
| 47 |
fitcurve(C3,n,outlined "orange" ) |
| 48 |
fitcurve(C4,n,outlined "red" ) |
| 49 |
fitcurve(C5,n,outlined "orange" ) |
| 50 |
|
| 51 |
axes |
| 52 |
] with .nw at last [].sw+(0,-0.2) |
| 53 |
|
| 54 |
.PE |