我正在尝试构建上面的这个球体。目前为止我所得到的是:
\documentclass[tikz, convert = false]{standalone}
\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/.estyle = {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/.estyle = {cm = {\cost, 0, 0, \cost*\sinEl, (0, \yshift)}}} %
}
\newcommand\DrawLongitudeCircle[2][2]{
\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][3]{
\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);
}
\newcommand\DrawLongitudeCirclered[2][4]{
\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, blue, thick] (150:1) arc (150:180:1);
% \draw[current plane,dashed] (-50:1) arc (-50:-35:1);
}%for drawing the grid
\newcommand\DLongredd[2][5]{
\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, black, dashed, ultra thick] (150:1) arc (150:180:1);
}
\newcommand\DLatred[2][6]{
\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, dashed, black, ultra thick] (-50:1) arc (-50:-35:1);
}
\newcommand\fillred[2][7]{
\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, blue, thin] (\angVis:1) arc (\angVis:\angVis + 180:1);
}
\newcommand\DrawLatitudeCirclered[2][8]{
\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,red,thick] (-\angVis-50:1) arc
(-\angVis-50:-\angVis-20:1);
\draw[current plane, blue, thick] (-50:1) arc (-50:-35:1);
}
\newcommand\fillred[2][9]{
\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, blue, thin] (\angVis:1) arc (\angVis:\angVis + 180:1);
}
\newcommand\DrawLatitudeCirclered[2][10]{
\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,red,thick] (-\angVis-50:1) arc
(-\angVis-50:-\angVis-20:1);
\draw[current plane, blue, thick] (-50:1) arc (-50:-35:1);
}
\begin{document}
\begin{tikzpicture}
\def\R{1.75} % sphere radius
\def\angEl{10} % elevation angle
\def\angPhi{-170} % longitude of point P
\def\angBeta{45} % latitude of point P
\filldraw[ball color = green!50, opacity = .4] (0, 0) circle (\R);
\foreach \t in {20, 0} { \DrawLatitudeCircle[\R]{\t} }
\foreach \t in {70} { \DrawLongitudeCircle[\R]{\t} }
\pgfmathsetmacro\H{\R * cos(\angEl)} % distance to north pole
\LongitudePlane[pzplane]{\angEl}{\angPhi}
\end{tikzpicture}
\end{document}
我需要帮助构建球体上的imax
和圆圈以及沿着这些圆圈的出发轨迹双曲线。imin