TikZ:绘制 3 个相交的圆圈和阴影

TikZ:绘制 3 个相交的圆圈和阴影

如何才能有效地用该阴影范例(不一定是相同的颜色)绘制三个相交圆/椭圆?看来原始图像没有重叠的颜色,而我有。

  1. 有没有比我所做的更好的方法来构造圆形/椭圆形的绘图?
  2. 我怎样才能使其精确旋转,以便与
    x 轴射线的赤道和黄道平面对齐?
  3. 我怎样才能将原点处的圆圈从所有 s 中剪掉,filldraw以便蓝色球体不会被其中的背景颜色覆盖?
  4. 另外,我如何创建指向该点的曲线箭头?我知道我可以使用controls,但我的控制曲线看起来从未接近那个。

在此处输入图片描述

在添加轴时,我不得不调整黄道面的角度,以便赤道和黄道面在 x 轴处相交。然而,这不能精确,只能接近。

这就是我现在所得到的。剪辑真的很草率,但我找不到简洁地剪辑该区域的方法。

\documentclass[convert = false, tikz]{standalone}
\usepackage[utf8]{inputenc}
\renewcommand{\rmdefault}{ppl}
\linespread{1.05}
\usepackage[scaled]{helvet}
\usepackage{courier}
\usepackage{eulervm}
\normalfont
\usepackage[T1]{fontenc}
\usepackage{textcomp}

\usepackage{amsmath}
\usepackage{tikz-3dplot}
\usetikzlibrary{intersections}
\tikzset{
  partial ellipse/.style args = {#1:#2:#3}{
    insert path = {+ (#1:#2) arc (#1:#2:#3)}
  }
}
\begin{document}
\tdplotsetmaincoords{60}{130}
\begin{tikzpicture}[tdplot_main_coords,
  every lable/.append style = {font = \tiny},
  dot/.style = {outer sep = 0, inner sep = 0,
    shape = circle, label = {#1}},
  dot/.default =,
  small dot/.style = {minimum size = .1cm, dot = {#1}},
  small dot/.default =, 
  big dot/.style = {minimum size = .15cm, dot = {#1}},
  big dot/.default =
  ]
  \coordinate (O) at (0, 0);

  \def\rad{5cm}
  \def\moonangle{45}
  \def\sunangle{13.7}

  \draw[-latex] (O) -- (6.5, 0, 0) node[font = \scriptsize, pos = 1.1]
  {\(x(\gamma)\)};
  \draw[-latex] (O) -- (0, 6, 0) node[font = \scriptsize, pos = 1.05] {\(y\)};
  \draw[-latex] (O) -- (0, 0, 6.5) node[font = \scriptsize, above] {\(z\)};

  \draw (O) circle[radius = \rad];
  \draw[name path = arc] (90:\rad) arc[x radius = 3cm, y radius = \rad,
  start angle = 90, end angle = 270];
  \draw[name path = equa] (O) ellipse[x radius = \rad, y radius = 1.675cm];
  \draw[rotate = {\moonangle}, name path = moon] (O) ellipse[x radius = \rad,
  y radius = 2.25cm];
  \draw[rotate = {\sunangle}, name path = eclip] (O) ellipse[x radius = \rad,
  y radius = 1cm];

  \node[coordinate, name intersections = {of = moon and equa}] (P1) at
  ($(intersection-1)$) {};
  \node[coordinate, name intersections = {of = moon and equa}] (P2) at
  ($(intersection-4)$) {};
  \node[coordinate, name intersections = {of = moon and eclip}] (P3) at
  ($(intersection-4)$) {};
  \node[coordinate, name intersections = {of = equa and eclip}] (P4) at
  ($(intersection-4)$) {};

  \draw (P1) -- (P2);
  \draw (O) -- (P3);

  \begin{scope}
    \begin{pgfinterruptboundingbox}
      \clip (P1) -- ($(P1) + (3, -8)$) -- ($(P1) + (50, 20)$) --
      (P2) -- cycle;
    \end{pgfinterruptboundingbox}

    \filldraw[green, opacity = .3, rotate = {\moonangle}] (O)
    ellipse[x radius = \rad, y radius = 2.25cm];
    \filldraw[yellow, opacity = .3, rotate = {\sunangle}] (O)
    ellipse[x radius = \rad, y radius = 1cm];
    \filldraw[blue, opacity = .3] (O) ellipse[x radius = \rad,
    y radius = 1.675cm];
  \end{scope}

  \begin{scope}
    \begin{pgfinterruptboundingbox}
      \clip (P1) -- ($(P1) + (-20, -5)$) -- ($(P1) + (20, 40)$) -- (P2) --
      cycle;
    \end{pgfinterruptboundingbox}

    \filldraw[blue, opacity = .3] (O) ellipse[x radius = \rad,
    y radius = 1.675cm];
    \filldraw[yellow, opacity = .3, rotate = {\sunangle}] (O)
    ellipse[x radius = \rad, y radius = 1cm];
    \filldraw[green, opacity = .3, rotate = {\moonangle}] (O)
    ellipse[x radius = \rad, y radius = 2.25cm];
  \end{scope}

  \begin{scope}
    \begin{pgfinterruptboundingbox}
      \clip (O) -- (P4) -- +(1, 1) -- (P3) -- cycle;
    \end{pgfinterruptboundingbox}

    \filldraw[yellow, opacity = .3, rotate = {\sunangle}] (O)
    ellipse[x radius = \rad, y radius = 1cm];
  \end{scope}

  \filldraw[blue, opacity = .3] (O) circle[radius = .5cm];

  \draw (180:.5cm) arc[x radius = .5cm, y radius = .25cm, start angle = 180,
  end angle = 360];

  \path[name path = greenwhich] (O) -- (128.5212:\rad);
  \path[name path = moonrot] (O) -- (35:\rad);
  \path[name path = sun] (O) -- (9:\rad);
  \path[name intersections = {of = arc and greenwhich, by = P5}];
  \path[name intersections = {of = moon and moonrot, by = P6}];
  \path[name intersections = {of = sun and eclip, by = P7}];

  \draw[-latex, blue, shorten <= .3cm, shorten >= .05cm] (O) -- (P5);

  \node[fill = black, small dot = {right: }] at (P5) {};

  \draw[-latex, purple, shorten <= .3cm, shorten >= .05cm] (O) -- (P6);

  \node[fill = black, small dot = {right: }] at (P6) {};

  \draw[-latex, red, shorten <= .3cm, shorten >= .05cm] (O) -- (P7);

  \node[fill = orange, draw = orange, small dot = {right: }] at (P7) {};
  \node[coordinate, name intersections = {of = arc and equa}, fill = black,
  small dot = {left: }] (P8) at ($(intersection-2)$) {};

  \draw[-latex] (226:4.75cm and 1.55cm) arc[x radius = 4.75cm,
  y radius = 1.55cm, start angle = 226, end angle = 242];
  \draw[rotate = {\moonangle}, -latex] (332:4.75cm and 2cm)
  arc[x radius = 4.75cm, y radius = 2cm, start angle = 332, end angle = 348];
  \draw[rotate = {\sunangle}, -latex] (327:5.25cm and 1.25cm)
  arc[x radius = 5.25cm, y radius = 1.25cm, start angle = 327, end angle = 345];
\end{tikzpicture}
\end{document}

在此处输入图片描述


我们可以看到交叉口看起来不错,但除非我极其幸运,否则它并不精确。

在此处输入图片描述

答案1

制作复杂 3D 表示的另一种方法是使用文字图

TexGraph 是一种帮助以命令形式创建数学图形的软件,并且可以将其导出为各种格式的文本文件:LaTeX(eepic 宏)、pstricks 或 Pgf/Tikz(pgf 宏)、Eps 或 PSF(eps+pSfrag)或 pdf(eps 转换 -> pdf)或 svg ...还有专门导出到 3D 的功能。

相关内容