I want to fill below of intersection of a plane and a cylinder of this picture, contain of arc AB and A'B' and below of polygon ABB'A' (fill form water). My code

\newcommand{\boundellipse}[3]% center, xdim, ydim
{(#1) ellipse (#2 and #3)
\coordinate (O) at (0,0);
\coordinate (O') at (\h,0);
\coordinate (A) at ($(190:{\x} and {\y})$);
\coordinate (B) at ($(335:{\x} and {\y})$);
\tkzDefPointBy[translation=from O to O'](A){A'}
 \tkzDefPointBy[translation=from O to O'](B)
 \tkzDrawPoints[fill = black,size = 5 pt](O,A,B,A',B',O')
\tkzLabelPoints[below right](B)
\tkzLabelPoints[above left](A')
\draw[thick] (B)--(B');
\draw[dashed] (A)--(A') (A')--(B')  (O)--(O') (O')--(A') (O')--(B');
\draw[thick] \boundellipse{0,0}{\x cm}{\y cm};
\draw [dashed] (\h cm,\y cm) arc (90:270:\x cm and \y cm);
\draw [thick] (\h cm,-\y cm) arc (-90:90:\x cm and \y cm);
\draw[thick] (0,\y cm)--(\h cm,\y cm);
\draw[thick] (0,-\y cm)--(\h cm,-\y cm);
\tkzFillPolygon[pattern color=blue, pattern=vertical lines](A,B,B',A')

enter image description here

How can I fill?


I would use tikz-3dplot for this. You can then use 3d coordinates and change the view etc.

%% smuggling from https://tex.stackexchange.com/a/470979/121799
    \expandafter\global\expandafter\let\csname smuggle@\arabic{smuggle}\endcsname#1%
    \aftergroup\let\aftergroup#1\expandafter\aftergroup\csname smuggle@\arabic{smuggle}\endcsname
% please do not use \x and \y since these are used in the calc syntax

%    \draw[-latex] (0,0,0) -- (1,0,0) node[pos=1.1]{$x$};
%    \draw[-latex] (0,0,0) -- (0,1,0) node[pos=1.1]{$y$};
%    \draw[-latex] (0,0,0) -- (0,0,1) node[pos=1.1]{$z$};
  \begin{scope}[canvas is xz plane at y=0]
   \draw[thick] (0,0) coordinate[label=above:$O$] (O) circle (\myy);
  \begin{scope}[canvas is xz plane at y=\h]
   \path (0,0) coordinate[label=above:$O'$] (O');   
   \draw[thick] let \p1=($(O')-(O)$),\n1={atan2(\y1,\x1)} in
    ($(O)+({90+\n1}:\myy)$) --
    ({90+\n1}:\myy) arc({90+\n1}:{-90+\n1}:\myy) --
    ($(O)+({-90+\n1}:\myy)$) ;
   \begin{scope}[on background layer,every label/.append style={black}]
     \draw[dashed] ({90+\myangle}:\myy) arc({90+\myangle}:{180+90+\myangle}:\myy); 
     % front
     \shade[top color=blue!30,bottom color=blue,shading angle=\myangle] 
      ($(O)+({-20}:\myy)$) -- ($(O')+({-20}:\myy)$) 
      arc(-20:-90+\myangle:\myy) --($(O)+({-90+\myangle}:\myy)$)
      % left
     \shade let \p1=($({-160}:\myy)-({-20}:\myy)$),\n1={180+atan2(\y1,\x1)} in
      [top color=blue!30,bottom color=blue,shading angle=\n1]
      ($(O)+({-20}:\myy)$) arc(-20:-160:\myy) -- cycle;
     \fill[blue!20]  ($(O')+({-20}:\myy)$) coordinate[label=right:$B'$](B') 
      -- ($(O')+({-160}:\myy)$) coordinate[label=above left:$A'$](A') 
      -- ($(O)+({-160}:\myy)$) coordinate[label=left:$A$](A) 
      -- ($(O)+({-20}:\myy)$) coordinate[label=right:$B$](B) 
      -- cycle;
  \draw[dashed] (O) -- (O') -- (B') -- (A')   (A) -- (A') -- (O');
  \draw (B) -- (A) -- (O) -- (B) -- (B');
  \foreach \X in {A,B,O}
  {\fill (\X) circle(1pt) (\X') circle(1pt);}

enter image description here


Cylindrical tank

\fill[gray!20,opacity=.5] ({.5*cos(270+\bet)},{sin(270+\bet)}) -- ({.5*cos(270-\alp)},{sin(270-\alp)}) arc ({270-\alp}:{270+\bet}:.5 and 1);
\fill[gray!15] ({.5*cos(270-\alp)},{sin(270-\alp)}) --             ({2+.5*cos(270-\alp)},{sin(270-\alp)}) 
 --  cycle;
    \fill[gray!20] (
) -- 
arc ({270+\bet}:270:.5 and 1) -- (0,-1) -- cycle;
\draw[gray] (0,0) ellipse (.5 and 1);
\draw[gray] (2,-1) arc (-90:90:.5 and 1);
\draw[gray!20] (2,-1) arc (-90:-270:.5 and 1);
\draw[gray] (0,1) -- (2,1);
\draw[gray] (0,-1) -- (2,-1);

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.