我想绘制一个 Bloch 球体,该球体在某个 z 值处有平面(可以指定)。例如像这样:
我不需要阴影相似,只需要平面在 3D Blosh 球体中清晰即可。我目前有以下输出:
它是由以下 MWE 生成的:
\documentclass[tikz,11pt]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{arrows.meta,arrows,angles}
\usepackage{subfig}
\begin{document}
\begin{tikzpicture}[line cap=round, line join=round, >=Triangle]
\clip(-2.1,-2.1) rectangle (2.38,2.58);
\draw[ball color=gray!20!white, fill opacity=0.6] (0,0) circle (2cm);
\draw [rotate around={0.:(0.,0.)},dash pattern=on 3pt off 3pt] (0,0) ellipse (2cm and 0.9cm); \draw (0,0)-- (0.70,1.07);
\draw[-to,line width=0.7pt] (0,0) -- +(0,2); \draw[-to,line width=0.7pt] (0,0) -- +(-0.83,-0.81); \draw[-to,line width=0.7pt] (0,0) -- +(2,0);
\draw [-Latex, <-, >=stealth', shift={(0,0)}, black, fill opacity=1] (56.7:0.4) arc (56.7:90.:0.4);
\begin{scope}[rotate around x=10, y=10, xshift=1, yshift=-4.6]
\draw [-Latex, ->, >=stealth', shift={(0,0)}, black, fill opacity=1] (-135.7:0.4) arc (-135.7:-33.2:0.4);
\end{scope}
\draw [dotted] (0.7,1)-- (0.7,-0.46);
\draw [dotted] (0,0)-- (0.7,-0.46);
\draw [fill] (0,0) circle (1.5pt);
\draw [fill] (0.7,1.07) circle (0.5pt);
\end{tikzpicture}
\end{document}
答案1
这将在某些纬度处绘制平面,如果需要,可以将其更改为接受 z 值作为输入。视角 theta 可以随意更改。
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{65}{00}
\begin{tikzpicture}[declare function={R=2;}]
\begin{scope}[tdplot_main_coords,samples=101]
\fill[blue,opacity=0.8] plot[domain=0:360,variable=\t,smooth cycle]
(xyz spherical cs:radius=R,latitude=-10,longitude=\t);
\fill[red,opacity=0.8] plot[domain=0:360,variable=\t,smooth cycle]
(xyz spherical cs:radius=R,latitude=30,longitude=\t);
\end{scope}
\shade[ball color=red,opacity=0.4] (0,0) circle[radius=R];
\end{tikzpicture}
\end{document}
还可以指定z
。
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{75}{00}
\begin{tikzpicture}[declare function={R=2;angle(\z)=asin(\z/R);}]
\begin{scope}[tdplot_main_coords,samples=101]
\path[draw,fill=red] plot[domain=90:270,variable=\t,smooth]
(xyz spherical cs:radius=R,latitude={angle(0.5)},longitude=\t)
plot[domain=270:90,variable=\t,smooth]
(xyz spherical cs:radius=R,latitude={angle(0.5)+3*cos(\t)},longitude=\t);
\path[draw,opacity=0.8,inner color=red!40,outer color=red!80] plot[domain=0:360,variable=\t,smooth cycle]
(xyz spherical cs:radius=R,latitude={angle(0.5)},longitude=\t);
\end{scope}
\shade[ball color=red,opacity=0.4] (0,0) circle[radius=R];
\end{tikzpicture}
\end{document}
或者
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{75}{110}
\begin{tikzpicture}[
declare function={R=4;angle(\z)=asin(\z/R);myz=0.8;
myphi=50;mytheta=60;rr=4;},
>=stealth]
\begin{scope}[tdplot_main_coords,samples=101]
\path[draw,fill=red] plot[domain=90-\tdplotmainphi:270-\tdplotmainphi,variable=\t,smooth]
(xyz spherical cs:radius=R,latitude={angle(myz)},longitude=\t)
plot[domain=270-\tdplotmainphi:90-\tdplotmainphi,variable=\t,smooth]
(xyz spherical cs:radius=R,latitude={angle(myz)+3*cos(\t+\tdplotmainphi)},longitude=\t);
\path[draw,opacity=0.8,inner color=red!40,outer color=red!80]
plot[domain=0:360,variable=\t,smooth cycle]
(xyz spherical cs:radius=R,latitude={angle(myz)},longitude=\t);
\draw[->] (0,0,myz) -- ({R*cos(asin(myz/R))},0,myz);
\draw[->] (0,0,myz) -- (0,{R*cos(asin(myz/R))},myz);
\draw[->] (0,0,myz) -- (0,0,R);
\draw (0,0,myz) -- (xyz spherical cs:radius=rr,
latitude=mytheta,longitude=myphi) coordinate(P) node[circle,fill,inner
sep=1pt]{};
\draw[dotted] (P) --
({rr*sin(myphi)*cos(mytheta)},{rr*cos(myphi)*cos(mytheta)},{myz})
-- (0,0,myz);
\draw[->] plot[domain=90:{atan((rr*sin(mytheta)-myz)/(rr*cos(mytheta)))},
variable=\t,smooth] ([yshift=myz*1cm]xyz spherical cs:radius=1,latitude={\t},longitude=myphi);
\draw[->] plot[domain=90:myphi,
variable=\t,smooth] ({0.6*sin(\t)},{0.6*cos(\t)},myz);
\end{scope}
\shade[ball color=red,opacity=0.4] (0,0) circle[radius=R];
\end{tikzpicture}
\end{document}
或者
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{75}{110}
\begin{tikzpicture}[
declare function={R=4;angle(\z)=asin(\z/R);myz=0.8;
myphi=50;mytheta=60;rr=4;a=myz/(rr*sin(mytheta));},
>=stealth]
\begin{scope}[tdplot_main_coords,samples=101]
\draw[->] (0,0,0) -- ({R*cos(asin(myz/R))},0,0);
\draw[->] (0,0,0) -- (0,{R*cos(asin(myz/R))},0);
\draw[-] (0,0,0) -- (0,0,myz);
\draw (0,0,0) -- (xyz spherical cs:radius=rr*a,
latitude=mytheta,longitude=myphi) coordinate(P');
\path[draw,fill=red] plot[domain=90-\tdplotmainphi:270-\tdplotmainphi,variable=\t,smooth]
(xyz spherical cs:radius=R,latitude={angle(myz)},longitude=\t)
plot[domain=270-\tdplotmainphi:90-\tdplotmainphi,variable=\t,smooth]
(xyz spherical cs:radius=R,latitude={angle(myz)+3*cos(\t+\tdplotmainphi)},longitude=\t);
\path[draw,opacity=0.8,inner color=red!40,outer color=red!80]
plot[domain=0:360,variable=\t,smooth cycle]
(xyz spherical cs:radius=R,latitude={angle(myz)},longitude=\t);
\draw[->] (0,0,myz) -- (0,0,R);
\draw (P') -- (xyz spherical cs:radius=rr,
latitude=mytheta,longitude=myphi) coordinate(P) node[circle,fill,inner
sep=1pt]{};
\end{scope}
\shade[ball color=red,opacity=0.4] (0,0) circle[radius=R];
\end{tikzpicture}
\end{document}
不幸的是,我不知道 x 轴和 y 轴应该位于哪个平面。
请注意,还有blochsphere
专门用于 Bloch 球的包。