TikZ:通过两点绘制椭圆

TikZ:通过两点绘制椭圆

我正在尝试构造连接点P1P2F但除了焦点之一之外,我对椭圆一无所知。我只知道椭圆弧连接两个点。我尝试使用\draw let ...。我只知道椭圆弧连接两个点。我尝试使用然后指定起始和终止角度,但我不知道 x 半径和 y 半径是多少,也不知道椭圆的方向。关于如何构建它有什么想法吗?我有一个类似的问题,由于限制性更强,所以从未得到明确的答案。该帖子可以在这里找到椭圆与圆相交但我只是在那儿即兴发挥。

  \documentclass{article}
  \usepackage{tikz, intersections}
  \begin{document}
  \begin{tikzpicture}[
    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 = 2pt, dot = {#1}},
    small dot/.default =,
    big dot/.style = {minimum size = 4pt, dot = {#1}},
    big dot/.default =,
    line join = round, line cap = round, >=triangle 45
    ]

    \node[scale = .75, fill = black, big dot = {below: \(F\)}] (F)
    at (0, 0) {};
    \node[scale = .75, fill = black, big dot = {below: \(P_1\)}] (P1)
    at (2, 0) {};
    \node[scale = .75, fill = black, big dot = {above, right = .25cm: \(P2\)}]
    (P2) at (-2, 2) {};
    \draw[-latex] (F) -- (P1) node[scale = .75, fill = white, inner sep = 0cm,
    shape = circle, pos = .5] {\(\mathbf{r}_1\)};
    \draw[-latex] (F) -- (P2) node[scale = .75, fill = white, inner sep = 0cm,
    shape = circle, pos = .5] {\(\mathbf{r}_2\)};
    \draw (-1, 0) -- (F);
    \draw let
      \p0 = (F),
      \p1 = (P1),
      \p2 = (P2),
      \n1 = {atan2(\x1 - \x0, \y1 - \y0)},
      \n2 = {atan2(\x2 - \x0, \y2 - \y0)},
      \n3 = {.4cm}
    in (F) +(\n1:\n3) arc [radius = \n3, start angle = \n1, end angle = \n2]
    node[scale = .75, pos = .5, above = .4cm] {\(\Delta\nu\)};
    \draw (P1) -- (P2) node[scale = .75, fill = white, inner sep = 0cm,
    shape = circle, pos = .5] {\(c\)};
  \end{tikzpicture}
  \end{document}

在此处输入图片描述

答案1

好吧,正如杰克所说,你有一个定义不明确的问题,所以最好的方法是手动放置弧线并完成它。因为要实现自动化,你提供更多信息。一种可能性是直接制作四分之一圆弧

  \documentclass[tikz]{standalone}
  \usetikzlibrary{arrows,calc}

  \begin{document}

  \begin{tikzpicture}[
    dot/.style = {outer sep = +0pt, inner sep = +0pt, shape = circle, draw = black, label = {#1}},
    small dot/.style = {minimum size = 1pt, dot = {#1}},
    big dot/.style = {minimum size = 2pt, dot = {#1}},
    line join = round, line cap = round, >=triangle 45
    ]
    \node[ fill = black, big dot = {below: \(F\)}] (F) at (0, 0) {};
    \node[ fill = black, big dot = {below: \(P_1\)}] (P1)  at (2, 0) {};
    \node[ fill = black, big dot = {above right=.25cm:\(P_2\)}] (P2) at (-2, 2) {};

    \draw let
      \p0 = ($(P2)-(F)$),
      \p1 = ($(P1)-(P2)$)
    in  (P2|-P1) ++(\x1,0) arc (0:270:\x1 and \y0);

  \end{tikzpicture}
  \end{document}

在此处输入图片描述

一个可能的视觉解决方案是添加

  \documentclass[tikz]{standalone}
  \usetikzlibrary{arrows,calc}

  \begin{document}

  \begin{tikzpicture}[
    dot/.style = {outer sep = +0pt, inner sep = +0pt, shape = circle, draw = black, label = {#1}},
    small dot/.style = {minimum size = 1pt, dot = {#1}},
    big dot/.style = {minimum size = 2pt, dot = {#1}},
    line join = round, line cap = round, >=triangle 45
    ]
    \node[ fill = black, big dot = {below: \(F\)}] (F) at (0, 0) {};
    \node[ fill = black, big dot = {below: \(P_1\)}] (P1)  at (2, 0) {};
    \node[ fill = black, big dot = {above right=.25cm:\(P_2\)}] (P2) at (-2, 2) {};    

    \begin{scope}[decoration={%
        markings,%
        mark=at position .5 with {\arrow[line width=0.4pt]{triangle 45}}%
        },
    ]
    \pgfpathmoveto{\pgfpointanchor{P1}{center}}
    \pgfpatharcto{2.55cm}{4cm}{0}{0}{1}{\pgfpointanchor{P2}{center}}
    \pgfgetpath\temppath
    \pgfusepath{draw}
    \pgfsetpath\temppath
    \pgfdecoratecurrentpath{markings}
    \end{scope}

  \end{tikzpicture}
  \end{document}

在此处输入图片描述

相关内容