不切实际的动画

不切实际的动画

4我有两个半径分别为和的蓝色圆5,以及它们之间用紫色绘制的线段,使得它们的端点垂直于它们的半径。为了给人留下这种描绘代表传送带的印象,我将添加两个arc用紫色绘制的命令,并将圆的半径从5cm和减小4cm5cm-0.2pt4cm-0.2pt。为什么绘制圆的命令2pt小于5cm未被执行?这是被误解的命令。

\draw[blue] (center_of_first_circle) circle ({5cm - 0.2pt});

在我的代码中,我使用以下命令来渲染我想要修改的图表。

\draw[blue] (center_of_first_circle) circle (5);

这是我的代码。

\documentclass[10pt]{amsart}
\usepackage{mathtools,array}


\usepackage{tikz}
\usetikzlibrary{calc,positioning,intersections}




\begin{document}

\begin{tikzpicture}[x=0.25cm, y=0.25cm]

%The centers of a circle of radius 4 and a circle of radius 5 are at a distance of 16 from each other. Two line segments
%are to be drawn between them so that they are tangent to the circles. (It is a sketch of a conveyor belt.) The radii to
%the point of tangency of the same line segment are parallel to each other. The centers of the circles are located on the
%x-axis - the center of the circle of radius 5 is centered at the origin, and the center of the circle of radius 4 is
%centered at (16,0). If \theta is the measure of the angle between the x-axis and the two radii, the slope of
%the line segment is sin\theta/(16 - cos\theta). So, the slope of the radii is (cos\theta - 16)/sin\theta. The slope is
%also tan\theta.
%x = 5cos\theta.
%x^2 + ((cos\theta - 16)/sin\theta)^2*x^2 = 5^2.
%tan\theta=(cos\theta - 16)/sin\theta.
%This is a quartic equation in the variable x. The solution is 5*sqrt(65/2 - 4*sqrt(66)). The point of tangency on the circle
%of radius 5 is
%(5*sqrt(65/2 - 4*sqrt(66)), 5*sqrt(4*sqrt(66) - 63/2)).
%
%
\path (0,0) coordinate (center_of_first_circle) (16,0) coordinate (center_of_second_circle);
%
%
%
\path let \n1={5*sqrt(65/2 - 4*sqrt(66))}, \n2={5*sqrt(4*sqrt(66) - 63/2)} in coordinate (a_point_of_tangency_on_bigger_circle) at (\n1,\n2);
\path let \n1={5*sqrt(65/2 - 4*sqrt(66))}, \n2={5*sqrt(4*sqrt(66) - 63/2)} in coordinate (another_point_of_tangency_on_bigger_circle) at (\n1,-\n2);
%
\path let \n1={2*sqrt(66)}, \n2={sqrt(64*sqrt(66)-504)} in coordinate (a_point_of_tangency_on_smaller_circle) at (\n1,\n2);
\path let \n1={2*sqrt(66)}, \n2={sqrt(64*sqrt(66)-504)} in coordinate (another_point_of_tangency_on_smaller_circle) at (\n1,-\n2);
%
%
\draw (a_point_of_tangency_on_bigger_circle) -- (a_point_of_tangency_on_smaller_circle);
\draw (another_point_of_tangency_on_bigger_circle) -- (another_point_of_tangency_on_smaller_circle);
%
%
%
\draw[blue] (center_of_first_circle) circle (5);
\draw[blue]  (center_of_second_circle) circle (4);


\end{tikzpicture}

\end{document}

答案1

您的命令不起作用的原因解释:

您的变换 ( x=.25cm,y=.25cm) 会将其消除。变换对具有单位的数字无效,因此5cm-2pt仍然是5cm-2pt,它不会被缩放。

为了防止这种情况发生,您需要5cm-2pt自行缩放。在下面的代码中,我使用了1.25cm-2pt一个类似的数字来表示较小的圆圈。


如果我理解你的问题,你可以通过以下方式实现tkz-euclide

\documentclass[tikz]{standalone}
\usepackage{mathtools,array}
\usetikzlibrary{calc,positioning,intersections}
\usepackage{tkz-euclide}
\usetkzobj{all} 
\begin{document}
\begin{tikzpicture}[x=0.25cm, y=0.25cm]
%The centers of a circle of radius 4 and a circle of radius 5 are at a distance of 16 from each other. Two line segments
%are to be drawn between them so that they are tangent to the circles. (It is a sketch of a conveyor belt.) The radii to
%the point of tangency of the same line segment are parallel to each other. The centers of the circles are located on the
%x-axis - the center of the circle of radius 5 is centered at the origin, and the center of the circle of radius 4 is
%centered at (16,0). If \theta is the measure of the angle between the x-axis and the two radii, the slope of
%the line segment is sin\theta/(16 - cos\theta). So, the slope of the radii is (cos\theta - 16)/sin\theta. The slope is
%also tan\theta.
%x = 5cos\theta.
%x^2 + ((cos\theta - 16)/sin\theta)^2*x^2 = 5^2.
%tan\theta=(cos\theta - 16)/sin\theta.
%This is a quartic equation in the variable x. The solution is 5*sqrt(65/2 - 4*sqrt(66)). The point of tangency on the circle
%of radius 5 is
%(5*sqrt(65/2 - 4*sqrt(66)), 5*sqrt(4*sqrt(66) - 63/2)).
%
%
\path (0,0) coordinate (center_of_first_circle) (16,0) coordinate (center_of_second_circle);
%
\path let \n1={5*sqrt(65/2 - 4*sqrt(66))}, \n2={5*sqrt(4*sqrt(66) - 63/2)} in coordinate (a_point_of_tangency_on_bigger_circle) at (\n1,\n2);
\path let \n1={5*sqrt(65/2 - 4*sqrt(66))}, \n2={5*sqrt(4*sqrt(66) - 63/2)} in coordinate (another_point_of_tangency_on_bigger_circle) at (\n1,-\n2);
%
\path let \n1={2*sqrt(66)}, \n2={sqrt(64*sqrt(66)-504)} in coordinate (a_point_of_tangency_on_smaller_circle) at (\n1,\n2);
\path let \n1={2*sqrt(66)}, \n2={sqrt(64*sqrt(66)-504)} in coordinate (another_point_of_tangency_on_smaller_circle) at (\n1,-\n2);
%
\draw[violet] (a_point_of_tangency_on_bigger_circle) -- (a_point_of_tangency_on_smaller_circle);
\draw[violet] (another_point_of_tangency_on_bigger_circle) -- (another_point_of_tangency_on_smaller_circle);
%
\draw[blue] (center_of_first_circle) circle (1.25cm-2pt);
\draw[blue]  (center_of_second_circle) circle (1cm-2pt);

\tkzDrawArc[color=violet](center_of_first_circle,a_point_of_tangency_on_bigger_circle)(another_point_of_tangency_on_bigger_circle)
\tkzDrawArc[color=violet](center_of_second_circle,another_point_of_tangency_on_smaller_circle)(a_point_of_tangency_on_smaller_circle)
\end{tikzpicture}
\end{document}

在此处输入图片描述

顺便说一句,你永远不应该用这么长的名字来命名你的坐标......输入名字花费了我相当多的时间:)

答案2

PSTricks 解决方案仅用于娱乐目的!

在此处输入图片描述

\documentclass[pstricks]{standalone}
\usepackage{pstricks-add}
\begin{document}
\pspicture[linewidth=1.2pt](15,8)
    \pnodes{P}(4,4)(11,4)
    \psCircleTangents(P0){3.2}(P1){2.7}
    \psset{linecolor=magenta}
    \psarc[origin=P0](P0){3.2}{(CircleTO2)}{(CircleTO4)}
    \psarc[origin=P1](P1){2.7}{(CircleTO3)}{(CircleTO1)}
    \psline(CircleTO2)(CircleTO1)
    \psline(CircleTO4)(CircleTO3)
    \psset{linecolor=blue}  
    \pscircle(P0){3}
    \pscircle(P1){2.5}
\endpspicture
\end{document}

不切实际的动画

在此处输入图片描述

\documentclass[pstricks]{standalone}
\usepackage{pstricks-add}
\begin{document}
\multido{\r=0.1+0.1}{29}{
\pspicture[linewidth=1.2pt](15,8)
    \pnodes{P}(4,4)(11,4)
    \psCircleTangents(P0){3.2}(P1){\pscalculate{\r+0.2}}
    \psset{linecolor=magenta}
    \psarc[origin=P0](P0){3.2}{(CircleTO2)}{(CircleTO4)}
    \psarc[origin=P1](P1){!\r\space 0.2 add}{(CircleTO3)}{(CircleTO1)}
    \psline(CircleTO2)(CircleTO1)
    \psline(CircleTO4)(CircleTO3)
    \psset{linecolor=blue}  
    \pscircle(P0){3}
    \pscircle(P1){\r}
\endpspicture}
\end{document}

答案3

风格来自这个答案. 早期的 TI仅能找到 Z 解决方案这里

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}

\begin{tikzpicture}[tangent of circles/.style args={%
at #1 and #2 with radii #3 and #4}{insert path={%
let \p1=($(#2)-(#1)$),\n1={atan2(\y1,\x1)},\n2={veclen(\y1,\x1)*1pt/1cm},
    \n3={atan2(#4-#3,\n2)}
     in ($(#1)+(\n3+\n1+90:#3)$) -- ($(#2)+(\n3+\n1+90:#4)$)}}]
 \pgfmathsetmacro{\offscale}{1.04}
 %
 \draw[blue] (0,0) coordinate (c1)  circle[radius=1.25cm]
   (4,0) coordinate (c2)  circle[radius=1cm];
 \draw[red,tangent of circles={at c1 and c2 with radii \offscale*1.25 and \offscale*1}]
 coordinate[pos=0] (tl) coordinate[pos=1] (tr)
 [tangent of circles={at c2 and c1 with radii \offscale*1 and \offscale*1.25}]
 coordinate[pos=0] (br) coordinate[pos=1] (bl);
 \draw[red] let \p1=($(tl)-(c1)$),\p2=($(bl)-(c1)$),\n1={atan2(\y1,\x1)},\n2={atan2(\y2,\x2)}
 in (tl) arc(\n1:\n2+360:\offscale*1.25);
 \draw[red] let \p1=($(tr)-(c2)$),\p2=($(br)-(c2)$),\n1={atan2(\y1,\x1)},\n2={atan2(\y2,\x2)}
 in (tr) arc(\n1:\n2:\offscale*1);
\end{tikzpicture}
\end{document}

在此处输入图片描述

动画片:

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{calc}
\tikzset{tangent of circles/.style args={%
at #1 and #2 with radii #3 and #4}{insert path={%
let \p1=($(#2)-(#1)$),\n1={atan2(\y1,\x1)},\n2={veclen(\y1,\x1)*1pt/1cm},
    \n3={atan2(#4-#3,\n2)}
     in ($(#1)+(\n3+\n1+90:#3)$) -- ($(#2)+(\n3+\n1+90:#4)$)}}}
\begin{document}
\foreach \X in {1.25,1.2,...,0.25,0.3,0.35,...,1.2}
{\begin{tikzpicture}
 \pgfmathsetmacro{\rOne}{1.25}
 \pgfmathsetmacro{\rTwo}{\X}
 \pgfmathsetmacro{\rPlus}{0.05}
 %
 \path[use as bounding box] (-1.5,-1.5) rectangle (5.5,1.5);
 \draw[blue] (0,0) coordinate (c1)  circle[radius=\rOne*1cm]
   (4,0) coordinate (c2)  circle[radius=\rTwo*1cm];
 \draw[red,tangent of circles={at c1 and c2 with radii {\rOne+\rPlus} and {\rTwo+\rPlus}}]
 coordinate[pos=0] (tl) coordinate[pos=1] (tr)
 [tangent of circles={at c2 and c1 with radii {\rTwo+\rPlus} and {\rOne+\rPlus}}]
 coordinate[pos=0] (br) coordinate[pos=1] (bl);
 \draw[red] let \p1=($(tl)-(c1)$),\p2=($(bl)-(c1)$),\n1={atan2(\y1,\x1)},\n2={atan2(\y2,\x2)}
 in (tl) arc(\n1:\n2+360:\rOne+\rPlus);
 \draw[red] let \p1=($(tr)-(c2)$),\p2=($(br)-(c2)$),\n1={atan2(\y1,\x1)},\n2={atan2(\y2,\x2)}
 in (tr) arc(\n1:\n2:\rTwo+\rPlus);
\end{tikzpicture}}
\end{document}

在此处输入图片描述

相关内容