我对 Tikz 不是很熟练。我试图$\mathbb{R}^3$
使用 Tikzpicture 包在球体 $S^2$ 上描绘两种矢量场。一种从左到右($X(x_1, x_2, x_3) := (-x_2, x_1, 0)$)
,一种从北到南($Y(x_1, x_2, x_3) := (x_1x_3, x_2x_3, -x_1^2 - x_2^2)$)
。
尽管它们相当简单(没有阴影,没有点,只有几个箭头),但我的最佳努力看起来很丑陋:我试图手动绘制箭头。
\begin{tikzpicture}
\draw[fill=green!20] (0,0) circle (1.2cm);
\draw[thick,->] (0,1) -- (.1,.5);
\draw[thick,->] (.1,.25) -- (.1,-.25);
\draw[thick,->] (.1,-.5) -- (0,-1);
\draw[thick,->] (-.22,1.03) -- (-.65,.6);
\draw[thick,->] (-.7,.35) -- (-.8,-.15);
\draw[thick,->] (-.65,-.6) -- (-.22,-1.03);
\draw[thick,->] (.22,1.03) -- (.65,.6);
\draw[thick,->] (.7,.35) -- (.8,-.15);
\draw[thick,->] (.65,-.6) -- (.22,-1.03);
\end{tikzpicture}
有人能帮助我吗?
答案1
通常用以下方法绘制 3D 图形比较容易渐近线。这里有一个解决方案:
\documentclass{standalone}
\usepackage{asymptote}
\begin{document}
\begin{asy}[width=10cm,height=10cm]
import three;
// 1st field
triple X(triple p) {
return (-p.y, p.x, 0 );
}
// 2nd field
triple Y(triple p) {
return (p.x*p.z, p.y*p.z, -(p.x*p.x + p.y*p.y));
}
// unit sphere S2
material mat = material(diffusepen=gray(0.4),emissivepen=gray(0.6));
draw(unitsphere,mat);
// draw fields
int ni = 20;
int nj = 20;
real sc = 0.1;
for(int i=0; i<ni; ++i) {
for(int j=0; j<nj; ++j) {
real ph = (2*pi/ni)*i;
real th = (pi/nj)*j;
triple a = (cos(ph)*sin(th), sin(ph)*sin(th), cos(th));
triple xx = a + sc*X(a);
triple yy = a + sc*Y(a);
draw(a--xx,green,Arrow3);
draw(a--yy,red,Arrow3);
}
}
\end{asy}
\end{document}
首先需要使用 翻译文件latex
,然后asy
对生成的.asy
文件运行,然后再运行latex
一两次。结果如下所示:
答案2
您可以尝试这个简单的解决方案:
\documentclass[border=2mm,tikz]{standalone}
\usetikzlibrary{decorations.markings,arrows}
\begin{document}
\begin{tikzpicture}[decoration={markings,mark=at position .5 with {\arrow{latex'}}}]
\filldraw[ball color=white] (0,0) circle (1.2cm);
\foreach \rx in {-1,-.6,...,1}{
\draw[densely dashed,very thin,postaction={decorate}] (0,1.2) arc (90:-90:{\rx} and 1.2);
\draw[densely dashed,very thin,postaction={decorate}] (-1.2,0) arc (180:0:{1.2} and {\rx});}
\end{tikzpicture}
\end{document}
得到下面的图片: