LaTeX中圆周运动与简谐运动的关系

LaTeX中圆周运动与简谐运动的关系

前言:我完全不熟练,我向大家道歉,但这个问题是给我的学生的。我还没有找到动画.gif:我完全不熟练,我向大家道歉,但这个问题是针对我的学生的。我在网上简谐运动用唱片机。

我不知道如何创建动画挂钩(粉色箭头)通过旋转在面板上(棕色右箭头)形成阴影(小向下箭头),其中速度是最大值,速度在点处+ 一个(或在-A) 零。

在此处输入图片描述

答案1

你似乎有一些很老的学生,他们知道这些唱片机是什么样子的。

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{shadings}
\begin{document}
\tdplotsetmaincoords{70}{30}
\foreach \Angle in {180,185,...,360}
{\begin{tikzpicture}[tdplot_main_coords,line cap=round,line join=round,
    pics/cyl/.style={code={
        \draw[left color=orange,right color=orange!20] (\tdplotmainphi:0.2) arc[start angle=\tdplotmainphi,
            end angle=\tdplotmainphi-180,radius=0.2] 
            -- ($(\tdplotmainphi-180:0.2)+(0,0,1)$)
            arc[start angle=\tdplotmainphi-180,
            end angle=\tdplotmainphi,radius=0.2] -- cycle;
        \draw[fill=orange] (0,0,1) circle[radius=0.2];  
    }},pics/projected cyl/.style={code={
    \draw[gray,fill=gray!20] (-0.2,0) rectangle (0.2,1);
    }}]
 \begin{scope}[canvas is xz plane at y=5.5]
  \fill[gray] (-6,0) rectangle (6,-2);
  \fill[gray!10] (-6,0) rectangle (6,2);
  \path ({4*cos(\Angle)},0) pic[transform shape]{projected cyl};
 \end{scope}
 \begin{scope}[canvas is xy plane at z=0]
  \shade[upper left=black,upper right=gray!30,
    lower left=gray!50,lower right=black,even odd rule] circle[radius=5]
    circle[radius=2];
    \draw foreach \r in {2.1,2.2,...,4.9} {circle[radius=\r]};
    \fill[blue!50!gray] (0,0) circle[radius=2];
 \end{scope}
 \path (\Angle:4) pic{cyl};
\end{tikzpicture}}
\end{document}

在此处输入图片描述

PS:一开始我不明白“细节”是什么意思,但在盯着屏幕截图足够长的时间后,我也能看到一只鸭子(尽管我仍然不确定它是否真的在那里)。

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\usepackage{tikzducks}
\usetikzlibrary{arrows.meta,bending,shadings}
\begin{document}
\tdplotsetmaincoords{70}{30}
\foreach \Angle in {5,15,...,355}
{\begin{tikzpicture}[tdplot_main_coords,line cap=round,line join=round,
    pics/cyl/.style={code={
        \draw[left color=orange,right color=orange!80,middle color=orange!10] 
        (\tdplotmainphi:0.2) arc[start angle=\tdplotmainphi,
            end angle=\tdplotmainphi-180,radius=0.2] 
            -- ($(\tdplotmainphi-180:0.2)+(0,0,1)$)
            arc[start angle=\tdplotmainphi-180,
            end angle=\tdplotmainphi,radius=0.2] -- cycle;
        \draw[fill=orange] (0,0,1) circle[radius=0.2];  
    }},pics/projected cyl/.style={code={
    \draw[gray,fill=gray!20] (-0.2,0) rectangle (0.2,1);
    }}]
 \begin{scope}[canvas is xz plane at y=5.5]
  \fill[gray] (-6,0) rectangle (6,-2);
  \fill[gray!10] (-6,0) rectangle (6,2);
  \draw[thick,-Stealth] (-6,3) -- (6,3);
  \draw[transform shape] (-4,2.8) -- ++ (0,0.4) node[above]{$x=-A$}
   (0,2.8) -- ++ (0,0.4) node[above]{$x=0$}
   (4,2.8) -- ++ (0,0.4) node[above]{$x=A$};
  \path ({4*cos(\Angle)},0) pic[transform shape]{projected cyl};
 \end{scope}
 \begin{scope}[canvas is xy plane at z=0]
  \shade[upper left=black,upper right=gray!30,
    lower left=gray!50,lower right=black,even odd rule] circle[radius=5]
    circle[radius=2];
  \draw foreach \r in {2.1,2.2,...,4.9} {circle[radius=\r]};
  \fill[blue!50!gray] (0,0) circle[radius=2];
  \path[nodes={transform shape,anchor=base,font={\large\sffamily},text=white}] 
   foreach \Char [count=\Z,
    evaluate=\Z as \myangle using {\tdplotmainphi+\Angle+\Z*8+(\Z==1?-4:0)}] 
    in {M,o,z,a,r,t}
    {(\myangle:1.5) node[rotate=\myangle+90]{\Char}};
  \duck[rotate=\Angle,xshift=-1cm,yshift=-1cm]  
  \pgflowlevelsynccm
  \draw[very thick,blue,-{Stealth[bend]}] 
    (180:5.5) arc[start angle=180,end angle=240,radius=5.5];
 \end{scope}
 \path (\Angle:4) pic{cyl};
\end{tikzpicture}}
\end{document}

在此处输入图片描述

decorations.textPS 不知何故,与平面上的投影一起使用并不是一件完全不简单的事。

答案2

如果你只需要 GIF,那么 LaTeX 是否必不可少?如果你考虑另一种选择,并且我的回答不被视为垃圾邮件,那么有一个 ConTeXt 示例(编译它这里当您无法进行安装时)。遗憾的是没有精美的 3D:

\starttext
%#1: start; #2: end; #3: step; #4: content
\dostepwiserecurse{0}{330}{30}{%
\startMPpage
labeloffset := 5bp;
numeric u;  u := 1cm;
numeric alpha; alpha := \recurselevel;
pair peg, lilshadow; 
path stick;
stick := fullsquare xscaled 0.2u yscaled 2.2u shifted (1.5u*right);
peg := u*dir alpha;
lilshadow := (1.5u,ypart peg);
fill fullsquare scaled 2.2u withcolor .75[blue,white];
fill stick withcolor 0.75;
fill fullcircle scaled 2u;
fill fullcircle scaled 1/2u withcolor darkblue;
for i = 1/2 step 1/4 until 2:
    draw fullcircle scaled (i*u) withcolor 0.25; 
endfor
fill fullcircle scaled 1/8u withcolor (1,4/5,0);
%Comment the next line if you don't want a dashed line connecting the peg and its shadow
draw peg -- lilshadow dashed evenly withcolor (1,1,0);
drawdot lilshadow withpen pencircle scaled 4 withcolor 0.4;
drawdot peg withpen pencircle scaled 4 withcolor (1,1/2,0);
drawarrow (urcorner stick -- lrcorner stick) shifted (3bp*right);
label.rt("$\tfxx x=-A$", urcorner stick);
label.rt("$\tfxx x=+A$", lrcorner stick);
label.rt("$\tfxx x=0$", 1/2[urcorner stick, lrcorner stick]);
setbounds currentpicture to (fullsquare xscaled 4u yscaled 2.5u shifted (0.75u*right));
\stopMPpage%
}
\stoptext

我选择了简单的颜色,但您可以根据自己的喜好进行额外的调整。在命令行中使用以下命令(我的文件104.pdf在示例中):

convert -density 200 104.pdf 104-%02d.png
convert -delay 15 -dispose 2 104-*.png 104.gif

我最终得到了这个 GIF:

在此处输入图片描述

编辑:如上所述,改变步长以及结束点,我们得到一个移动速度更快或更慢的 GIF。如果我们使用

\dostepwiserecurse{0}{345}{15}{%

相反,使用相同的设置convert,我们得到以下结果:

在此处输入图片描述

答案3

PSTricks 解决方案仅用于娱乐或比较目的。

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node}
\begin{document}
\foreach \i in{0,10,...,350}{%
\begin{pspicture}(-5,-5)(6.5,5)
    \pscircle(0,0){4}
    \psline(5,-5)(5,5)
    \pnodes(4;\i){P}(!5 4 \i\space sin mul){Q}(5,-4){B}(5,0){O}(5,4){T}
    \psset{linecolor=gray,labelsep=12pt}
    \psline(0,0)(P)
    \qdisk(B){2pt}
    \qdisk(O){2pt}
    \qdisk(T){2pt}  
    \uput[0](B){$y=-A$}
    \uput[0](O){$y=0$}
    \uput[0](T){$y=A$}
    %
    \pcline[linestyle=dashed](P)(Q)
    \psset{linecolor=red}
    \qdisk(P){5pt}
    \qdisk(Q){5pt}
    %
    \pnode[!0 \i\space cos 1.5 mul](Q){Qy}
    \psLine[linecolor=blue,linewidth=4pt,arrowinset=0]{->}(Q)(Qy)
\end{pspicture}}
\end{document}

在此处输入图片描述

相关内容