Compare the above three.js implementation with
the following Sage interact from my older Calc2 TechCompanion.
Click the Interact button, then drag the slider to determine how far to move the wheel along
the
xxxxxxxxxx
a = 2; b1 = 0.4; b2 = 1.7;
# Trochoid generated by a point close to the wheel's hub.
x1(t) = a*t - b1*sin(t)
y1(t) = a - b1*cos(t)
# Trochoid generated by a point close to the wheel's rim.
x2(t) = a*t - b2*sin(t)
y2(t) = a - b2*cos(t)
def _(h=(0.01, 4*pi)):
p = line( [(-a,0),(4*pi+a,0)] );
p += line( [(0,0), (0,2*a)] );
p += parametric_plot( (x1(t), y1(t)), (t, 0, h) )
p += parametric_plot( (x2(t), y2(t)), (t, 0, h), color='red' )
p += circle( (a*h, a), a, color='green' )
p += line( [(a*h,a),(x1(h),y1(h))], color='green' )
p += line( [(x2(h),y2(h)),(x1(h),y1(h))], color='green' )
show(p, figsize=10)