双曲线及其圆弧

双曲线及其圆弧

我想制作下图: 在此处输入图片描述

我该怎么做?我发现绘制双曲线的圆弧很困难。

答案1

尽管您的图片表明情况并非如此,但我会假设“弓”实际上是一个半径恒定的弧。

暂时忽略dot和样式(它们都在我们稍后定义的坐标处放置一个点和一个标签,而后者还绘制到轴的虚线),可以使用基本几何、库和语法(即的包装器)非常简单地绘制一个常数半径的圆弧来找到半径的中心。dot*calcintersection ofintersection cs

我希望代码中的注释足够有帮助。

我还添加了一条贝塞尔曲线(?),其控制点与圆弧中心C'位于同一位置,但位于切线上C直辖市

M很早就发现了坐标($(A)!.5!(B)$)

代码

\documentclass[tikz,convert=false]{standalone}
\usetikzlibrary{calc}
\tikzset{
  every label/.append style={inner sep=+.1667em},
  dot/.style={
    label={[
        label distance=+0pt,
        shape=circle,
        fill=black,
        inner sep=+0pt,
        outer sep=+0pt,
        minimum size=+2pt,
        label={#1}
      ]center:}},
  dot*/.style={
    dot={#1},
    append after command={
      \pgfextra
        \pgfinterruptpath
          \let\myTikzlastnode\tikzlastnode
          \draw[thin,dashed] (0,0 |- \myTikzlastnode) node[left] {$P_{\myTikzlastnode}$} -| (0,0 -| \myTikzlastnode) node[below] {$Q_{\myTikzlastnode}$};
        \endpgfinterruptpath
      \endpgfextra
    }
  }
}
\begin{document}
\begin{tikzpicture}[thick]
\draw[<->] (0,6) node[left]  {$P$} |- node[below left] {$O$}
           (6,0) node[below] {$Q$};

\path (1,3)   coordinate[dot*=below left:$A$]       (A)
    ++(120:1) coordinate[dot =$D$] (D)
      (4,1)   coordinate[dot*=below left:$B$] (B);
;

\draw let
        % let's save D, A and B in other macros so that we can acess their x and y value separately
        \p1=(D),
        \p2=(A),
        \p3=(B),
        % then the middle between A and B is
        \p{M}=($(\p2)!.5!(\p3)$),
        % while the angles from D to A is
        \n{1-2}={atan2(\x2-\x1,\y2-\y1)},
        % a line orthogonal to the line between A and B has the angle of
        \n{ortho 2-3}={90+atan2(\x3-\x2,\y3-\y2)},
        % which means that the center of a circle through A and B that has the tangent DA lies at the intersection of
        \p{C}=(intersection of A--[shift=(90+\n{1-2}:10)]A and \p{M}--[shift={(\n{ortho 2-3}:10)}]\p{M}),
        % the radius is then simply (we can use either A or B to calculate the radius
        \n{radius}={veclen(\x{C}-\x3,\y{C}-\y3)},
        % the end angle at B is then also
        \n{end angle}={atan2(\x3-\x{C},\y3-\y{C})},
        %!
        %! for the Bézier curve:
        \p{C'}=(intersection of A--[shift=(\n{1-2}:10)]A and \p{M}--[shift={(\n{ortho 2-3}+180:10)}]\p{M})
      in % great, let's draw it, first the tangent
       (D) -- (A)
       % then the arc
       arc[radius=\n{radius}, start angle=\n{1-2}-90, end angle=\n{end angle}]
       % let's append another tangent at the end of the arc
       -- ++(\n{end angle}+90:1)
       % and while we're at we can also save the center of the arc in a coordiante M
%       (\p{C}) coordinate[dot=above:$C$] (C)               %?
       (\p{M}) coordinate[dot*=above right:$M$] (M)
       % let's draw the connection from A to B
       (A)--(B)
       %!
       %! for the Bézier curve
%       (\p{C'}) coordinate[dot=left:$C'$] (C') % for later %?
      ;
%\draw[thin,dotted] (A) -- (C) -- (B) -- (C') -- cycle;     %?
%\draw[thin,blue]   (A) .. controls (C') .. (B);            %?
\end{tikzpicture}
\end{document}

输出

在此处输入图片描述

该图与上图相同,但显示了半径的中心C、贝塞尔曲线及其控制点C'并且已经编译了标有%?未注释掉的行。

相关内容