이 호의 좌표를 조정하세요.

이 호의 좌표를 조정하세요.

나는 두 원으로부터 같은 거리를 갖는 점들을 호스팅할 쌍곡선을 만들고 싶습니다. 정확성에는 그다지 관심이 없지만 오히려 학생들에게 아이디어를 줄 수 있는 수치에 관심이 있습니다. 내 코드는 다음과 같습니다.

\documentclass{article}

\usepackage{amsmath}
\usepackage{tikz}

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}
    \draw (2,2) circle (1cm);
    \draw (5,0) .. controls (6,4) and (5,6) .. (3,6);
    \draw (10,2) circle (3cm);
\end{tikzpicture}
\caption{All points that are equidistant from both circles, lie on the hyperbola}
\end{figure}

\end{document}

도와주실 수 있나요?

여기에 이미지 설명을 입력하세요

답변1

다음 예에서는 이미지 영역(일부)을 아래에서 위로 한 줄씩 스캔하여엑스현재 지점과 원 사이의 거리 차이가 가장 작은 위치입니다. 점으로부터의 거리는 현재 점에서 원 중심까지의 거리에서 반경을 빼서 계산할 수 있습니다(이 경우 절대값을 취하면 현재 점이 원 안에 있습니다).

계산은 TikZ를 사용하여 수행할 수 있지만 TeX는 실수로 빠른 계산을 제공하지 않으므로 이 무차별 계산의 경우 계산 속도를 높이려면 다른 프로그래밍 언어가 더 좋습니다.

예를 들어 Perl 스크립트입니다. 매개변수는 스크립트 상단 영역에서 수정됩니다. 그리기 명령 에 적합한 점 목록을 출력합니다 plot.

#!/usr/bin/env perl
use strict;
use warnings;

my ($ax, $ay, $ar) = (2, 2, 1);
my ($bx, $by, $br) = (10, 2, 3);

my ($ymin, $ymax) = (-4, 8);
my ($xmin, $xmax) = ($ax, $bx);

my ($xstep, $ystep) = (.01, .01);

sub circledistance ($$$$$) {
    my ($radius, $mx, $my, $x, $y) = @_;
    my $xdiff = $mx - $x;
    my $ydiff = $my - $y;
    my $result = sqrt($xdiff * $xdiff + $ydiff * $ydiff) - $radius;
    $result = -$result if $result < 0;
    return $result;
}

sub round ($) {
    my $value = shift;
    return int($value + .5);
}

my $xcount = round(($xmax - $xmin)/$xstep);
my $ycount = round(($ymax - $ymin)/$ystep);

my @points;
for (my $yi = 0; $yi <= $ycount; $yi++) {
    my $diff = 1000000;
    my $point = '';
    my $y = $ymin + ($ymax - $ymin)*$yi/$ycount;
    for (my $xi = 0; $xi <= $xcount; $xi++) {
        my $x = $xmin + ($xmax - $xmin)*$xi/$xcount;
        my $a = circledistance($ar, $ax, $ay, $x, $y);
        my $b = circledistance($br, $bx, $by, $x, $y);
        my $d = $a - $b;
        $d = -$d if $d < 0;
        if ($d < $diff) {
            $diff = $d;
            $point = "($x,$y)";
        }
    }
    push @points, $point;
}

print "$_\n" foreach @points;

1;
__END__

그런 다음 TeX 코드는 다음과 같습니다.

\documentclass{article}

\usepackage{amsmath}
\usepackage{tikz}

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}
  \def\AX{2}
  \def\AY{2}
  \def\AR{1}
  \def\BX{10}
  \def\BY{2}
  \def\BR{3}
  \draw (\AX,\AY) circle (\AR cm);
  \draw (\BX,\BY) circle (\BR cm);
  \draw[red] plot[smooth] coordinates{
(4.16,-4)
(4.16,-3.99)
(4.16,-3.98)
(4.16,-3.97)
(4.16,-3.96)
(4.17,-3.95)
% ... <remaining lines of the output of the Perl script>
  };
\end{tikzpicture}
\caption{All points that are equidistant from both circles, lie on the
  hyperbola}
\end{figure}

\end{document}

결과

답변2

약간 깨지기 쉬우며(즉, 숫자가 크면 깨질 수 있음) 원 사이의 각도를 고려하지 않습니다(따라서 수평임). 그러나 대부분은 코사인 규칙을 재배치하는 것과 관련됩니다.

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{math}
\begin{document} 
\begin{tikzpicture}
\tikzmath{%
  integer \i, \j;
  \r = 2;
  \R = 6;
  \c = \r + 4 + \R;
  {
     \draw (0, 0) circle [radius=\r];
     \draw (\c, 0) circle [radius=\R];
  };
  for \i in {1,...,50}{
    \C = 180 - 100 + \i*4;
    \Z = (\c^2 - \r^2 - \R^2 + 2 * \r*\R) / (2 * (1 - cos(\C)));
    \q = (-(\r+\R) + sqrt((\r+\R)^2 - 4 * (\r*\R - \Z))) / 2;
    \a = \q + \r;
    \b = \q + \R;
    \B = asin(\b * sin(\C) / \c);  
    { \coordinate (n-\i) at (\B:\a); };
    if (\i > 1) then {
      \j = \i - 1;
      { \draw (n-\j) -- (n-\i); };
    };
  };
}
\end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

답변3

완벽한 포물선에 관심이 없다면 여기에 간단한 해결책이 있습니다. 컨트롤에 적합한 좌표와 포물선 곡선의 끝점을 선택하는 것이 중요합니다. 이 작업에서는 보조 그리드를 그리고 최종 실행에서 이를 제거하는 것이 유용할 수 있습니다.

\documentclass{article}
\usepackage{amsmath,tikz}
\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}[line width=.7pt, scale=.7]
    \draw (2,2)  circle (1cm);
    \draw (2,-3) .. controls (6,1) and (6,3) .. (2,7);
    \draw (10,2) circle (3cm);
\end{tikzpicture}
\caption{All points that are equidistant from both circles, lie on the hyperbola}
\end{figure}

\end{document}

여기에 이미지 설명을 입력하세요

답변4

쌍곡선을 계산하는 솔루션입니다. 그다지 어렵지는 않으며 OP가 그 방법을 알고 있다고 생각합니다. 원 사이의 반지름과 거리는 초기 예와 동일합니다. 수치는 정확하고 사용자 정의가 가능하지만,주의 사항dimension too large: 약간만 변경해도 오류가 발생하기 쉽습니다 .

아래(및 LaTeX 문서)에는 관련된 수학에 대한 약간의 설명을 추가하겠습니다.

코드

\documentclass{article}
\usepackage{mathtools} % for the maths part (no needed for the picture)
\usepackage{cancel}    % ditto
\usepackage{tikz}

\begin{document}
\begin{figure}[ht]\centering
\begin{tikzpicture}[scale=0.9]
% parameters
\def\ra{1} % radius, left circle 
\def\rb{3} % radius, right circle
\def\dc{8} % distance between centers
% maths (explained below)
\pgfmathsetmacro\xa{-0.5*(\dc+\ra-\rb)} % placing the circles at the 
\pgfmathsetmacro\xb{ 0.5*(\dc-\ra+\rb)} % same distance form the origin
\pgfmathsetmacro\p{(\xb-\xa)/(\ra-\rb)}
\pgfmathsetmacro\q{(\xa*\xa-\xb*\xb-(\ra-\rb)*(\ra-\rb))/(2*(\ra-\rb))}
\pgfmathsetmacro\k{\p*\q+\xb}
\tikzset{declare function={
   fx(\x)=2*\k*cos(\x)*cos(\x)/(1-\p*\p*cos(\x)*cos(\x));    % hyperbola, x=rho(theta)*cos(theta)
   fy(\x)=2*\k*sin(\x)*cos(\x)/(1-\p*\p*cos(\x)*cos(\x));    % hyperbola, y=rho(theta)*sin(theta)
   dd(\x)=sqrt((fx(\x)-\xa)*(fx(\x)-\xa)+fy(\x)*fy(\x))-\ra; % distance from the hyperbola to A (or B)
}}
% circles
\draw[thick] (\xa,0) coordinate (A) circle (\ra);
\draw[thick] (\xb,0) coordinate (B) circle (\rb);
% hyperbola
\def\d{7} % domain
\draw[red,very thick] plot[domain=90-\d:90+\d] ({fx(\x)},{fy(\x)});
% tangent circles (not in the original picture)
\clip (\xa-2*\ra,{1-fy(90-\d)}) rectangle (\xb+\rb,{-1-fy(90+\d)});
\foreach\i in {-\d,...,\d}
{
  \coordinate        (aux) at (({fx(90+\i))},{fy(90+\i))});
  \draw[gray]        (aux) circle ({dd(90+\i)}) \ifnum\i=\d node[black,above] {$P(x,y)$}\fi;
  \draw[gray,dashed] (A)  -- (aux) -- (B);
  \draw[fill=white]  (aux) circle (0.5mm);
}
\foreach\i in {A,B}
  \draw[fill=white] (\i) circle (0.5mm) node[below] {$\i$};
\end{tikzpicture}
\caption{All points that are equidistant from both circles lie on the hyperbola.}
\end{figure}

% Ignore this if you don't need to know about the maths
\section{The maths}
The circle centers are $A(x_a,0)$, $B(x_b,0)$, and let $P(x,y)$ be a generic point at the hyperbola. Then,
\begin{align*}
d(P,A) & = d(P,B);\\
\sqrt{(x-x_a)^2+y^2}-r_a & =\sqrt{(x-x_b)^2+y^2}-r_b;\\
(x-x_a)^2+\cancel{y^2}   & =(x-x_b)^2+\cancel{y^2}+(r_a-r_b)^2+\\
& \phantom{{}={}}+2(r_a-r_b)\sqrt{(x-x_b)^2+y^2};\\
2(x_b-x_a)x+x_a^2-x_b^2+(r_a-r_b)^2 & =2(r_a-r_b)\sqrt{(x-x_b)^2+y^2};\\
\underbrace{\frac{x_b-x_a}{r_a-r_b}}_p x+\underbrace{\frac{x_a^2-x_b^2+(r_a-r_b)^2}{2(r_a-r_b)}}_q & = \sqrt{(x-x_b)^2+y^2};\\
(px+q)^2 & =(x-x_b)^2+y^2;\\
p^2x^2+2pqx+\cancel{q^2} & = x^2+y^2-2x_bx+\cancel{x_b^2};\\
\intertext{If we take the origin equidistant form both circles, we can cancel the constant terms. Now we change to polar coordinates, $x=\rho\cos\theta$, $y=\rho\sin\theta$.}
p^2\rho^2\cos^2\theta+2pq\rho\cos\theta & =\rho^2-2x_b\rho\cos\theta;\\
p^2\rho\cos^2\theta+2pq\cos\theta & =\rho-2x_b\cos\theta;\\
\rho & =\frac{2\overbrace{(pq+x_b)}^k\cos\theta}{1-p^2\cos^2\theta}=\frac{2k\cos\theta}{1-p^2\cos^2\theta}.
\end{align*}
\end{document}

출력

여기에 이미지 설명을 입력하세요

그리고 수학

원 중심은 A(x_a,0), B(x_b,0)이고 P(x,y)를 쌍곡선의 일반적인 점으로 둡니다. 그 다음에,

여기에 이미지 설명을 입력하세요

두 원의 등거리 원점을 취하면 상수 항을 취소할 수 있습니다. 이제 극좌표로 변경합니다.

여기에 이미지 설명을 입력하세요

관련 정보