10

I am not very skilled with Tikz. I am trying to picture two kinds of vector fields on the sphere $S^2$ in $\mathbb{R}^3$ using the Tikzpicture package. One going from left to right ($X(x_1, x_2, x_3) := (-x_2, x_1, 0)$) and one from north to south ($Y(x_1, x_2, x_3) := (x_1x_3, x_2x_3, -x_1^2 - x_2^2)$).

Despite them being fairly simple (no shade, no dots, just a couple of arrows) my best effort looks ugly: I tried to draw the arrows manually.

\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}

enter image description here

Could anybody help me?

14

It is usually easier to draw 3D figures with Asymptote. Here's a solution:

\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}

You first need to translate the file with latex, then run asy on the generated .asy file and then again latex once or twice. The result looks like this: enter image description here

9

You can try this simple solution:

\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}

which gives the following picture:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.