绘制沿圆柱轴切开圆柱的平面

绘制沿圆柱轴切开圆柱的平面

我想画一个圆柱体,用一个平面沿圆柱体的垂直轴切开圆柱体。平面的宽度应足以切开圆柱体的整个部分。平面的高度也应高于圆柱体。我设法做到了这一点:

在此处输入图片描述

问题是我无法证明平面实际上比圆柱体更宽。如果我将宽度增加很多,则会发生以下情况:

在此处输入图片描述

所以根本无法理解这幅画想要表达什么。有没有什么方法可以做到美观呢?我不是在寻找这个特定的圆柱体或这个特定的平面,设计可以是任何你认为更好的。我只需要一个被平面切开的圆柱体,后者比前者更高更宽。

生成上述图片的代码如下:

\documentclass[border=2mm,12pt,tikz]{standalone}
\usepackage{tikz-3dplot} 
\usetikzlibrary{3d,calc,backgrounds,patterns}

\begin{document}
\def\R{3}
\def\w{10}
\def\hc{6}
\def\hp{9}
\tdplotsetmaincoords{80}{60}
\begin{tikzpicture}[tdplot_main_coords]

    \begin{scope}[canvas is xy plane at z=-\hc/2]
        \draw[dashed] (\tdplotmainphi:\R) arc(\tdplotmainphi:\tdplotmainphi+180:\R);
        \draw[thick] (\tdplotmainphi:\R) coordinate (BR) arc(\tdplotmainphi:\tdplotmainphi-180:\R)
        coordinate (BL);
    \end{scope}

    \begin{scope}[canvas is xy plane at z=-\hp/2]
        \draw[thick] (0:\w) coordinate (PS1) -- (180:\w) coordinate (PS2);
        \coordinate (A) at (0:\R);
        \coordinate (B) at (180:\R);
    \end{scope}

    \begin{scope}[canvas is xy plane at z=\hp/2]
        \draw[thick] (0:\w) coordinate (PI1) -- (180:\w) coordinate (PI2);
        \coordinate (A') at (0:\R);
        \coordinate (B') at (180:\R);
    \end{scope}

    \begin{scope}[canvas is xy plane at z=\hc/2]
        \draw[thick] (0,0) coordinate (O') circle[radius=\R];
        \path[pattern=north east lines] (PS1) -- (PS2) -- (PI2) -- (PI1) -- cycle;
        \draw (BR) -- (\tdplotmainphi:\R) (BL) -- (\tdplotmainphi-180:\R);
        \draw[thick] (PS1) -- (PI1);
        \draw[thick] (PS2) -- (PI2);
    \end{scope}

\end{tikzpicture}
\end{document} 

答案1

可以做的一件事是填充圆柱体并将其绘制成四个部分,并且必须先绘制平面后面的部分。顺便说一下,tikz-3dplot加载3dcalc库。

\documentclass[border=2mm,12pt,tikz]{standalone}
\usepackage{tikz-3dplot} 
\usetikzlibrary{patterns}

\begin{document}
\tdplotsetmaincoords{80}{60}
\begin{tikzpicture}[tdplot_main_coords,declare function={R=3;w=20;hc=6;hp=9;},
    fill opacity=0.7]
    \path[smooth,left color=gray,right color=gray,middle color=gray!50!black]
     plot[variable=\t,domain=\tdplotmainphi:180] 
     ({R*cos(\t)},{R*sin(\t)},-hc/2) -- 
     plot[variable=\t,domain=180:\tdplotmainphi] 
     ({R*cos(\t)},{R*sin(\t)},hc/2) -- cycle;
    % stretch on the right behind the plane
    \path[smooth,left color=gray,right color=gray!60]
     plot[variable=\t,domain=\tdplotmainphi:0] 
     ({R*cos(\t)},{R*sin(\t)},-hc/2) -- 
     plot[variable=\t,domain=0:\tdplotmainphi] 
     ({R*cos(\t)},{R*sin(\t)},hc/2) -- cycle;
    % plane 
    \path[pattern=north east lines] (-w/2,0,-hp/2) 
        -- (w/2,0,-hp/2) -- (w/2,0,hp/2) -- (-w/2,0,hp/2) -- cycle; 
    % cylinder part on the back in front of the plane   
    \path[smooth,left color=gray!50!black,right color=gray]
     plot[variable=\t,domain=180+\tdplotmainphi:180] 
     ({R*cos(\t)},{R*sin(\t)},-hc/2) -- 
     plot[variable=\t,domain=180:180+\tdplotmainphi] 
     ({R*cos(\t)},{R*sin(\t)},hc/2) -- cycle;
    % cylinder part on the front in front of the plane  
    \path[smooth,left color=gray,right color=gray,middle color=gray!20]
     plot[variable=\t,domain=180+\tdplotmainphi:360] 
     ({R*cos(\t)},{R*sin(\t)},-hc/2) -- 
     plot[variable=\t,domain=360:180+\tdplotmainphi] 
     ({R*cos(\t)},{R*sin(\t)},hc/2) -- cycle;
\end{tikzpicture}
\end{document} 

当然,人们可以改变视角和飞机的风格。

\documentclass[border=2mm,12pt,tikz]{standalone}
\usepackage{tikz-3dplot} 

\begin{document}
\tdplotsetmaincoords{70}{30}
\begin{tikzpicture}[tdplot_main_coords,declare function={R=3;w=12;hc=6;hp=9;},
    fill opacity=0.6]
    \path[smooth,left color=gray,right color=gray,middle color=gray!50!black]
     plot[variable=\t,domain=\tdplotmainphi:180] 
     ({R*cos(\t)},{R*sin(\t)},-hc/2) -- 
     plot[variable=\t,domain=180:\tdplotmainphi] 
     ({R*cos(\t)},{R*sin(\t)},hc/2) -- cycle;
    % stretch on the right behind the plane
    \path[smooth,left color=gray,right color=gray!60]
     plot[variable=\t,domain=\tdplotmainphi:0] 
     ({R*cos(\t)},{R*sin(\t)},-hc/2) -- 
     plot[variable=\t,domain=0:\tdplotmainphi] 
     ({R*cos(\t)},{R*sin(\t)},hc/2) -- cycle;
    % plane 
    \path[fill=blue!30] (-w/2,0,-hp/2) 
        -- (w/2,0,-hp/2) -- (w/2,0,hp/2) -- (-w/2,0,hp/2) -- cycle; 
    % cylinder part on the back in front of the plane   
    \path[smooth,left color=gray!50!black,right color=gray]
     plot[variable=\t,domain=180+\tdplotmainphi:180] 
     ({R*cos(\t)},{R*sin(\t)},-hc/2) -- 
     plot[variable=\t,domain=180:180+\tdplotmainphi] 
     ({R*cos(\t)},{R*sin(\t)},hc/2) -- cycle;
    % cylinder part on the front in front of the plane  
    \path[smooth,left color=gray,right color=gray,middle color=gray!20]
     plot[variable=\t,domain=180+\tdplotmainphi:360] 
     ({R*cos(\t)},{R*sin(\t)},-hc/2) -- 
     plot[variable=\t,domain=360:180+\tdplotmainphi] 
     ({R*cos(\t)},{R*sin(\t)},hc/2) -- cycle;
\end{tikzpicture}
\end{document} 

在此处输入图片描述

相关内容