由横截面积均匀的圆柱形导线制成的方形环

由横截面积均匀的圆柱形导线制成的方形环

我正在尝试绘制一个由粗圆柱线制成的方形环,其横截面积均匀,放在地面上,如图所示Square_Loop.png。在 PSTricks 和/或 Ti 中,将这种环绘制为用无厚度线条绘制的矩形框,在 3D 中看起来相当简单Z。但是,增加横截面的维度变得非常困难。提前感谢帮助。

在此处输入图片描述

答案1

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d,angles,quotes}
\begin{document}
\tdplotsetmaincoords{70}{20}
\begin{tikzpicture}[tdplot_main_coords,thick]
 \draw[-stealth] (0,0,0) -- (6,0,0) node[below]{$x$};
 \draw[-stealth] (0,0,0) -- (0,-6,0) node[below right]{$y$};
 \draw[-stealth] (0,0,0) -- (0,0,4) node[left]{$z$};
 \begin{scope}[canvas is xy plane at z=0]
  \draw[rounded corners] (0,0) rectangle (2,-4);
  \draw[rounded corners] (0.2,-0.2) rectangle (1.8,-3.8);
  \node[fill,circle,inner sep=2pt,transform shape] (blob) at (1,-2){};
 \end{scope}
 \draw[dashed] (blob.center) -- (5,-2,0) coordinate(B) -- (5,-2,4) node[circle,draw,inner
 sep=1.5pt,solid,label=right:$A$](A){};
 \draw[-stealth] (blob.center) -- (A);
 \begin{scope}[canvas is xz plane at y=-2,transform shape]
  \pic[draw,angle radius=2cm,"$\alpha$",angle eccentricity=1.3] {angle=B--blob--A};
 \end{scope}
 \draw[semithick] (0,-4,0) -- (0,-4,1.5) (2,0,0) -- (2,0,1.5);
 \begin{scope}[canvas is yz plane at x=0,transform shape]
  \path (-4,1.2) -- (0,1.2) node[midway,above,transform shape=false]{$b$};
  \pgflowlevelsynccm
  \draw[stealth-stealth] (-4,1.2) -- (0,1.2);
 \end{scope} 
 \begin{scope}[canvas is xz plane at y=0,transform shape]
  \path (2,1.2) -- (0,1.2) node[midway,above,transform shape=false]{$a$};
  \pgflowlevelsynccm
  \draw[stealth-stealth] (2,1.2) -- (0,1.2);
 \end{scope} 
\end{tikzpicture}
\end{document}

在此处输入图片描述

至于 3D 效果,我失败了。这是我在合理时间内能想出的最好的效果。

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d,angles,quotes,calc}
\begin{document}
\tdplotsetmaincoords{70}{20}
\begin{tikzpicture}[tdplot_main_coords,thick]
 \draw[-stealth] (0,0,0) -- (6,0,0) node[below]{$x$};
 \draw[-stealth] (0,0,0) -- (0,-6,0) node[below right]{$y$};
 \draw[-stealth] (0,0,0) -- (0,0,4) node[left]{$z$};
 \begin{scope}[canvas is xy plane at z=0,transform shape]
  \draw[rounded corners] (0,0) rectangle (2,-4);
  \draw[rounded corners] (0.2,-0.2) rectangle (1.8,-3.8);
  \node[fill,circle,inner sep=2pt,transform shape] (blob) at (1,-2){};
  \begin{scope}
   \clip[rounded corners] (0,0) rectangle (2,-4) 
   (1.8,-3.8) -| (0.2,-0.2) -- (1.8,-0.2) -- cycle;
   \shade[top color=black!80,bottom color=black!70,middle color=gray!50,
   shading angle=-35] (0.3,0.2) rectangle (1.7,-0.3);
   \shade[top color=black!80,bottom color=black!70,middle color=gray!50,
   shading angle=-35] (0.3,-4.1) rectangle (1.7,-3.6);
   \shade[top color=black!80,bottom color=black!70,middle color=gray!50,
   shading angle=52] (-0.2,-0.3) rectangle (0.3,-3.7);
   \shade[top color=black!80,bottom color=black!70,middle color=gray!50,
   shading angle=52] (1.6,-0.3) rectangle (2.1,-3.7);
   \begin{scope}
    \clip (0,0) rectangle (0.3,-0.3);
    \shade[ball color=gray!70] (0.3,-0.3) circle[radius=0.3];
   \end{scope}
   \begin{scope}
    \clip (2,0) rectangle (1.7,-0.3);
    \shade[ball color=white] (1.7,-0.3) circle[radius=0.3];
   \end{scope}
   \begin{scope}
    \clip (0,-4) rectangle (0.3,-3.7);
    \shade[ball color=gray!30] (0.3,-3.7) circle[radius=0.3];
   \end{scope}
   \begin{scope}
    \clip (1.7,-4) rectangle (2,-3.7);
    \shade[ball color=white] (1.7,-3.7) circle[radius=0.3];
   \end{scope}
  \end{scope}
 \end{scope}
 \begin{scope}[tdplot_screen_coords]
 \end{scope}
 \draw[dashed] (blob.center) -- (5,-2,0) coordinate(B) -- (5,-2,4) node[circle,draw,inner
 sep=1.5pt,solid,label=right:$A$](A){};
 \draw[-stealth] (blob.center) -- (A);
 \begin{scope}[canvas is xz plane at y=-2,transform shape]
  \pic[draw,angle radius=2cm,"$\alpha$",angle eccentricity=1.3] {angle=B--blob--A};
 \end{scope}
 \draw[semithick] (0,-4,0) -- (0,-4,1.5) (2,0,0) -- (2,0,1.5);
 \begin{scope}[canvas is yz plane at x=0,transform shape]
  \path (-4,1.2) -- (0,1.2) node[midway,above,transform shape=false]{$b$};
  \pgflowlevelsynccm
  \draw[stealth-stealth] (-4,1.2) -- (0,1.2);
 \end{scope} 
 \begin{scope}[canvas is xz plane at y=0,transform shape]
  \path (2,1.2) -- (0,1.2) node[midway,above,transform shape=false]{$a$};
  \pgflowlevelsynccm
  \draw[stealth-stealth] (2,1.2) -- (0,1.2);
 \end{scope} 
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容