What is the non-piecewise curve that resembles the following roller coaster track?

538 Views Asked by At

I want to create an animation about roller coaster. One track I want to use looks like the following figure.

enter image description here

I am looking for the simplest non-piecewise parametric equation for both $x(t)$ and $y(t)$. Is there such a function?

1

There are 1 best solutions below

0
On

\begin{align} x(t)&=5\sin(t)\cos(3t)\\ y(t)&=-4\sin(t)\sin(3t) \end{align}

from $-\pi/3$ to $\pi/3$ can provide a loop that is reasonably accepted for a practical purpose.

\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{5*sin(t)*cos(3*t)}
\def\y{-4*sin(t)*sin(3*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{.1}
\def\xP{\x+\R*\Nx}
\def\yP{\y+\R*\Ny}

\begin{document}

\multido{\rx=1.0+-.1,\ry=.8+-.1}{21}{%
\begin{pspicture}[algebraic](-5,-5)(5,5)
 \psparametricplot[linecolor=gray,plotpoints=100]{Pi 3 div neg}{Pi 3 div}{\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]{1.0}{\rx}{\xP|\yP}
\end{pspicture}}

\end{document}

enter image description here