2
$\begingroup$

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 Disks like the ones in this picture

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Without code, it is hard to comment. Have you seen DiskSegment? $\endgroup$ – Carl Woll Nov 6 '17 at 19:18
3
$\begingroup$

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}]

partially filled disk

$\endgroup$
3
$\begingroup$

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))}]])]

demo

$\endgroup$
1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.