Image

Animación Pistón - Cigüeñal hecho en Latex

Crear una animación de un sistema Pistón - Cigüeñal, donde aparece la biela y la deducción de la fórmula de la posición del pistón, usando solamente LaTeX.

\documentclass[aspectratio=169,14pt]{beamer}
\usepackage{tikz}
\usepackage{animate}
\usepackage{ifthen}
\newcounter{a}
\setcounter{a}{0}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}
\begin{document}
\frame{
\frametitle{Sistema Piston-cigüeñal}
\begin{center}
  \begin{animateinline}[loop, poster = first]{25}  
  \whiledo{\thea<135}{
  \begin{tikzpicture}[xscale=0.5,yscale=0.5,
    declare function={f(\x)  ={2*cos(90-10*\x)+sqrt(12.25+(2*cos(90-10*\x))^2)};}]
    \draw[thick,->,gray] (-3,0)--(3,0) node[below] {$x$}; % x axis
    \draw[thick,->,gray] (0,-3)--(0,7) node[above] {$y$}; % y axis
% Crear dibujo del cigueñal
    \coordinate (orig) at (0,0);
        \draw[red, thick] (orig) circle (2 cm);
% Crear dibujo de la biela
    \coordinate (A) at (0,{f(\thea)});
    \coordinate (B) at ({2*cos(10*\thea)},{2*sin(10*\thea)});
    \draw[blue] (orig) -- (B);
    \draw[cyan,round cap-round cap, line width=3pt]  (A) -- (B);
    \draw[blue, thick] (B) circle (0.3 cm);
    
% Crear dibujo del pistón
    \draw[gray,-, line width=1pt]  (A) -- (B);
    \draw[blue, thick] (A) circle (0.3 cm);
    \coordinate (C) at (1,{0.5+f(\thea)});
    \coordinate (D) at (-1,{0.5+f(\thea)});
    \coordinate (E) at (-1,{-0.8+f(\thea)});
    \coordinate (F) at (-0.5,{-0.5+f(\thea)});
    \coordinate (G) at (0.5,{-0.5+f(\thea)});
    \coordinate (H) at (1,{-0.8+f(\thea)});
    \draw[gray,-, line width=1pt]  (C) -- (D) -- (E) -- (F) -- (G) -- (H) -- (C);
    

% Crear dibujo del cilindro   
    \draw[black,-, double]  (-1.2, 1.7) -- (-1.2, 6.7) -- (1.2, 6.7) --(1.2, 1.7);
  
  \end{tikzpicture}
     \stepcounter{a}
     \ifthenelse{\thea<135}{
    \newframe
     }{
       \end{animateinline}
    }
 }
\end{center}

} 
 
\end{document}

© Profesor Favián Arenas. 2023. Diseñado por HTML Codex