Tikz:如何利用 LaTeX 的功能来找到椭圆的旋转角度?

Tikz:如何利用 LaTeX 的功能来找到椭圆的旋转角度?

我需要将第二个椭圆旋转某个角度。我猜测了一下,确定旋转角度约为88.5度。但是,我想确定确切的角度。

我目前拥有的代码是:

  \documentclass{article}
  \usepackage{tikz}
  \usetikzlibrary{intersections, calc}
  \begin{document}
  \begin{tikzpicture}[scale = 1.5,
    every label/.append style = {font = \small},
    dot/.style = {outer sep = +0pt, inner sep = +0pt,
      shape = circle, draw = black, label = {#1}},
    dot/.default =,
    small dot/.style = {minimum size = 2.5pt, dot = {#1}},
    small dot/.default =,
    big dot/.style = {minimum size = 5pt, dot = {#1}},
    big dot/.default =
    ]
    \pgfmathsetmacro{\e}{0.2768}
    \pgfmathsetmacro{\etilde}{0.6789}
    \pgfmathsetmacro{\rone}{1}
    \pgfmathsetmacro{\rtwo}{1.524}
    \pgfmathsetmacro{\deltanu}{107}
    \pgfmathsetmacro{\a}{1.36}
    \pgfmathsetmacro{\am}{1.1442}
    \pgfmathsetmacro{\b}{\a * sqrt(1 - \e^2)}
    \pgfmathsetmacro{\btilde}{\a * sqrt(1 - (\etilde)^2)}
    \pgfmathsetmacro{\c}{sqrt(\a^2 - \b^2)}
    \pgfmathsetmacro{\ctilde}{sqrt(\a^2 - (\btilde)^2)}
    \pgfmathsetmacro{\angle}{88.5}
    \draw[dashed] (-2 * \c, 0) -- (0, 0);
    \begin{scope}[rotate around = {\angle:(0, 0)}]
      \draw[dashed] (2 * \ctilde, 0) -- (0, 0);
    \end{scope}
    \node[scale = .75, fill = orange, big dot = {below: \(F\)}] (F)
    at (0, 0) {};
    \node[scale = .75, fill = white, big dot = {below: \(F^*\)}] (FS)
    at (-2 * \c cm, 0) {};
    \draw[red, thick, name path = r2] (0, 0) circle (1.523679cm);
    \draw[blue, thick, name path = r1] (0, 0) circle (1cm);
    \draw[name path = ecc2768] (-\c, 0) ellipse (\a cm and \b cm);
    \draw[name intersections = {of = ecc2768 and r1}] (F) -- (intersection-1)
    coordinate (P1) node[fill, big dot = {right: \(P_1\)}, minimum size = 3pt]
    {};
    \draw[name intersections = {of = ecc2768 and r2}] (F) -- (intersection-1)
    coordinate (P2) node[fill, big dot = {left: \(P_2\)}, minimum size = 3pt]
    {};
    \draw (P1) -- (P2) node[scale = .75, fill = white, shape = circle, pos = .5]
    {\(c\)};
    \draw let
      \p0 = (F),
      \p1 = (P1),
      \p2 = (P2),
      \n1 = {atan2(\x1 - \x0, \y1 - \y0)},
      \n2 = {atan2(\x2 - \x0, \y2 - \y0)},
      \n3 = {.35cm}
    in (F) +(\n1:\n3) arc [radius = \n3, start angle = \n1, end angle = \n2]
    node[scale = .45, pos = 0.5, above = 10pt] {\pgfmathparse{\n2 - \n1}%            
      $\pgfmathprintnumber{\pgfmathresult}^{\circ}$
    };
    \begin{scope}[rotate around = {\angle:(0, 0)}]
      \draw (\ctilde, 0) ellipse (\a cm and \btilde cm);
      \node[scale = .75, fill = white, big dot = {above: \(\tilde{F}^*\)}] (FST)
      at (2 * \ctilde cm, 0) {};
    \end{scope}
  \end{tikzpicture}
  \end{document}

在此处输入图片描述

从图中我们可以看出,猜测似乎不错,但它可能正确,也可能不正确。

是否存在一些内置函数可以让我们将椭圆的近侧旋转至交点 P2,将远侧旋转至 P1?

答案1

P3您可以通过找到未旋转的椭圆与半径为的圆之间的交点r1,然后计算角度来实现此目的P1-F-P3:这就是旋转椭圆所需的角度:

  \documentclass[border=5mm]{standalone}
  \usepackage{tikz}
  \usetikzlibrary{intersections, calc}
  \begin{document}
  \begin{tikzpicture}[scale = 1.5,
    every label/.append style = {font = \small},
    dot/.style = {outer sep = +0pt, inner sep = +0pt,
      shape = circle, draw = black, label = {#1}},
    dot/.default =,
    small dot/.style = {minimum size = 2.5pt, dot = {#1}},
    small dot/.default =,
    big dot/.style = {minimum size = 5pt, dot = {#1}},
    big dot/.default =
    ]
    \pgfmathsetmacro{\e}{0.2768}
    \pgfmathsetmacro{\etilde}{0.6789}
    \pgfmathsetmacro{\rone}{1}
    \pgfmathsetmacro{\rtwo}{1.524}
    \pgfmathsetmacro{\deltanu}{107}
    \pgfmathsetmacro{\a}{1.36}
    \pgfmathsetmacro{\am}{1.1442}
    \pgfmathsetmacro{\b}{\a * sqrt(1 - \e^2)}
    \pgfmathsetmacro{\btilde}{\a * sqrt(1 - (\etilde)^2)}
    \pgfmathsetmacro{\c}{sqrt(\a^2 - \b^2)}
    \pgfmathsetmacro{\ctilde}{sqrt(\a^2 - (\btilde)^2)}
    \pgfmathsetmacro{\angle}{88.5}
    \node[scale = .75, fill = orange, big dot = {below: \(F\)}] (F)
    at (0, 0) {};
    \draw[draw=none, thick, name path = r2] (0, 0) circle (1.523679cm);
    \draw[blue, thick, name path = r1] (0, 0) circle (1cm);
    \draw[name path = ecc2768] (-\c, 0) ellipse (\a cm and \b cm);
    \draw[name intersections = {of = ecc2768 and r1}] (F) -- (intersection-1)
    coordinate (P1) node[fill, big dot = {right: \(P_1\)}, minimum size = 3pt]
    {};
    \draw [name path = ecc6789unrotated, gray!50, thick] (\ctilde, 0) ellipse (\a cm and \btilde cm);
      \draw [name intersections={of=r1 and ecc6789unrotated}]
      (intersection-2) circle [radius=1.5pt] node [above] {$P_3$}
      let
        \p0=(F),
        \p1=(P1),
        \p2=(intersection-2),
        \n1={atan2(\x1-\x0,\y1-\y0)},
        \n2={atan2(\x2-\x0,\y2-\y0)},
        \n3={\n1-\n2}
      in
      \pgfextra{\xdef\myangle{\n3}}
        [rotate=\n3] (\ctilde, 0) ellipse (\a cm and \btilde cm);

      \node at (0,3) {The angle of rotation is: \pgfmathparse{\myangle} $\pgfmathprintnumber{\pgfmathresult}^\circ$};
  \end{tikzpicture}
  \end{document}

相关内容