For any arbitrary parametric smooth curve, how can I make the length of a car remain unchanged?
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot,pst-node}
\pstVerb
{
tx@Derive begin
/EvalVariable { 2 index (t) eq { (1) } { (0) } ifelse 4 -1 roll exch 6 2 roll } def
end
}
\def\x{t}
\def\y{2*cos(t)}
\def\xx{Derive(1,\x)}
\def\yy{Derive(1,\y)}
\def\rr{sqrt((\xx)^2+(\yy)^2)}
\def\Nx{-\yy/\rr}
\def\Ny{\xx/\rr}
\def\R{.2}
\def\xP{\x+\R*\Nx}
\def\yP{\y+\R*\Ny}
\begin{document}
\multido{\rx=.0+.3,\ry=.4+.3}{41}{%
\begin{pspicture}[algebraic](-.2,-2.2)(\dimexpr\psPiFour cm+.2cm,2.2)
\psparametricplot[linecolor=gray,plotpoints=100]{0}{TwoPi 2 mul}{\x|\y}
\curvepnodes[plotpoints=2]{\rx}{\ry}{\xP|\yP}{P}
\pspolygon*[linecolor=gray](P0)(P1)([offset=-.5]{P0}P1)([offset=.5]{P1}P0)
\qdisk(P0){\R}\qdisk(P1){\R}
\psparametricplot[linecolor=red,linewidth=2pt,plotpoints=100]{0}{\rx}{\xP|\yP}
\end{pspicture}}
\end{document}

Commenting Herbert's solution
It is too long as comment. Herbert's solution apparently keeps the length of curve segment bounded by the wheels constant rather than the length of the car. The following animation shows it.
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pstricks-add}
\pstVerb
{
tx@Derive begin
/EvalVariable { 2 index (t) eq { (1) } { (0) } ifelse 4 -1 roll exch 6 2 roll } def
end
}
\def\x{t}
\def\y{2*cos(t)}
\def\xx{Derive(1,\x)}
\def\yy{Derive(1,\y)}
\def\rr{sqrt((\xx)^2+(\yy)^2)}
\def\Nx{-\yy/\rr}
\def\Ny{\xx/\rr}
\def\R{.2}
\def\xP{\x+\R*\Nx}
\def\yP{\y+\R*\Ny}
\begin{document}
\multido{\iA=1+1,\iB=10+1}{40}{%
\begin{pspicture}[algebraic](-.2,-2.2)(\dimexpr\psPiFour cm+.2cm,2.2)
\psparametricplot[linecolor=gray,plotpoints=100]{0}{TwoPi 2 mul}{ \x | \y }
\pscurvepoints[plotpoints=50]{0}{TwoPi 2 mul}{ \xP | \yP }{P}
\pspolylineticks[ticksize=0 0,metricInitValue=1,Os=1,Ds=.3]{P}{ ds }{1}{50}%
\pspolygon*[linecolor=gray](PTick\iA)(PTick\iB)([offset=-.05]{PTick\iA}PTick\iB)([offset=.05]{PTick\iB}PTick\iA)
\qdisk(PTick\iA){\R}\qdisk(PTick\iB){\R}
\end{pspicture}%
}
\end{document}







(f(t),g(t)), and pointt0, and wheel radiusr, and intra wheel distanced. Then fort>t0, consider(f(t)-r g'(t),g(t)+r f'(t)), which is a point on the normal at local distancerfrom the curve (if the curvature of the curve is less than the curvature of the wheel in case both have the same sign), express that this point (the center of the potential front wheel) it is at distancedof(f(t0)-r g'(t0), g(t0)+r f'(t0))(the center of the rear wheel), and solve fort... does not look very practical. An approximate scheme would be more apt. – May 07 '14 at 16:54f'(t)^2+g'(t)^2=1, else the formula becomes (even more) complicated. – May 07 '14 at 16:59kbe the algebraic curvature: in your example this is-2cos(t)/(1+4sin^2(t))^{3/2}(see wikipedia). Letrbe the wheel radius, anddthe inter-wheel distance. Assumingr<<d<<1/|k|, it seems that to first approximation, iftcorresponds to the rear wheel, thent'=t+hcorresponds to the front wheel withh = d*(1+k * r + k^2 * d^2/24)/||T(t)||where||T(t)||=sqrt(f'^2+g'^2)is the speed vector length, in your examplesqrt(1+4*(sin(t))^2). – May 07 '14 at 18:01r<<d<<1/|k|is true. However I can not check as I am not proficient enough in pstricks to test it in your case. – May 07 '14 at 18:08tikz. I will be really grateful if you do so. – May 11 '14 at 02:04