乳胶中的插入圆柱体和圆锥形物体

乳胶中的插入圆柱体和圆锥形物体

我将如何在 Latex 中绘制下面的图形:

在此处输入图片描述

我可以通过绘制两个圆圈然后连接它们的线来绘制它,并使用 tikz 包中的 \node 插入文本,但这似乎是一种非常冗长的方法,我应该采用其他方法吗?此外,我想添加另一个圆锥形的图表,即与此图相同但形状为倒置圆锥。该图旨在显示给定形状中的流体量,其中密度较大的流体(黑色)位于密度较小的流体下方。

提前感谢您的建议。

答案1

我不确定我是否理解了你的问题的精髓,不过我会这样做。

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}

\begin{document}
\def\myuppercolor{yellow}
\begin{tikzpicture}[mycyl/.style={cylinder, shape border rotate=90, draw, minimum width=1cm, aspect=0.25, %
anchor=south, text width=1cm, text height=.1cm}, %
 ] 
    \node [mycyl , fill=blue, minimum height=1.6cm] (bl) at (0,0) {};
    \node [mycyl , minimum height=.3cm, fill = \myuppercolor] (yell) at (0,1) { };
    %--------------------------------------------------------- 
    % dashed "mixing lines"
    % note they are calculated manually (according to the aspect key of the cylinder shape)
    \foreach \y in {.6, .7, .8}{
        \draw[dashed, \myuppercolor] (.619,\y+.3) arc[x radius=.619cm, y radius=.154cm, start angle=0, end angle=-180];}
    %---------------------------------------------------------  
    %, descriptions 
    \node[above of=yell]{$A_0$};
    \node[right of=yell, xshift=.2cm]{$h$};
    \draw[<->, ] ([xshift = 1cm]yell.top) -- ([xshift = 1cm]yell.bottom);
        \draw[->,dashed ] ([xshift = 1cm]yell.bottom) -- ([xshift = 1cm]bl.center);
\end{tikzpicture}

\end{document}

请注意:我手动计算了命令的键arc。这很容易,因为它aspect会给出省略号的 y 和 x 高度的分数。对我来说,这是最经济的方法。

在此处输入图片描述

相关内容