如何在 Tex 中创建动态几何文件?

如何在 Tex 中创建动态几何文件?

我有一个包含

\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{uququq}{rgb}{0.25,0.25,0.25}
\definecolor{tttttt}{rgb}{0.2,0.2,0.2}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(-2.5,-1.5) rectangle (4.5,6.08);
\draw(-0.5,2) circle (1.5cm);
\draw(1,2) circle (3cm);
\draw (0.5,4.24)-- (1,2);
\draw (1,2)-- (2.25,3.12);
\draw (0.5,4.24)-- (2.5,2);
\draw(0.25,2) circle (2.25cm);
\draw(1.75,2) circle (0.75cm);
\draw (1,2)-- (2.5,2);
\draw (1.73,2.08) -- (1.73,1.92);
\draw (1.77,2.08) -- (1.77,1.92);
\draw (2.5,2)-- (4,2);
\draw (3.23,2.08) -- (3.23,1.92);
\draw (3.27,2.08) -- (3.27,1.92);
\draw (-2,2)-- (1,2);
\draw (-2,2)-- (-0.34,3.49);
\draw (-0.34,3.49)-- (0.5,4.24);
\draw (0.05,3.93) -- (0.11,3.79);
\draw (0.5,4.24)-- (1.33,4.98);
\draw (0.88,4.68) -- (0.94,4.54);
\draw (0.5,4.24)-- (2.25,3.12);
\draw (1.35,3.78) -- (1.31,3.63);
\draw (1.39,3.75) -- (1.35,3.6);
\draw (1.43,3.73) -- (1.39,3.58);
\draw (2.25,3.12)-- (4,2);
\draw (3.11,2.66) -- (3.06,2.51);
\draw (3.15,2.63) -- (3.1,2.48);
\draw (3.19,2.61) -- (3.14,2.46);
\begin{scriptsize}
\fill [color=tttttt] (-2,2) circle (1.5pt);
\draw[color=tttttt] (-2.23,1.68) node {$A$};
\fill [color=black] (4,2) circle (1.5pt);
\draw[color=black] (4.1,2.26) node {$B$};
\fill [color=uququq] (1,2) circle (1.5pt);
\draw[color=uququq] (1.02,1.57) node {$C$};
\fill [color=uququq] (-0.5,2) circle (1.5pt);
\draw[color=uququq] (-0.4,2.26) node {$D$};
\fill [color=black] (-0.34,3.49) circle (1.5pt);
\draw[color=black] (-0.36,3.82) node {$M$};
\fill [color=uququq] (1.33,4.98) circle (1.5pt);
\draw[color=uququq] (1.34,5.35) node {$N$};
\fill [color=uququq] (0.5,4.24) circle (1.5pt);
\draw[color=uququq] (0.48,4.59) node {$H$};
\fill [color=uququq] (2.5,2) circle (1.5pt);
\draw[color=uququq] (2.56,1.9) node {$I$};
\fill [color=uququq] (2.25,3.12) circle (1.5pt);
\draw[color=uququq] (2.34,3.38) node {$J$};
\fill [color=uququq] (1.83,2.75) circle (1.5pt);
\draw[color=uququq] (1.79,2.5) node {$G$};
\end{scriptsize}
\end{tikzpicture}
\end{document}

文件是在 GeoGebra 程序中编写的,我将其上传到http://www.mediafire.com/?r61yp96mwlm3t1h

如何像在 GeoGebra 中一样在 Tex 中创建一个点 M 在圆上移动的文件?

答案1

在此处输入图片描述

可点击的 PDF 动画,作为演示的修改版本创建inlinemovie.tex

\documentclass{article}
\usepackage{lmodern}
\usepackage[inline]{asymptote}
\usepackage{animate}
\begin{document}

Here is an inline PDF movie, generated with the commands
\begin{verbatim}
pdflatex inlinemovie
asy inlinemovie-*.asy
pdflatex inlinemovie
\end{verbatim}
or equivalently,
\begin{verbatim}
latexmk -pdf inlinemovie
\end{verbatim}

\begin{center}
\begin{asy}
import markers;
import animate;
animation Anim=animation("movie1");
real phi;

picture pic;
size(pic,300);

for(int i=0; i < 40; ++i) {
  phi=100-2*i;
  guide circ1=circle((5,0),1);
  guide circ2=circle((2,0),2);
  guide circ3=circle((3,0),3);
  guide circ4=circle((4,0),4);

  pair A,B,C,D,G,H,I,J,M,NN;
  pair AMp;
  A=(0,0); B=(8,0); D=(2,0);
  C=(4,0); I=(6,0);

  M=shift(D)*rotate(phi)*(2,0);
  AMp=0.5(A+M);

  guide AM=M--(M+dir(M-AMp)*10);
  NN=intersectionpoint(AM,circ4);
  H=0.5(M+NN);
  J=0.5(H+B);

  draw(pic,A--C); 
  draw(pic,A--M);
  draw(pic,M--NN,StickIntervalMarker(2,1,angle=-20,red,dotframe(black)));
  draw(pic,C--B,StickIntervalMarker(2,2,angle=-20,darkgreen,dotframe(black)));
  draw(pic,H--B,StickIntervalMarker(2,3,angle=-20,blue,dotframe(black)));

  draw(pic,J--C);
  draw(pic,H--C);
  draw(pic,H--I);

  label(pic,"$H$",H,NW);
  G=intersectionpoint(J--C,H--I);

  dot(pic,A);
  dot(pic,B);
  dot(pic,C);
  dot(pic,D);
  dot(pic,M);
  dot(pic,NN);
  dot(pic,G);
  dot(pic,H);
  dot(pic,J);
  label(pic,"$A$",A,W);
  label(pic,"$B$",B,E);
  label(pic,"$C$",C,SW);
  label(pic,"$D$",D,N);
  label(pic,"$M$",M,NW);
  label(pic,"$N$",NN,dir(M-A));
  label(pic,"$G$",G,S);
  label(pic,"$H$",H,NW);
  label(pic,"$I$",I,SE);
  label(pic,"$J$",J,NE);

  draw(pic,circ1);
  draw(pic,circ2);
  draw(pic,circ3);
  draw(pic,circ4);

  Anim.add(pic);
  erase(pic);
}
label(Anim.pdf("controls",delay=50,keep=!settings.inlinetex));
\end{asy}
\end{center}

\end{document}

详情请参阅texdoc asymptote

相关内容