%%
%% This is file `pst-vehicle-doc.tex',
%%
%% IMPORTANT NOTICE:
%%
%% Package `pst-vehicle.tex'
%%
%% Thomas S\"{o}ll
%% with the collaboration of
%% Juergen Gilg
%% Manuel Luque
%%
%% This program can redistributed and/or modified under %%
%% the terms of the LaTeX Project Public License        %%
%% Distributed from CTAN archives in directory          %%
%% macros/latex/base/lppl.txt; either version 1.3c of   %%
%% the License, or (at your option) any later version.  %%
%%
%% DESCRIPTION:
%%   `pst-vehicle' is a PSTricks package
%%
%%
\documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,fleqn,
   smallheadings, headexclude,footexclude,oneside,dvipsnames,svgnames,x11names,distiller]{pst-doc}
%\documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings
%    headexclude,footexclude,oneside,dvipsnames,svgnames,distiller]{pst-doc}
\listfiles
\usepackage[autostyle]{csquotes}
\usepackage{biblatex}%\usepackage[style=dtk]{biblatex}
\addbibresource{pst-vehicle-doc.bib}
\usepackage[utf8]{inputenc}
\let\pstpersFV\fileversion
\usepackage[e]{esvect} % f\"{u}r sch\"{o}nere Vektorpfeile
\usepackage{pst-vehicle,pst-eucl,pstricks-add,animate}
\let\belowcaptionskip\abovecaptionskip

\def\bgImage{%
\begin{pspicture}(0,0)(14,8)
\def\FuncA{0.5*cos(1.5*x)+0.25*x}
\psplot[plotpoints=500]{0}{16}{\FuncA}
\psVehicle[vehicle=\HighWheeler,showSlope=false,linecolor=Gold]{0.35}{1.2}{\FuncA}%
\psVehicle[vehicle=\Bike,style=bike,showSlope=false,linecolor=green!70]{0.5}{6}{\FuncA}%
\psVehicle[vehicle=\Truck,style=truck,showSlope=false]{0.35}{12.2}{\FuncA}%
\end{pspicture}
}

\lstset{language=PSTricks,morekeywords={psVehicle}\footnotesize\ttfamily}
%
\psset{labelFontSize=\scriptstyle}% for mathmode
\psset{algebraic=true}
\newpsstyle{quadrillage}{subgriddiv=2,gridlabels=5pt,gridwidth=0.3pt,gridcolor=black!50,subgridwidth=0.2pt,subgridcolor=black}

\newcommand{\Epkt}[3]{\ensuremath{{\text{#1}}\left(\,#2\;\vline\;#3\,\right)}}



\begin{document}

\title{pst-vehicle v 1.0}
\subtitle{A PSTricks package for slipping/rolling vehicles on curves of any kind of mathematical functions}
\author{Thomas \textsc{S\"{o}ll}\\
avec la collaboration de\\
Manuel \textsc{Luque} et J\"{u}rgen \textsc{Gilg}}
\date{\today}

\maketitle

\tableofcontents
\psset{unit=1cm}


\clearpage


\begin{abstract}
This package was created to illustrate the notion of slope, the coefficient of the tangent line at a point of a curve. On the road, a rampant way or a dangerous descent due to their slope is indicated by a sign showing the percentage of the slope of this section of road, for example 10\,\%. It was therefore quite obvious that the idea of representing a vehicle rolling without slipping on a curve came into our minds. Different types of vehicles are proposed, the shape of the curve is to be defined by its equation: $y=f(x)$ in algebraic notation.
The line connecting the two contact points from the front and the rear wheel with the curve and the sign of the slope can be easily displayed. It is also possible to represent, not a speed-o-meter of the vehicle, but a slope-o-meter was introduced as an indicator of the value of the slope of the straight line defined above.


\vfill
This program can redistributed and/or modified under %%
the terms of the LaTeX Project Public License        %%
Distributed from CTAN archives in directory          %%
macros/latex/base/lppl.txt; either version 1.3c of   %%
the License, or (at your option) any later version.  %%

\end{abstract}


\clearpage



\section{Theory---the mathematical background}

Within the following first sections, we like to show the theory on how we programmed the package. Easy elementary vector geometry with some basic calculus aspects.



\subsection{Wheels on a curve---equal radii}

\psset{saveNodeCoors,NodeCoorPrefix=n,algebraic}
\def\myFunk{2-0.25*x^2}
\def\abl{Derive(1,\myFunk)}
\begin{pspicture}(-10,-1)(8,3.5)
\psplot{-3.8}{3.8}{\myFunk}
\pnode(*-3 {\myFunk}){A}
\pnode(*nAx {\abl}){A_St}
\pnode(*-1 {\myFunk}){B}
\pnode(*nBx {\abl}){B_St}
\psdot(A)
\psdot(B)
\uput*[-90](A){\small$\Epkt{}{x_0}{f(x_0)}$}
\uput*[-90](B){\small$\Epkt{}{x}{f(x)}$}

\pnode(!nAx nA_Sty 1 nA_Sty dup mul add sqrt div sub nAy 1 1 nA_Sty dup mul add sqrt div add){H}
\pnode(!nBx nB_Sty 1 nB_Sty dup mul add sqrt div sub nBy 1 1 nB_Sty dup mul add sqrt div add){V}
\psdot[linecolor=red](H)
\psdot[linecolor=red](V)
\pscircle[dimen=outer,linecolor=gray](H){1}
\pscircle[dimen=outer,linecolor=gray](V){1}

\pcline[linecolor=red](H)(V)\naput*{$R$}
\pcline[linecolor=blue](H)(A)\naput{$r$}
\pcline[linecolor=blue](V)(B)\naput{$r$}

\psplotTangent[linestyle=dashed,linecolor=Green]{nAx}{1.5}{\myFunk}
\psplotTangent[linestyle=dashed,linecolor=Green]{nBx}{1.5}{\myFunk}
\end{pspicture}

The boundary point of the back wheel (radius $r$ from the back wheel axis) with the curve:
\begin{equation*}
\vec{x}_0=
\begin{pmatrix}
x_0\\
f(x_0)
\end{pmatrix}
\end{equation*}
The direction of the tangent line is:
\begin{equation*}
\vec{t}_0=
\begin{pmatrix}
1\\
f'(x_0)
\end{pmatrix}
\end{equation*}
The normed normal vector in $x_0$ is:
\begin{equation*}
\vec{n}_{0x_0}=\frac{1}{\sqrt{1+f'(x_0)^2}}
\begin{pmatrix}
-f'(x_0)\\
1
\end{pmatrix}
\end{equation*}
The point $H$ -- coordinates of the back wheel axis is:
\begin{align*}
\overrightarrow{BW}&=\vec{x}_0+r\cdot \vec{n}_{0x_0}\\
&=\begin{pmatrix}
x_0-r\frac{f'(x_0)}{\sqrt{1+f'(x_0)^2}}\\
f(x_0)+r\frac{1}{\sqrt{1+f'(x_0)^2}}
\end{pmatrix}
\end{align*}
$x$ is the abscissa of the boundary point of the front wheel with the curve.

The normed normal vector in $x$ is:
\begin{equation*}
\vec{n}_{0x}=\frac{1}{\sqrt{1+f'(x)^2}}
\begin{pmatrix}
-f'(x)\\
1
\end{pmatrix}
\end{equation*}
The point $V$ -- coordinates of the front wheel axis is:
\begin{align*}
\overrightarrow{FW}&=\vec{x}+r\cdot \vec{n}_{0x}\\
&=\begin{pmatrix}
x-r\frac{f'(x)}{\sqrt{1+f'(x)^2}}\\
f(x)+r\frac{1}{\sqrt{1+f'(x)^2}}
\end{pmatrix}
\end{align*}
The distance between the axes is $R$ -- thus:
\begin{align*}
|\overrightarrow{FW}-\overrightarrow{BW}|&=R\\
\left|
\begin{pmatrix}
x-r\frac{f'(x)}{\sqrt{1+f'(x)^2}}-\left(x_0-r\frac{f'(x_0)}{\sqrt{1+f'(x_0)^2}}\right)\\
f(x)+r\frac{1}{\sqrt{1+f'(x)^2}}-\left(f(x_0)+r\frac{1}{\sqrt{1+f'(x_0)^2}}\right)
\end{pmatrix}
\right|&=R\\
\left|\begin{pmatrix}
x-x_0+r\left(\frac{f'(x_0)}{\sqrt{1+f'(x_0)^2}}-\frac{f'(x)}{\sqrt{1+f'(x)^2}}\right)\\
f(x)-f(x_0)+r\left(\frac{1}{\sqrt{1+f'(x)^2}}-\frac{1}{\sqrt{1+f'(x_0)^2}}\right)
\end{pmatrix}
\right|&=R
\end{align*}
This leads to an equation of the variable $x$, where $x$ is the abscissa of the boundary point of the front wheel with the curve.
\begin{equation*}
\left(x-x_0+r\left(\frac{f'(x_0)}{\sqrt{1+f'(x_0)^2}}-\frac{f'(x)}{\sqrt{1+f'(x)^2}}\right)\right)^2+\left(f(x)-f(x_0)+r\left(\frac{1}{%
\sqrt{1+f'(x)^2}}-\frac{1}{\sqrt{1+f'(x_0)^2}}\right)\right)^2=R^2
\end{equation*}



\subsection{Wheels on a curve---different radii}

\psset{saveNodeCoors,NodeCoorPrefix=n,algebraic}
\def\myFunk{2-0.25*x^2}
\def\abl{Derive(1,\myFunk)}
\begin{pspicture}(-10,-2)(8,3)
\psplot{-4}{4}{\myFunk}
\pnode(*-3 {\myFunk}){A}
\pnode(*nAx {\abl}){A_St}
\pnode(*-1 {\myFunk}){B}
\pnode(*nBx {\abl}){B_St}
\psdot(A)
\psdot(B)
\uput*[-90](A){\small$\Epkt{}{x_0}{f(x_0)}$}
\uput*[-90](B){\small$\Epkt{}{x}{f(x)}$}

\pnode(!nAx nA_Sty 1 nA_Sty dup mul add sqrt div sub nAy 1 1 nA_Sty dup mul add sqrt div add){H}
\pnode(!nBx nB_Sty 1 nB_Sty dup mul add sqrt div 0.7 mul sub nBy 1 1 nB_Sty dup mul add sqrt div 0.7 mul add){V}
\psdot[linecolor=red](H)
\psdot[linecolor=red](V)
\pscircle[dimen=outer,linecolor=gray](H){1}
\pscircle[dimen=outer,linecolor=gray](V){0.7}

\pcline[linecolor=red](H)(V)\naput*{$R$}
\pcline[linecolor=blue](H)(A)\naput{$r_1$}
\pcline[linecolor=blue](V)(B)\naput{$r_2$}

\psplotTangent[linestyle=dashed,linecolor=Green]{nAx}{1.5}{\myFunk}
\psplotTangent[linestyle=dashed,linecolor=Green]{nBx}{1.5}{\myFunk}
\end{pspicture}

The boundary point of the back wheel (radius $r_1$ from the back wheel axis) with the curve:
\begin{equation*}
\vec{x}_0=
\begin{pmatrix}
x_0\\
f(x_0)
\end{pmatrix}
\end{equation*}
The direction of the tangent line is:
\begin{equation*}
\vec{t}_0=
\begin{pmatrix}
1\\
f'(x_0)
\end{pmatrix}
\end{equation*}
The normed normal vector in $x_0$ is:
\begin{equation*}
\vec{n}_{0x_0}=\frac{1}{\sqrt{1+f'(x_0)^2}}
\begin{pmatrix}
-f'(x_0)\\
1
\end{pmatrix}
\end{equation*}
The point $H$ -- coordinates of the back wheel axis is:
\begin{align*}
\overrightarrow{BW}&=\vec{x}_0+r_1\cdot \vec{n}_{0x_0}\\
&=\begin{pmatrix}
x_0-r_1\frac{f'(x_0)}{\sqrt{1+f'(x_0)^2}}\\
f(x_0)+r_1\frac{1}{\sqrt{1+f'(x_0)^2}}
\end{pmatrix}
\end{align*}
$x$ is the abscissa of the boundary point of the front wheel with the curve.

The normed normal vector in $x$ is:
\begin{equation*}
\vec{n}_{0x}=\frac{1}{\sqrt{1+f'(x)^2}}
\begin{pmatrix}
-f'(x)\\
1
\end{pmatrix}
\end{equation*}
The point $V$ -- coordinates of the front wheel axis is:
\begin{align*}
\overrightarrow{FW}&=\vec{x}+r_2\cdot \vec{n}_{0x}\\
&=\begin{pmatrix}
x-r_2\frac{f'(x)}{\sqrt{1+f'(x)^2}}\\
f(x)+r_2\frac{1}{\sqrt{1+f'(x)^2}}
\end{pmatrix}
\end{align*}
The distance between the axes is $R$ -- thus:
\begin{align*}
|\overrightarrow{FW}-\overrightarrow{BW}|&=R\\
\left|
\begin{pmatrix}
x-r_2\frac{f'(x)}{\sqrt{1+f'(x)^2}}-\left(x_0-r_1\frac{f'(x_0)}{\sqrt{1+f'(x_0)^2}}\right)\\
f(x)+r_2\frac{1}{\sqrt{1+f'(x)^2}}-\left(f(x_0)+r_2\frac{1}{\sqrt{1+f'(x_0)^2}}\right)
\end{pmatrix}
\right|&=R\\
\end{align*}
This leads to an equation of the variable $x$, where $x$ is the abscissa of the boundary point of the front wheel with the curve.
\begin{equation*}
\left(x-x_0+r_1\frac{f'(x_0)}{\sqrt{1+f'(x_0)^2}}-r_2\frac{f'(x)}{\sqrt{1+f'(x)^2}}\right)^2+
\left(f(x)-f(x_0)+r_2\frac{1}{\sqrt{1+f'(x)^2}}-r_1\frac{1}{\sqrt{1+f'(x_0)^2}}\right)^2=R^2
\end{equation*}



\subsection{Inclination angle between back wheel and front wheel axes}

\psset{saveNodeCoors,NodeCoorPrefix=n,algebraic}
\def\myFunk{0}
\def\abl{Derive(1,\myFunk)}
\begin{pspicture}(-10,-0.5)(8,4)
\psplot{-8}{4}{\myFunk}
\pnode(*-5 {\myFunk}){A}
\pnode(*nAx {\abl}){A_St}
\pnode(*1 {\myFunk}){B}
\pnode(*nBx {\abl}){B_St}

%\uput*[-90](A){\small$\Epkt{}{x_0}{f(x_0)}$}
%\uput*[-90](B){\small$\Epkt{}{x}{f(x)}$}

\pnode(!nAx nA_Sty 1 nA_Sty dup mul add sqrt div 2 mul sub nAy 1 1 nA_Sty dup mul add sqrt div 2 mul add){H}
\pnode(!nBx nB_Sty 1 nB_Sty dup mul add sqrt div 1.4 mul sub nBy 1 1 nB_Sty dup mul add sqrt div 1.4 mul add){V}
\psdot[linecolor=red](H)
\psdot[linecolor=red](V)
\uput[90](H){H}
\uput[90](V){V}
\pscircle[dimen=outer,linecolor=gray](H){2}
\pscircle[dimen=outer,linecolor=gray](V){1.4}

\pcline[linecolor=red](H)(V)\naput{$R$}
\pcline[linecolor=blue](H)(A)\naput{$r_1$}
\pcline[linecolor=blue](V)(B)\naput{$r_2$}

\pcline[linecolor=gray,linestyle=dashed](H)(!nHx nVy)\nbput{$r_1-r_2$}
\pcline[linecolor=gray,linestyle=dashed](!nHx nVy)(!nVx nVy)\nbput{$\sqrt{R^2-(r_1-r_2)^2}$}

\pnode(!nHx nVy){X}

\pstMarkAngle[linecolor=red,arrows=->,MarkAngleRadius=4.5,LabelSep=3.6]{H}{V}{X}{\color{red}$\alpha$}
\end{pspicture}

The initial inclination angle $\alpha$ of the line between front wheel axis and back wheel axis on a horizontal plane is :
\begin{equation*}
  \alpha=\arctan\left(\frac{r_1-r_2}{\sqrt{R^2-(r_1-r_2)^2}}\right)
\end{equation*}
If the plane is not horizontal, there is an additional angle $\beta$ given by the function $f(x)$:

\psset{saveNodeCoors,NodeCoorPrefix=n,algebraic}
\def\myFunk{0}
\def\abl{Derive(1,\myFunk)}
\begin{pspicture}(-10,0)(8,5.5)
\rput{-20}{
\psplot{-8}{4}{\myFunk}
\pnode(*-5 {\myFunk}){A}
\pnode(*nAx {\abl}){A_St}
\pnode(*1 {\myFunk}){B}
\pnode(*nBx {\abl}){B_St}
\psdot(A)
\psdot(B)
\uput*[-90](A){\small$\Epkt{}{x_0}{f(x_0)}$}
\uput*[-90](B){\small$\Epkt{}{x}{f(x)}$}

\pnode(!nAx nA_Sty 1 nA_Sty dup mul add sqrt div 2 mul sub nAy 1 1 nA_Sty dup mul add sqrt div 2 mul add){H}
\pnode(!nBx nB_Sty 1 nB_Sty dup mul add sqrt div 1.4 mul sub nBy 1 1 nB_Sty dup mul add sqrt div 1.4 mul add){V}
\psdot[linecolor=red](H)
\psdot[linecolor=red](V)
\uput[90](H){H}
\uput[90](V){V}
\pscircle[dimen=outer,linecolor=gray](H){2}
\pscircle[dimen=outer,linecolor=gray](V){1.4}

\pcline[linecolor=red](H)(V)\naput{$R$}
\pcline[linecolor=blue](H)(A)\naput{$r_1$}
\pcline[linecolor=blue](V)(B)\naput{$r_2$}

\pcline[linecolor=gray,linestyle=dashed](H)(!nHx nVy)\nbput{$r_1-r_2$}
\pcline[linecolor=gray,linestyle=dashed](!nHx nVy)(!nVx nVy)\nbput{$\sqrt{R^2-(r_1-r_2)^2}$}

\pnode(!nHx nVy){X}

\pstMarkAngle[linecolor=red,arrows=->,MarkAngleRadius=4.5,LabelSep=3.6]{H}{V}{X}{\color{red}$\alpha$}
}

\rput(H){%
\pcline[linestyle=dashed](0,0)(5.5,0)\naput{$x_V-x_H$}
\pcline[linestyle=dashed](5.5,0)(V)\naput{$y_V-y_H$}
}
\uput{1cm}[-13](H){\color{blue}$\beta$}
\end{pspicture}

The coordinates of the front wheel axis are:
\begin{equation*}
\overrightarrow{FW}=\vec{x}+r_2\cdot \vec{n}_{0x}
=\begin{pmatrix}
x-r_2\frac{f'(x)}{\sqrt{1+f'(x)^2}}\\
f(x)+r_2\frac{1}{\sqrt{1+f'(x)^2}}
\end{pmatrix}
=\begin{pmatrix}
x_V\\y_V
\end{pmatrix}
\end{equation*}
The coordinates of the back wheel axis are:
\begin{equation*}
\overrightarrow{BW}=\vec{x}_0+r_1\cdot \vec{n}_{0x_0}
=\begin{pmatrix}
x_0-r_1\frac{f'(x_0)}{\sqrt{1+f'(x_0)^2}}\\
f(x_0)+r_1\frac{1}{\sqrt{1+f'(x_0)^2}}
\end{pmatrix}
=\begin{pmatrix}
x_H\\y_H
\end{pmatrix}
\end{equation*}
The angle $\beta$ is:
\begin{equation*}
\beta=\arctan\left(\frac{y_V-y_H}{x_V-x_H}\right)
\end{equation*}
The total angle $\gamma$ is:
\begin{equation*}
  \gamma=-(\alpha+\beta)
\end{equation*}



\subsection{Rolling without slipping}

\textbf{Important note:} There is a limitation for the radii. The radii $r$ of the wheels of the vehicle need to be smaller than the minimal curvature radius $\varrho$ of the given curve.

At points of inflection, the curvature radius is $\infty$. The curvature radius $\varrho$ is calculated with the following formula:
\begin{equation*}
\varrho=\frac{\sqrt{(1+f'(x)^2)^3}}{f''(x)}
\end{equation*}
The condition for \emph{rolling without slipping} is
\begin{equation*}
\omega=\left(\frac{1}{r}-\frac{1}{\varrho}\right)\cdot \dot{s},
\end{equation*}
where $s$ is the length along the curve of the function $f$.

With
\begin{equation*}
\omega=\frac{\text{d}\varphi}{\text{d}t}\quad\text{ and }\quad \dot{s}=\sqrt{1+f'(x)^2}\cdot\frac{\text{d}x}{\text{d}t}
\end{equation*}
this finally leads to
\begin{equation*}
\text{d} \varphi=\left(\frac{1}{r}-\frac{1}{\varrho}\right)\cdot\sqrt{1+f'(x)^2}\,\text{d}x
\end{equation*}



\section{Predefined vehicles}

This package contains a number of predefined vehicles, like \emph{Bike}, \emph{Tractor}, \emph{Highwheeler}, \emph{Truck}, \emph{Segway}, \emph{Unicycle}. The last two of the vehicles only contain one axis, the rest has two axes.

Except the mono-cycles, a vehicle is defined by the radius of each wheel, [\texttt{rB}] for the rear (back) wheel and [\texttt{rF}] for the front wheel and the distance [\texttt{d}] between the axes of the two wheels. Their values must be given within the options of the \texttt{\textbackslash psVehicle [options]} command. The cladding of a vehicle, auto body or bicycle frame must of course be adapted to the dimensions indicated above. A number of types of wheels and vehicles have been predefined.

We also setup some \verb+\newpsstyle+ for each of the vehicles, where the dimensions and the choice of the wheels are setup like we would choose them.
\begin{lstlisting}
\newpsstyle{segway}{rB=1.4,backwheel=\segWheel}%MonoAxis
\newpsstyle{unicycle}{rB=1.6,backwheel=\SpokesWheelB}%MonoAxis
\newpsstyle{tractor}{d=4,rB=1.4,rF=1.0}
\newpsstyle{truck}{backwheel=\TruckWheel,frontwheel=\TruckWheel,d=6.28,rB=1.9,rF=1.9}
\newpsstyle{bike}{backwheel=\SpokesWheelB,frontwheel=\SpokesWheelB,d=5.8,rB=1.6,rF=1.6}
\end{lstlisting}
Here follows a list of the vehicles that come along with the package:



\subsection{\textbackslash Bike}

\begin{LTXexample}[pos=l,width=4cm]
\begin{pspicture}(0,0)(4,3)
\def\FuncA{1*cos(x)+1}
\psframe*[linecolor=yellow!10](0,0)(4,3)
\psgrid[style=quadrillage](0,0)(4,3)
\psplot{0}{4}{\FuncA}
\psVehicle[vehicle=\Bike,showSlope]{0.25}{1.2}{\FuncA}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash Tractor}

\begin{LTXexample}[pos=l,width=4cm]
\begin{pspicture}(-1,4)(3,7)
\def\funkg{sqrt(-x^2+2*x*10+1)}
\psframe*[linecolor=yellow!10](-1,4)(3,7)
\psgrid[style=quadrillage](-1,4)(3,7)
\psplot[plotpoints=500,algebraic]{0.5}{4}{\funkg}
\psVehicle[vehicle=\Tractor,showSlope=false]{0.5}{1}{\funkg}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash HighWheeler}

\begin{LTXexample}[pos=l,width=4cm]
\begin{pspicture}(0,-1)(4,3)
\def\FuncA{-0.25*(x-2)^2+0.5}
\psframe*[linecolor=yellow!10](0,-1)(4,3)
\psgrid[style=quadrillage](0,-1)(4,3)
\psplot[yMinValue=0]{0}{4}{\FuncA}
\psVehicle[vehicle=\HighWheeler]{0.25}{1.2}{\FuncA}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash Truck}

\begin{LTXexample}[pos=l,width=4cm]
\begin{pspicture}(0,-1)(4,3)
\def\FuncA{0.3*1.6^x}
\psframe*[linecolor=yellow!10](0,-1)(4,3)
\psgrid[style=quadrillage](0,-1)(4,3)
\psplot{0}{4}{\FuncA}
\psVehicle[vehicle=\Truck,style=truck]{0.3}{1.2}{\FuncA}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash Segway}

\begin{LTXexample}[pos=l,width=4cm]
\begin{pspicture}(0,-1)(4,4)
\def\FuncA{(x-3)*sin(0.2*(x-1))+1}
\psframe*[linecolor=yellow!10](0,-1)(4,4)
\psgrid[style=quadrillage](0,-1)(4,4)
\psplot{0}{4}{\FuncA}
\psVehicle[vehicle=\Segway,style=segway]{0.25}{1.2}{\FuncA}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash UniCycle}

\begin{LTXexample}[pos=l,width=4cm]
\begin{pspicture}(0,0)(4,4)
\def\FuncA{(x-3)*sin(0.2*(x-1))+1}
\psframe*[linecolor=yellow!10](0,0)(4,4)
\psgrid[style=quadrillage](0,0)(4,4)
\psplot{0}{4}{\FuncA}
\psVehicle[vehicle=\UniCycle,style=unicycle,showSlope=false]{0.5}{2.2}{\FuncA}
\end{pspicture}
\end{LTXexample}



\section{Predefined wheels}

In this section we present the predefined wheels that can be used for the front or back wheel.



\subsection{\textbackslash wheelA}

\begin{LTXexample}[pos=l,width=2cm]
\begin{pspicture}(-1,-1)(1,1)
\rput(!/rB 1 def 0 0){\wheelA}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash{}wheelB}

\begin{LTXexample}[pos=l,width=2cm]
\begin{pspicture}(-1,-1)(1,1)
\rput(!/rB 1 def 0 0){\wheelB}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash wheelC}

\begin{LTXexample}[pos=l,width=2cm]
\begin{pspicture}(-1,-1)(1,1)
\rput(!/rB 1 def 0 0){\wheelC}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash wheelD}

\begin{LTXexample}[pos=l,width=2cm]
\begin{pspicture}(-1,-1)(1,1)
\rput(!/rB 1 def 0 0){\wheelD}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash arrowWheel}

\begin{LTXexample}[pos=l,width=2cm]
\begin{pspicture}(-1,-1)(1,1)
\rput(!/rB 1 def 0 0){\arrowWheel}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash TruckWheel}

\begin{LTXexample}[pos=l,width=2cm]
\begin{pspicture}(-1,-1)(1,1)
\rput(!/rB 1 def 0 0){\TruckWheel}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash segWheel}

\begin{LTXexample}[pos=l,width=2cm]
\begin{pspicture}(-1,-1)(1,1)
\rput(!/rB 1 def 0 0){\segWheel}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash SpokesWheelCrossed}

\begin{LTXexample}[pos=l,width=2cm]
\begin{pspicture}(-1,-1)(1,1)
\rput(!/rB 1 def 0 0){\SpokesWheelCrossed}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash SpokesWheelA}

\begin{LTXexample}[pos=l,width=2cm]
\begin{pspicture}(-1,-1)(1,1)
\rput(!/rB 1 def 0 0){\SpokesWheelA}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash TractorFrontWheel}

\begin{LTXexample}[pos=l,width=2cm]
\begin{pspicture}(-1,-1)(1,1)
\rput(!/rF 1 def 0 0){\TractorFrontWheel}
\end{pspicture}
\end{LTXexample}



\subsection{\textbackslash TractorRearWheel}

\begin{LTXexample}[pos=l,width=2cm]
\begin{pspicture}(-1,-1)(1,1)
\rput(!/rB 1 def 0 0){\TractorRearWheel}
\end{pspicture}
\end{LTXexample}



\section{How to use the command}

This package offers the following command:

\begin{BDef}
\Lcs{psVehicle}\OptArgs\Largb{scaling factor}\Largb{abscissa back wheel}\Largb{equation function}
\end{BDef}

\textbf{Important note:} The function has to be given in algebraic notation and not in RPN.

The package \LPack{pst-vehicle} contains the options \nxLkeyword{epsilon=}, \nxLkeyword{rB=}, \nxLkeyword{rF=}, \nxLkeyword{d=}, \nxLkeyword{gang=}, \nxLkeyword{vehicle=}, \nxLkeyword{ownvehicle=}, \nxLkeyword{backwheel=}, \nxLkeyword{frontwheel=}, \nxLkeyword{MonoAxis=} and \nxLkeyword{showSlope=}
\begin{quote}
\begin{tabularx}{\linewidth}{ @{} l >{\ttfamily}l X @{} }\toprule
\emph{Name}           & \emph{Default} & \emph{Meaning} \\\midrule
\Lkeyword{epsilon}     & 1e-6          & Increment\\
\Lkeyword{rB}    & 1.6             & Radius of the back wheel\\
\Lkeyword{rF}  & 1.6   & Radius of the front wheel\\
\Lkeyword{d}  & 5.8   & Distance between front and back wheel axes\\
\Lkeyword{gang}  & 1   & Transmission between pedals and back wheel\\
\Lkeyword{vehicle}  & \texttt{\textbackslash Bike}   & The Bike is chosen by default\\
\Lkeyword{ownvehicle}  &   & Used to generate custom vehicle\\
\Lkeyword{backwheel}  & \texttt{\textbackslash wheelA}   & wheelA is chosen by default\\
\Lkeyword{frontwheel}  & \texttt{\textbackslash wheelA}   & wheelA is chosen by default\\
\Lkeyword{MonoAxis}  & false   & if the vehicle has one axis\\
\Lkeyword{showSlope}  & true   & showing the slope of the vehicle\\
\bottomrule
\end{tabularx}
\end{quote}



\section{The Slope-o-Meter}

A very nice gadget to show the angle of the slope of the vehicle on the curve. A fine thing for animations as you will see within the section Animation \ldots

This command is shipped with two arguments to customize it with the \emph{color of appearance} and the \emph{angle of the pointer}.

\textbf{Note:} The name \emph{Slope-o-Meter} is not at all an academically correct notation, but we all together had great fun to give it that special name.
\begin{LTXexample}[pos=l,width=5cm]
\begin{pspicture}(-2.5,-2.5)(2.5,2.5)
\pstVerb{/omega 30 def}
\rput(0,0){\SlopeoMeter{cyan!90}{omega}}
\end{pspicture}
\end{LTXexample}



\section{Examples}

\subsection{Predefined vehicle with custom wheels}

\begin{LTXexample}[pos=l,width=7cm]
\begin{pspicture}(1,1)(8,6)
\def\FuncA{0.5*cos(x)+2}
\psframe*[linecolor=yellow!10](1,1)(8,6)
\psgrid[style=quadrillage](1,1)(8,6)
\psplot{1}{8}{\FuncA}
\psVehicle[vehicle=\Truck,showSlope=false,frontwheel=\wheelC,backwheel=\arrowWheel,rB=1,rF=1]{0.5}{3.2}{\FuncA}
\end{pspicture}
\end{LTXexample}



\subsection{Custom vehicle}

To design your own vehicle, there are just a few rules to follow:
\begin{itemize}
\item Choose \nxLkeyword{vehicle=\textbackslash SelfDefinedVehicle}
\item No need to draw the wheels---just choose one of the predefined---or define your own wheels and then choose them with the options \nxLkeyword{backwheel=} and \nxLkeyword{frontwheel=}
\item \textbf{Important note:} The axe of the back wheel is hard programmed at: \Epkt{O}{0}{0}
\item The front wheel position is automatically calculated with the given distance between the two axes \nxLkeyword{d=}
\item Draw your vehicle as if it stands on a horizontal plane, then define it and set it with i.\,e. \nxLkeyword{ownvehicle=\textbackslash myVeh} as shown in the example below.
\end{itemize}
\begin{LTXexample}[pos=l,width=5cm]
\def\myVeh{\psframe*[linecolor=red](-1,-0.25)(5,2)}
\begin{pspicture}(2,1)(7,4)
\def\FuncA{0.5*sin(x)+2}
\psframe*[linecolor=yellow!10](2,1)(7,4)
\psgrid[style=quadrillage](2,1)(7,4)
\psplot{2}{7}{\FuncA}
\psVehicle[vehicle=\SelfDefinedVehicle,ownvehicle=\myVeh,showSlope=false,frontwheel=\wheelA,backwheel=\wheelB,rB=1,rF=1,d=4]{0.5}{3.2}{\FuncA}
\end{pspicture}
\end{LTXexample}

The same body of the vehicle is chosen as within the example above, but the front wheel has a smaller radius.

\begin{LTXexample}[pos=l,width=5cm]
\def\myVeh{\psframe*[linecolor=red](-1,-0.25)(5,2)}
\begin{pspicture}(2,1)(7,4)
\def\FuncA{0.5*sin(x)+2}
\psframe*[linecolor=yellow!10](2,1)(7,4)
\psgrid[style=quadrillage](2,1)(7,4)
\psplot{2}{7}{\FuncA}
\psVehicle[vehicle=\SelfDefinedVehicle,ownvehicle=\myVeh,showSlope=false,frontwheel=\wheelA,backwheel=\wheelB,rB=1,rF=0.7,d=4]{0.5}{3.2}{\FuncA}
\end{pspicture}
\end{LTXexample}



\section{Animation}

\begin{LTXexample}[pos=t,width=15cm]
\def\funkg{0.25*(x-3)*sin(0.2*(x-2))-1}
\begin{animateinline}[controls,palindrome,
    begin={\begin{pspicture}(-2,-2)(13,3)},
    end={\end{pspicture}}]{20}% 20 frames/s (velocity of the animation)
\multiframe{100}{rB=0+0.05}{% number of frames
\psframe*[linecolor=cyan!20](-2,-2)(13,4)
\pscustom[fillstyle=solid,fillcolor={[RGB]{174 137 100}},linestyle=none]{
\psplot[plotpoints=500,algebraic]{-2}{13}{\funkg}
\psline(13,-2)(-2,-2)
\closepath}
\psplot[plotpoints=500,algebraic]{-2}{13}{\funkg}
\psVehicle[vehicle=\Bike,style=bike,linecolor=DodgerBlue4]{0.4}{\rB}{\funkg}
\rput(10.5,0.5){\SlopeoMeter{cyan!90}{omega}}
}
\end{animateinline}
\end{LTXexample}


\clearpage


\section{List of all optional arguments for \texttt{pst-vehicle}}

\xkvview{family=pst-vehicle,columns={key,type,default}}


\clearpage


\nocite{*}
\bgroup
\RaggedRight
\printbibliography
\egroup


\printindex
\end{document} 