Tikz - 保角地图

Tikz - 保角地图

我该如何绘制这个:在此处输入图片描述

使用我的代码我做到了这一点:

\begin{figure}[!h]
\centering
\begin{tikzpicture}
\draw (-1,0) arc (180:360:1cm and 0.5cm);
\draw[dashed] (-1,0) arc (180:0:1cm and 0.5cm);
\draw (0,1) arc (90:270:0.5cm and 1cm);
\draw[dashed] (0,1) arc (90:-90:0.5cm and 1cm);
\draw (0,0) circle (1cm);
\shade[ball color=blue!10!white,opacity=0.20] (0,0) circle (1cm);


\draw (2,0) arc (180:360:2cm and 0.5cm);
\draw (2,0) arc (180:0:2cm and 0.5cm);
\draw (2,-3) arc (180:370:2cm and 0.5cm);
\draw[dashed] (2,-3) arc (180:10:2cm and 0.5cm);
\draw(2,-2.9)  -- (2,0);
\draw(6,-2.9)  -- (6,0);
\draw[dashed]  (4,-4.5) to (4,1);
\shade[left color=blue!5!white,right color=black!60!white,opacity=0.3] (2,0) arc (180:360:2cm and 0.5cm) -- (6,-3) arc (360:180:2cm and 0.5cm) -- cycle;

\shade[left color=blue!5!white,right color=black!60!white,opacity=0.7] (4,-3) circle (2cm and 0.5cm);

\draw  node[midway, below ] { $S^2$} (1.5,-2.5);



\end{tikzpicture}
\caption{The topological structure of anti-de Sitter.}
\end{figure}

答案1

一种可能性。对于球体,我借用并修改了 Tomasz M. Trzeciak 的一些代码this exampleTeXample.net

在此处输入图片描述

代码:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,fadings,decorations.pathreplacing,patterns,bending}

\newcommand\pgfmathsinandcos[3]{%
  \pgfmathsetmacro#1{sin(#3)}%
  \pgfmathsetmacro#2{cos(#3)}%
}
\newcommand\LongitudePlane[3][current plane]{%
  \pgfmathsinandcos\sinEl\cosEl{#2} % elevation
  \pgfmathsinandcos\sint\cost{#3} % azimuth
  \tikzset{#1/.style={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
}
\newcommand\LatitudePlane[3][current plane]{%
  \pgfmathsinandcos\sinEl\cosEl{#2} % elevation
  \pgfmathsinandcos\sint\cost{#3} % latitude
  \pgfmathsetmacro\yshift{\cosEl*\sint}
  \tikzset{#1/.style={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} %
}
\newcommand\DrawLongitudeCircle[2][1]{
  \LongitudePlane{\angEl}{#2}
  \tikzset{current plane/.prefix style={scale=#1}}
   % angle of "visibility"
  \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
  \draw[current plane] (\angVis:1) arc (\angVis:\angVis+180:1);
  \draw[current plane,dashed] (\angVis-180:1) arc (\angVis-180:\angVis:1);
}
\newcommand\DrawLatitudeCircle[2][1]{
  \LatitudePlane{\angEl}{#2}
  \tikzset{current plane/.prefix style={scale=#1}}
  \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)}
  % angle of "visibility"
  \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))}
  \draw[current plane] (\angVis:1) arc (\angVis:-\angVis-180:1);
  \draw[current plane,dashed] (180-\angVis:1) arc (180-\angVis:\angVis:1);
}

\tikzset{%
  >=latex, % option for nice arrows
  inner sep=0pt,%
  outer sep=2pt,%
  mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt,
    fill=black,circle}%
}

\begin{document}

\begin{tikzpicture}

\def\R{2.5} % sphere radius
\def\angEl{35} % elevation angle

%The sphere
\filldraw[ball color=white] (0,0) circle (\R);
\foreach \t in {10,14,...,86} 
  {\DrawLatitudeCircle[\R,gray]{\t}}
\DrawLatitudeCircle[\R,black]{10}

\pgfmathsetmacro\H{\R*cos(\angEl)}
\pgfmathsetmacro\L{\R*sin(\angEl)}

\coordinate[mark coordinate] (N) at (0,\H);
\coordinate[mark coordinate] (E) at (\L,0.5*\H);
\coordinate[mark coordinate] (Eq) at (\L,-0.55*\L);

% The cylinder
\begin{scope}[xshift=5cm]
\filldraw[draw=black,fill=gray!20]
 (0,5) arc[x radius=2, y radius=0.4, start angle=180, end angle=0]
 (4,5) arc[x radius=2, y radius=0.4, start angle=0, end angle=-180];
\filldraw[ball color=white]
  (0,5) -- 
  (0,-2.5) 
  arc[x radius=2, y radius=0.4, start angle=-180, end angle=0] --
   (4,5)
  arc[x radius=2, y radius=0.4, start angle=0, end angle=-180];
\fill[pattern=north east lines,pattern color=gray!60] 
  (0,-2.5) 
  arc[x radius=2, y radius=0.4, start angle=-180, end angle=0] coordinate[mark coordinate,near start] (BoC)
  arc[x radius=2, y radius=0.4, start angle=0, end angle=180];
\draw[dashed] 
  (0,-2.5) arc[x radius=2, y radius=0.4, start angle=180, end angle=0];
\draw[dashed] 
  (2,-3.5) -- (2,6);
\draw[->]
  (1.6,5) arc[start angle=140,end angle=415,x radius=0.5cm,y radius=0.13cm] 
  node[above right] {$\Omega_{p}$};
\draw[->]
  (5,0) -- ++(0,2cm) node[above] {$\tau$};

\coordinate[mark coordinate] (AC) at (2,1);
\coordinate[mark coordinate] (BC) at (1,-2.5);
\end{scope}

% arrows and labels
\node
  (t0)
  at ([yshift=1.5cm] $ (N)!0.5!(AC) $ )
  {$\theta=0$};
\draw[->]
  (t0) -- (N);
\draw[->]
  (t0) -- (AC);
\draw[<->]
  (E) to[bend left] (BC);
\node[below=20pt] 
  at (0,-\H) {$S^{2}$};
\node
  (tp2)
  at ([yshift=-1.5cm] $ (Eq)!0.5!(BoC) $ )
  {$\theta=\pi/2$};
\draw[->]
  (tp2) -- (Eq);
\draw[->]
  (tp2) -- (BoC);
\end{tikzpicture}

\end{document}

相关内容