我正在尝试以 3D 透视图创建电路的一部分,如下所示:
如何才能做到这一点?
电容器的主体现在已经在乳胶中创建,剩下的就是从阴影圆圈的两侧创建线。
答案1
以下内容可以帮助您入门。
编辑:您可以分别使用和键独立控制draw
和fill
元素的不透明度。请参阅draw opacity
fill opacity
Tikz:使用不透明度进行填充,但不改变绘制(线条)更多细节。
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings,arrows,patterns,shapes}
\tikzset{
->-/.style={decoration={
markings,
mark=at position .3 with {\arrow{triangle 90}}},postaction={decorate}},
}
\begin{document}
\begin{tikzpicture}
\def\Cplanesep{3} % <--- adjust the distance between the planes here
\def\Cwirelen{4} % <--- adjust the wire length here
\path[use as bounding box]
({3-\Cwirelen}, -3) rectangle ({3.2+\Cplanesep+\Cwirelen}, 3.5);
% necessary for cropping the picture
% because control points lie way out
% (dimensions adjusted manually...)
\newcommand\Cplane[1][0]
{%
\begin{scope}[xshift=#1 cm]
\filldraw[thick,draw=black,fill=gray,fill opacity=.3]
(2.5,-2.5) --
(2.5,1) --
(4,3) --
(4,-0.5) --
cycle;
\end{scope}
}
\node
[
draw,
thick,
ellipse,
minimum height = 1.5cm,
minimum width = 1cm,
decorate,
pattern = north east lines,
fill opacity = .7,
rotate = -20
] (hc) at (1.5,0) {};
\draw[thick,->-]
({3-\Cwirelen},0) -- ++(\Cwirelen,0)
node[pos=.3,anchor=north] {$I$};
\Cplane
\Cplane[\Cplanesep]
\draw[thick] ({3.2+\Cplanesep},0) -- ++(\Cwirelen,0) ;
\draw
(hc.north)
.. controls (6,10) and (5, -9) ..
(hc.south);
\end{tikzpicture}
\end{document}
答案2
此代码使用hobby
tikz 库来绘制信封:
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{decorations.markings, arrows,calc,patterns,shapes,hobby,backgrounds}
\tikzset{
single/.style={draw,
decoration={markings, mark=at position .5 with {\arrow{triangle 45}}},
postaction={decorate},
},
}
\begin{document}
\begin{tikzpicture}[font=\tiny]
\coordinate (a) at (0,0);
\coordinate (b) at (2,0);
\coordinate (c) at (2,2);
\coordinate (d) at (0,2);
%
\coordinate (a1) at (0.65,0.5);
\coordinate (b1) at (2.65,0.5);
\coordinate (c1) at (2.65,2.5);
\coordinate (d1) at (0.65,2.5);
%
\draw[thick,fill=gray!30] (d) -- coordinate(da) (a) -- (a1) -- (d1) -- cycle;
\draw[thick,fill=gray!30] (b) -- (b1) -- (c1) -- (c) -- cycle;
\draw[single] (-2,1) -- (da)node[midway,above] {I};
\draw(2.3,1) -- (4,1);
\node
[
draw,
%thick,
ellipse,
minimum height = 1cm,
minimum width = 0.5cm,
pattern = north east lines,
fill opacity = .5,
rotate = -10
] (el) at (-0.5,1) {};
\begin{scope}[on background layer]
\draw (el.north)
to[curve through={(-0.3,1.7) .. (0.5,2.6) .. (0.6,2.6) ..
(0.9,1) .. (0.75,0) ..
(0.1,-0.3)
}
]
(el.south);
\end{scope}
\end{tikzpicture}
\end{document}
答案3
使用 PSTricks。
\documentclass[pstricks,border=30pt,12pt]{standalone}
\usepackage{pstricks-add}
\def\plate{\pspolygon(-1,-2)(1,-1)(1,3)(-1,2)}
\begin{document}
\begin{pspicture}[fillstyle=solid,fillcolor=gray,arrowscale=2,opacity=.3](9,5)
\rput(3,2){\pcline[ArrowInside=->](-3,0)(0,0)\nbput{$I$}\plate}
\rput(6,2){\plate\psline[ArrowInside=->](3,0)}
\end{pspicture}
\end{document}