Is it possible to fill a Disk
from the bottom up without plotting circles? The way I've been doing it by plotting circles is too complicated for such a simple outcome. I am trying to fill Disk
s like the ones in this picture
3 Answers
Are you looking for something like this?:
Manipulate[Graphics[{{Black, Thickness[0.01], Circle[{0.5, 0.5}, 0.5]}, {Cyan,
DiskSegment[{0.5, 0.5}, 0.5, {(270 Degree - 180 Degree*a), (270 Degree + 180 Degree*a)}]}}, PlotRange -> {{0, 1.01}, {-0.01, 1}},
AspectRatio -> 1], {a, 0.01, 1., 1/180}]
Here's a short demo you can start with:
Manipulate[With[{t = segmentOffset[f]},
Graphics[{{Directive[Red, Thick], Circle[]},
{LightBlue, DiskSegment[{0, 0}, 1, {π + t, 2 π - t}]}},
PlotLabel -> Row[{"% filled: ", 50 (π - 2 t - Sin[2 t])/π}],
PlotRange -> 1]], {f, 0, 1, 1/20},
Initialization :> (segmentOffset[f_?NumericQ] /; 0 <= f <= 1 :=
With[{y = π (1 - 2 f)}, \[FormalX]/2 /.
FindRoot[y == \[FormalX] + Sin[\[FormalX]],
{\[FormalX],
y (1 - 125 y^2/2352)/
(2 + y^2 (47 y^2/47040 - 29/196))}]])]
I suggest the following minor graphics improvements to show the fill inside a thicker circular vessel:
Manipulate[
Graphics[{{Black, Thickness[0.02], Circle[{0.5, 0.5}, 0.512]},
{Cyan,DiskSegment[{0.5, 0.5},
0.5, {270 \[Degree] - 180 \[Degree] a,
270 \[Degree] + 180 \[Degree] a}]}},
PlotLabel -> Row[{"% Filled : ", 100 a}, Frame -> True],
PlotRange -> {{-0.05, 1.05}, {-0.05, 1.05}}, AspectRatio -> 1,
ImageSize -> 400], {a, 0.01, 1, 18/1800}, ImageMargins -> 10,
FrameMargins -> Large]
Note the blue fill does not encroach on the vessel inner wall.
DiskSegment
? $\endgroup$