[pstricks] Chronophotography

Jean-Côme Charpentier jean-come.charpentier at wanadoo.fr
Sun Jul 15 01:46:56 CEST 2007


There was a question on fctt (fr.comp.text.tex) about chronophotography.
I gave an PSTricks example and Herbert improved it! Then we work on this
code during two days.
Here is the result:

\documentclass[12pt]{article}% by Jean-Côme Charpentier
                             % and Herbert Voss

% inclined plane

\newcommand*\ChronoSlope{30 }
\newcommand*\ChronoSlopeN{180  \ChronoSlope sub }
% Length of inclined plane (that is, the ball course!)
\newcommand*\ChronoLength{15 }
\newcommand*\rBall{0.5 }
\newcommand*\mass{1 }

\def\Acceleration{9.81 \ChronoSlope sin mul }
\def\S#1{   % way as function of time, returns x y
  0.5 \Acceleration mul #1 dup mul mul     % S(t)
  dup \ChronoSlope cos mul                 % Sx
  exch \ChronoSlope sin mul neg \CVL add } % Sy

\def\tEnd{2 \ChronoLength mul \Acceleration div sqrt }

% Chrono Horizontal Length
\newcommand*{\CHL}{\ChronoSlope cos \ChronoLength mul }
% Chrono Vertical Length
\newcommand*{\CVL}{\ChronoSlope sin \ChronoLength mul }


  \pspolygon[style=magenta40](0,0)(!\CHL 0)(!0 \CVL)
  \rput[rt](14,8){\large\textbf{A gliding ball}}
  \multido{\nt=0+0.25}{10}{% Chronophotography
                           % (one shot per 1/4 second)
    \rput(! \S{\nt} ){%
      \pscircle[style=ball](!90 \ChronoSlope sub cos \rBall mul
                             90 \ChronoSlope sub sin \rBall mul)
    \psline[linestyle=dashed]{*-}(! \S{\nt} )(! \S{\nt} pop -0.2)
  }% end of multido
  \rput(! \S{2.5} pop 0 ){\pscircle[style=ball](0,\rBall){\rBall}}
    (! \S{2.5} pop \rBall )(! \S{2.5} pop 1 add \rBall )
  \rput{-\ChronoSlope}(! \S{2.25} ){%
      (! 0 90 \ChronoSlope add sin \rBall mul)
      (! 1 90 \ChronoSlope add sin \rBall mul)}
  \pcline(-0.75,0)(!-0.75 \CVL)
  \pcline(0,-0.75)(! \CHL -0.75)
     (!\rBall 4 mul \ChronoSlope sin mul
       \CVL \rBall 4 mul \ChronoSlope cos mul add)%
  \psarcn[arrows=<-](!\CHL 0){3}{180}{!\ChronoSlopeN}
  \uput*{2cm}[165](!\CHL 0){$\alpha$}

\psset{llx=-1.75, lly=-1.75, xAxisLabel={$t[sec]$},
% The value 13.8cm is the only problem here, should also be
% calculated by a macro
    (! 2 \ChronoLength mul \Acceleration div sqrt -0.2)%
    (! 2 \ChronoLength mul \Acceleration div sqrt 0.2)
  \psplot[linecolor=blue,linewidth=2pt]{0}{\tEnd}{% S(t)
       0.5 \Acceleration mul x dup mul mul }
      $s(t)=\frac{1}{2}(\,g\cdot\sin\alpha)\cdot t2$}
     (0,\ChronoLength)(! \tEnd \ChronoLength)(!\tEnd 0)
  \uput*{20pt}[90](! \tEnd 0){\textbf{$t_{End}$}}
  \psplot[linecolor=red,linewidth=2pt]{0}{\tEnd}{% Sy(t)
     0.5 \Acceleration mul x dup mul mul
     \ChronoSlope sin mul neg \CVL add}
        (\,g\cdot\sin2\alpha)\cdot t2\sim W_{pot}$}
  \psplot[linecolor=green,linewidth=2pt]{0}{\tEnd}{% Sx(t)
    0.5 \Acceleration mul x dup mul mul \ChronoSlope cos mul }
      $w(t)=\frac{1}{2}(\,g\cdot\sin\alpha\cos\alpha)\cdot t2$}
    {0}{\tEnd}{\Acceleration x mul }
      $v(t)=g\cdot\sin\alpha\cdot  t\sim W_{kin}$}
     (!0 \Acceleration)(!\tEnd \Acceleration)
% Energy
  \psplot[linecolor=black!30,linewidth=1pt]{0}{\tEnd}{% Sy(t)
     \mass 9.81 mul 0.5 \Acceleration mul x dup mul mul
     \ChronoSlope sin mul neg \CVL add mul 10 div}


If someone want make improvements in it...

  Jean-Côme Charpentier (and Herbert Voss who gave me power of attorney)

More information about the PSTricks mailing list