Hi, I would like to draw something like the image below using TikZ - a great circle passing through two points on a sphere.
-
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jul 12 '22 at 18:21
-
As our community bot already pointed out: Please tell us a bit more. Do you just want to re-drew the above picture using TikZ or do you need an exact diagram where you have two points given and need to draw a great circle through these? – Jasper Habicht Jul 12 '22 at 18:51
1 Answers
Welcome to TeX.SX! Surely, it depends on what you concretely want to achieve. In case you just want to recreate the above picture, you could re-use this previous answer of mine. Perhaps a little exaggerated, but also quite adaptable:
\documentclass[tikz,margin=5pt]{standalone}
\usepackage{tikz}
% Style to set camera angle, like PGFPlots view style
\tikzset{viewport/.style 2 args={
x={({cos(-#1)1cm},{sin(-#1)sin(#2)1cm})},
y={({-sin(-#1)1cm},{cos(-#1)sin(#2)1cm})},
z={(0,{cos(#2)*1cm})}
}}
% Convert from spherical to cartesian coordinates
\newcommand{\ToXYZ}[2]{
{sin(#1)cos(#2)}, % X coordinate
{cos(#1)cos(#2)}, % Y coordinate
{sin(#2)} % Z (vertical) coordinate
}
\begin{document}
\def\RotationX{-30}
\def\RotationY{-20}
\begin{tikzpicture}[scale=4]
\path[draw] (0,0) circle (1);
\begin{scope}[viewport={\RotationX}{\RotationY}]
\draw[variable=\t, smooth]
plot[domain=90-\RotationX:-90-\RotationX] (\ToXYZ{\t}{0});
\draw[densely dashed, variable=\t, smooth]
plot[domain=90-\RotationX:270-\RotationX] (\ToXYZ{\t}{0});
\draw[variable=\t, smooth, red]
plot[domain=90-\RotationY:-90-\RotationY, rotate around y=20] (\ToXYZ{0}{\t});
\draw[densely dashed, variable=\t, smooth, red]
plot[domain=90-\RotationY:270-\RotationY, rotate around y=20] (\ToXYZ{0}{\t});
\draw[variable=\t, smooth, red, very thick]
plot[domain=70:0, rotate around y=20] (\ToXYZ{0}{\t});
\node[circle, fill=red, inner sep=1pt, label={210:$B$}] at (\ToXYZ{0}{0}) {};
\node[circle, fill=red, inner sep=1pt, label={120:$A$}, rotate around y=20] at (\ToXYZ{0}{70}) {};
\end{scope}
\end{tikzpicture}
\end{document}
- 48,848

