截面均勻的圓柱形鋼絲製成的方環

截面均勻的圓柱形鋼絲製成的方環

我正在嘗試繪製一個由粗圓柱形線製成的方形環,其橫截面均勻,位於地面上,如 中所示Square_Loop.png。在 3D 中將這樣的循環繪製為用沒有厚度的線條繪製的矩形框架,在 PSTricks 和/或 Ti 中似乎非常簡單kZ。我在這裡先向您的幫助表示感謝。

在此輸入影像描述

答案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}

在此輸入影像描述

相關內容