[pstricks] Chronophotography
Jean-Côme Charpentier
jean-come.charpentier at wanadoo.fr
Sun Jul 15 01:46:56 CEST 2007
Hi,
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
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,margin=1cm]{geometry}
\usepackage{lmodern}
\usepackage{pst-slpe,pstricks-add}
\newpsstyle{magenta40}{fillstyle=solid,fillcolor=magenta!40}
\newpsstyle{blue40}{fillstyle=solid,fillcolor=blue!60}
\newpsstyle{ball}{fillstyle=ccslope,slopebegin=white,slopeend=black}
% 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 }
\begin{document}
\begin{pspicture}(-1.75,-1.25)(14.5,10.5)
\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)
{\rBall}}
\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}}
\psline[arrowscale=2]{->}%
(! \S{2.5} pop \rBall )(! \S{2.5} pop 1 add \rBall )
\rput{-\ChronoSlope}(! \S{2.25} ){%
\psline[arrowscale=2]{->}%
(! 0 90 \ChronoSlope add sin \rBall mul)
(! 1 90 \ChronoSlope add sin \rBall mul)}
\psset{linewidth=0.2pt,tbarsize=5mm,arrowscale=2,arrows=|<->|}
\pcline(-0.75,0)(!-0.75 \CVL)
\ncput*[nrot=:U]{length\,$\cdot\sin\alpha$}
\pcline(0,-0.75)(! \CHL -0.75)
\ncput*{length\,$\cdot\cos\alpha$}
\rput{-\ChronoSlope}%
(!\rBall 4 mul \ChronoSlope sin mul
\CVL \rBall 4 mul \ChronoSlope cos mul add)%
{\pcline(0,0)(\ChronoLength,0)\ncput*{length}}
\psarcn[arrows=<-](!\CHL 0){3}{180}{!\ChronoSlopeN}
\uput*{2cm}[165](!\CHL 0){$\alpha$}
\end{pspicture}%}
\vspace{1cm}
\psset{llx=-1.75, lly=-1.75, xAxisLabel={$t[sec]$},
yAxisLabel={$s[m]/v[m/sec]$}}
%
% The value 13.8cm is the only problem here, should also be
% calculated by a macro
%
\begin{psgraph}[Dy=2,Dx=0.25]{->}(0,0)(2.5,16){13.2cm}{8cm}
\psline[linecolor=blue!50,linewidth=2pt]%
(! 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 }
\rput[lb](0.5,14)%
{\color{blue}%
$s(t)=\frac{1}{2}(\,g\cdot\sin\alpha)\cdot t2$}
\psline[linecolor=blue,linewidth=0.5pt,linestyle=dashed]%
(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}
\rput[lb](0.5,13)%
{\color{red}%
$h(t)=Height-\frac{1}{2}
(\,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 }
\rput[lb](0.5,12)%
{\color{green}%
$w(t)=\frac{1}{2}(\,g\cdot\sin\alpha\cos\alpha)\cdot t2$}
\psplot[linestyle=dashed,linecolor=magenta,linewidth=2pt]%
{0}{\tEnd}{\Acceleration x mul }
\rput[lb](0.5,11)%
{\color{magenta}%
$v(t)=g\cdot\sin\alpha\cdot t\sim W_{kin}$}
\psline[linecolor=black!60,linestyle=dashed,linewidth=2pt]%
(!0 \Acceleration)(!\tEnd \Acceleration)
\rput[lb](0.5,10){\color{black!60}$a(t)=g\cdot\sin\alpha$}
% 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}
\end{psgraph}
\end{document}
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