我想制作一个 tikzpicture 来说明螺旋电容器的构造。它们由螺旋卷绕薄膜制成。因此,想象一下一张矩形纸,你将其尾部围绕在一侧。它基本上就是这个样子。好吧,我可以使用圆柱坐标在 MATLAB 中对此进行编程,然后重新网格化为 cathesian,然后使用 pgfplots 进行绘图,但我认为一定有更简单的方法。当我想到 TikZ 的可能性时,我更多地考虑绘制一个矩形并围绕我之前指定的路径进行尾部绘制。但遗憾的是,我没有找到有关如何做到这一点的任何信息。
有人知道吗?
答案1
您可以为此使用 PGFPlots:
\documentclass[tikz,border=12pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{
colormap/outside/.style={
colormap=
{outside}{
rgb255(0cm)=(235,235,235);
rgb255(1cm)=(100,100,100);
}
},
colormap/outside,
colormap/inside/.style={
colormap={inside}{
rgb255(0cm)=(120,120,120);
rgb255(1cm)=(255,255,255);
}
},
colormap/inside
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
hide axis,
axis equal image,
z buffer=sort,
view={30}{40},
width=15cm
]
\addplot3 [
surf,
domain=0:3*360,
samples=100,
y domain=0:2000,
samples y=2,
line join=round,
mesh/interior colormap name=inside,
colormap/outside,
shader=faceted,
variable=\t,
point meta={cos(t)},
faceted color=black,
] ({cos(t)*1.1*t},{sin(t)*1.1*(t)},{y});
\end{axis}
\end{tikzpicture}
\end{document}
答案2
Asymptote
从螺旋曲线挤压出的曲面版本spiral.asy
:
size(300);
size3(300,300,300,IgnoreAspect);
import graph;
import solids;
currentprojection=orthographic(camera=(3640,2030,-0.8),up=(1.4,0.58,0.004),target=(0,0,0),zoom=0.618);
currentlight=light(gray(0.8),ambient=gray(0.1),specular=gray(0.7),
specularfactor=3,viewport=true,dir(42,48));
real a,b;
a=1;b=1;
pair spiral(real phi){
real r=a+b*phi;
return r*(Cos(phi),Sin(phi));
};
real phiMax=-90+3*360+20;
guide g=graph(spiral,0,phiMax,operator..);
pen bpen=rgb(0.75, 0.7, 0.1);
material m=material(diffusepen=0.7bpen
,ambientpen=bpen,emissivepen=0.3*bpen,specularpen=0.999white,shininess=1.0);
draw(extrude(g,(0,0,1)),m,render(merge=true));
答案3
运行xelatex
:
\documentclass{article}
\usepackage{pst-solides3d}
\begin{document}
\psframebox{%
\begin{pspicture}(-3,-4)(3,3)
\psset{lightsrc=viewpoint,viewpoint=10 -10 50 rtp2xyz,Decran=20}
\defFunction[algebraic]{G}(t)
{0.15*t*cos(3*t)}{0.15*t*sin(3*t)}{-2}
\psSolid[object=cylindre,incolor=blue!30,
range=-1 8,h=3,function=G,axe=0 0 1,ngrid=3 144]
\end{pspicture}}
%
\psframebox{%
\begin{pspicture}(-3,-2)(3,3)
\psset{lightsrc=15 5 10,viewpoint=10 -10 80 rtp2xyz,Decran=20}
\defFunction[algebraic]{G}(t)
{0.15*t*cos(3*t)}{0.15*t*sin(3*t)}{-2}
\psSolid[object=cylindre,incolor=blue!30,
range=-1 8,h=3,function=G,axe=0 0 1,ngrid=3 144]
\end{pspicture}}
\end{document}
将方程 G(t) (其中 x=f(t)、y=f(t) 和 z=f(t) 更改为您喜欢的任何值。