我想制作下面的代码图

我想制作下面的代码图
\begin{tikzpicture}
\draw (0,0) circle (2cm); % Soleil
\draw (6,0) circle (0.5cm); % Terre
\draw (8,0) circle (0.2cm); % Lune
\draw[dashed] (0,0) -- (6,0); % Distance Terre-Soleil
\draw[dashed] (6,0) -- (8,0); % Distance Terre-Lune
\node at (3,0.3) {$D$}; % Distance Terre-Soleil
\node at (7,0.3) {$d$}; % Distance Terre-Lune
\node at (-0.5,-2.5) {Soleil};
\node at (6,-1) {Terre};
\node at (8,-0.5) {Lune};
\draw[red] (8,0) arc (90:270:0.2cm); % Surface de la Lune exposée au Soleil
\node[red] at (8,-1) {$S_L$}; % Surface de la Lune exposée au Soleil
\draw[blue] (2,0) arc (90:270:2cm); % Surface de la sphère imaginaire
\node[blue] at (2,-3) {$S_S$}; % Surface de la sphère imaginaire
\end{tikzpicture}

答案1

我不完全清楚您想要实现什么,但我认为您遇到的问题是您认为 anarc使用给定的最后一个坐标作为其中心(就像 acircle一样),但事实上,最后一个坐标是弧实际开始的位置。

我认为你想要绘制的是类似下面的内容:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \coordinate (S) at (0,0);
    \coordinate (T) at (6,0);
    \coordinate (L) at (8,0);
    
    \draw (S) +(0,2) arc[start angle=90, end angle=-90, radius=2] % Soleil
        node[below] {Soleil};
    \draw (T) circle[radius=.5] % Terre
        +(0,-0.5) node[below] {Terre}; 
    \draw (L) +(0,.2) arc[start angle=90, end angle=-90, radius=.2] % Lune
        node[below] {Lune};
    
    \draw[dashed] (S) -- (T) % Distance Terre-Soleil
        node[midway, above] {$D$};
    \draw[dashed] (T) -- (L) % Distance Terre-Lune
        node[midway, above] {$d$};
    
    \draw[red] (L) +(0,.2) arc[start angle=90, end angle=270, radius=.2] % Surface de la Lune exposée au Soleil
        node[at start, above] {$S_L$};
    \draw[blue] (S) +(0,2) arc[start angle=90, end angle=270, radius=2] % Surface de la sphère imaginaire 
        node[at start, above] {$S_S$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容