答案1
更新:删除了 calc 库并添加了动画。
\documentclass[tikz,border=4pt]{standalone}
\usetikzlibrary{intersections}
\makeatletter % from https://tex.stackexchange.com/a/20864/121799
\newcommand{\tikzAngleOfLine}{\tikz@AngleOfLine}
\def\tikz@AngleOfLine(#1)(#2)#3{
\pgfmathanglebetweenpoints{
\pgfpointanchor{#1}{center}}{
\pgfpointanchor{#2}{center}}
\pgfmathsetmacro{#3}{\pgfmathresult}
}
\makeatother
\begin{document}
\begin{tikzpicture}[scale=5,font=\sffamily]
\draw[-latex] (0,-0.2) -- (0,2.2);
\draw[-latex] (-0.1,0) -- (2.4,0);
\coordinate[label=45:{$O$}] (O) at (0,0);
\coordinate[label=45:{$M$}] (M) at (1.1,1);
\coordinate[label=45:{$T$}] (T) at (M|-O);
\draw[name path=circle] (M) circle (1);
\draw[name path=cycloid,green!50!black] (O) plot[variable=\x,domain=0:5*pi/6] ({\x-sin(\x*180/pi)}
,{1-cos(\x*180/pi)});
\path [name intersections={of=cycloid and circle,by={P,Q}}];
\coordinate[label=45:{$R$}] (R) at (P-|M);
\tikzAngleOfLine(M)(R){\AngleStart}
\tikzAngleOfLine(M)(P){\AngleEnd}
\filldraw[red,fill opacity=0.3] (M) -- (M)+(\AngleStart:4pt)
arc (\AngleStart:\AngleEnd:4pt) node[pos=0.3,above,opacity=1]{$t$} -- (M) --cycle;
\filldraw[green,fill opacity=0.3] (R) -- ++(-4pt,0) arc (180:90:4pt) -- (R) -- cycle;
\draw[name path=line] (T) -- (M) -- (P) node[above,midway,sloped]{$r$} -- (R);
\node[label=above:{$P$}] at (P){};
\foreach \X in {O,T,M,P,R}
{\draw[fill=blue] (\X) circle (0.4pt);}
\end{tikzpicture}
\end{document}
\documentclass{article}
\usepackage{animate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[active,tightpage]{preview}
\makeatletter
\def\@anim@@newframe{\@ifstar\@anim@newframe\@anim@newframe}
\def\@anim@newframe{\end{preview}\begin{preview}}
\renewenvironment{animateinline}[2][]{%
\let\newframe\@anim@@newframe%
\let\multiframe\@anim@multiframe%
\begin{preview}}{%
\end{preview}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tikz}
\usetikzlibrary{intersections}
\makeatletter % from https://tex.stackexchange.com/a/20864/121799
\newcommand{\tikzAngleOfLine}{\tikz@AngleOfLine}
\def\tikz@AngleOfLine(#1)(#2)#3{
\pgfmathanglebetweenpoints{
\pgfpointanchor{#1}{center}}{
\pgfpointanchor{#2}{center}}
\pgfmathsetmacro{#3}{\pgfmathresult}
}
\makeatother
\begin{document}
\begin{animateinline}[autoplay,loop]{2}
\multiframe{62}{i=1+1}{\pgfmathsetmacro{\X}{\i/10}
\begin{tikzpicture}[scale=2,font=\sffamily]
\draw[-latex] (0,-0.2) -- (0,2.2);
\draw[-latex] (-1,0) -- (7.2,0);
\path[use as bounding box] (-1,-0.4) rectangle (7.4,2.5);
\coordinate[label=45:{$O$}] (O) at (0,0);
\coordinate[label=45:{$M$}] (M) at (\X,1);
\coordinate[label=45:{$T$}] (T) at (M|-O);
\draw[name path=circle] (M) circle (1);
\draw[name path=cycloid,green!50!black] (O) plot[variable=\x,domain=0:0.01+\X] ({\x-sin(\x*180/pi)}
,{1-cos(\x*180/pi)});
% \Disc discriminates between the cases of one and two intersections
\pgfmathtruncatemacro{\Disc}{ifthenelse(\i>31,1,0)}
\ifnum\Disc=0
\path [name intersections={of=cycloid and circle,by={P}}];
\else
\path [name intersections={of=cycloid and circle,by={Q,P}}];
\fi
\coordinate[label=45:{$R$}] (R) at (P-|M);
\tikzAngleOfLine(M)(R){\AngleStart}
\tikzAngleOfLine(M)(P){\AngleEnd}
\filldraw[red,fill opacity=0.3] (M) -- (M)+(\AngleStart:4pt)
arc (\AngleStart:\AngleEnd:4pt) node[pos=0.3,above,opacity=1]{$t$} -- (M) --cycle;
\tikzAngleOfLine(R)(P){\AngleStart}
\tikzAngleOfLine(R)(M){\AngleEnd}
\ifnum\Disc=0
\filldraw[green,fill opacity=0.3] (R) -- ++(-4pt,0) arc (180:\AngleEnd:4pt) -- (R) -- cycle;
\else
\filldraw[green,fill opacity=0.3] (R) -- ++(4pt,0) arc (0:\AngleEnd:4pt) -- (R) -- cycle;
\fi
\draw[name path=line] (T) -- (M) -- (P) node[above,midway,sloped]{$r$} -- (R)
--cycle;
\node[label=above:{$P$}] at (P){};
\foreach \X in {O,T,M,P,R}
{\draw[fill=blue] (\X) circle (1pt);}
\end{tikzpicture}}
\end{animateinline}
\end{document}
使用这个技巧可以创建动画 gif。
答案2
\documentclass[dvipsnames,tikz,margin=5mm]{standalone}
\usepackage{luatex85}
\usetikzlibrary{%
calc,
backgrounds,
quotes,
angles,
}
% 3 couches de dessin
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
\tikzset{% Angle droit
angle droit/.style={very thin},
angle droit size/.store in=\AngleDtLgth,
angle droit size=5pt,
pics/.cd,
angle droit/.style args={#1-#2-#3}{%
code = {%
\draw[angle droit] ($(#2)!\AngleDtLgth!(#1)$)
--($(#2)!2!($($(#2)!\AngleDtLgth!(#1)$)!.5!($(#2)!\AngleDtLgth!(#3)$)$) $)
--($(#2)!\AngleDtLgth!(#3)$) ; ;
}
}}
\begin{document}
\foreach \x [count=\n from 0] in {0,5,...,360} {%
\begin{tikzpicture}
\draw[-stealth] (-1.1,0) -- (7.5,0) ;
\draw[-stealth] (0,-.5)--(0,2.5) ;
\coordinate (O) at (0,0) ;
\begin{scope}[shift={(\x/180*3.14159,1)}]
\draw[blue, semithick] circle (1) ;
\coordinate (A\n) at (-\x-90:1) ;
\draw[thin] (0,0) coordinate (M) -- (A\n) ;
\draw[red,smooth] (A0) \foreach \p in {0,...,\n} {--(A\p)} ;
\draw[thin,-stealth] (0,-1) coordinate (A)
-- (0,1.5) coordinate (B) ;
\draw[thin,dashed] (A\n) -- ($(A)!(A\n)!(B)$) coordinate (R);
\begin{pgfonlayer}{background}
\draw pic[%
"\tiny\x",
draw=green,
fill=green!15,
angle eccentricity=2,
angle radius=.2cm
] {angle=A\n--M--A} ;
\end{pgfonlayer}
\pgfmathsetmacro{\Rangle}{ifthenelse(\x<180,"0","180")}
\foreach \Coor/\Text/\Pos in
{O/$O$/225,
M/$M$/0,
A/$T$/-45,
A\n/$P$/225-\x,
R/$R$/\Rangle%
} {%
\draw[fill=blue] (\Coor) circle (1pt);
\node[shift=(\Pos:6pt),anchor=center] at (\Coor) {\tiny\Text} ;
}
\path pic[angle droit size=4pt] {angle droit=A\n-R-M} ;
\fill[red] (A\n) circle (1pt) ;
\end{scope}
\end{tikzpicture}}
\end{document}