road.mws
Rolling wheel on a parametric road
by Thomas Grapperon, Facult des Sciences de Luminy, France, t.grapperon@laposte.net, 2001 Thomas Grapperon
NOTE: This worksheet demonstrates the use of Maple for displaying non analytical trajectories and retrieving the common parametric curves.
Introduction
My work began with a rolling circle on the x-axis. We could define all the parameters of this animation with analytical expressions. In this case, the position of a point of the wheel of radius 1 at the time "t" is given by
. We could see two different equation in each coordinates : one for the motion of the center of the wheel, e.g.
, and one for the rotation of the wheel, e.g.
. The complete trajectory is thus given by
.
At the beginning, I supposed that the generalisation for any kind of road is simple, e.g., adding the rotation part to another path. The result is not very usefull...
The problem is that the length of road covered by the wheel is an integral that does not always have an analytical solution. For example, if the road is a circle of radius R, and the wheel a circle of radius r inside the first circle, the distance covered at t is
K*t
, with K a constant. But if the road is the Lissajou curve, the speed is not constant, and the integral has no an analytical solution.
One solution is to calculate the sum of the little displacements from the beginning to t. We lose a lot of precision in this case, because the distance is known at t and t+1 but not between. We could partialy recover it if we increase the resolution (but also the computation).
I made a procedure,
traj(r,C,s,T,res)
. It returns an animation of the wheel rolling on the road.
The procedure arguments are :
-
r
, the radius of the wheel.
-
C
, the parametric equation of the road.
-
s
, the relative position of the wheel to the road :
s=1
for the wheel on the road, or inside a closed one,
s=-1
for the wheel under the road or outside a closed one.
-
T
, the duration of the motion.
-
res
, the number of frames.
The grey curve is the position of the center of the wheel.
>
restart;
Section I: The procedure
The procedure body
>
traj:=proc(r,C,s,T,res) #(Radius, Param.equation, Position(+-1), Time, Resolution)
local totale,tt,CC,dc,dtc,dist,ddist,ctct,tc,i,j,k,a;
#curve and speed
CC:=[subs(t=tt,op(1,C)),subs(t=tt,op(2,C))]:
dc:=diff(CC,tt):
#norm of the speed
ddist:=unapply(sqrt(op(1,dc)^2+op(2,dc)^2),tt);
#array of the total displacement at t*T/res
dist:=array(0..res);dist[0]:=0;
for k from 1 to res do dist[k]:=dist[k-1]+evalf(int(ddist(k*T/res),tt=(k-1)*T/res..k*T/res)): od:
#coordinates of the center of the wheel at t*T/res
tc:=[
unapply( op(1,CC)-s*r*op(2,dc)/ddist(tt),tt ),
unapply( op(2,CC)+s*r*op(1,dc)/ddist(tt),tt )
]:
#coordinates of the contact point at t*T/res
ctct:=unapply(CC,tt):
#initial angle
a:=-s*(Pi-linalg[angle](
[op(1,tc(0)),op(2,tc(0))]-ctct(0) ,[0,-1])):
#animation
totale:=
seq(
plots[display]({
#road
plot([op(CC),tt=0..T],color=black),
#wheel
plot([
op(1,tc(j*T/res))+r*cos(i),
op(2,tc(j*T/res))+r*sin(i),
i=0..2*Pi],color=red,thickness=2),
#distance center/contact point
plot([
[op(1,tc(j*T/res)),op(2,tc(j*T/res))],
[op(1,ctct(j*T/res)),op(2,ctct(j*T/res))]
],color=grey),
#center of the wheel trajectory
plot([op(1,tc(tt)),op(2,tc(tt)),tt=0..(j+.01)*T/res],color=grey),
#radius of the wheel
plot([
[op(1,tc(j*T/res)),op(2,tc(j*T/res))],
[op(1,tc(j*T/res)),op(2,tc(j*T/res))]-r*[sin(a+s*dist[j]/r),cos(a+s*dist[j]/r)]
],color=red,thickness=2),
#trajectory of the point on the wheel
seq(plot([
[op(1,tc(m*T/res))-r*sin(a+s*dist[m]/r),op(2,tc(m*T/res))-r*cos(a+s*dist[m]/r)],
[op(1,tc((m+1)*T/res))-r*sin(a+s*dist[(m+1)]/r),op(2,tc((m+1)*T/res))-r*cos(a+s*dist[(m+1)]/r)]],color=tan,thickness=2),m=0..(j-1))
})
,j=0..res):
plots[display](totale,insequence=true,scaling=constrained,axes=none);
end:
Section 2: Some curves
The cycloid:
>
traj(1,[t,0],1,15,30);
The hypocycloid:
>
traj(1,5*[cos(t),sin(t)],1,2*Pi,50);
The epicycloid:
>
traj(1,5*[cos(t),sin(t)],-1,2*Pi,50);
Sinusoidal trip:
>
traj(1,1.5*[(t),sin(t)],1,3*Pi,30);
Climbing the Gauss Mountain:
>
traj(1,4*[(t),3*exp(-(t-2)^2)],1,4,50);
Rolling on the infinity:
>
traj(1,2*[3*cos(t),sin(2*t)],-1,2*Pi,50);
>
Disclaimer:
While every effort has been made to validate the solutions in this worksheet, Waterloo Maple Inc. and the contributors are not responsible for any errors contained and are not liable for any damages resulting from the use of this material.