Bicycle

Mohammad Ghomi

This notebook generates the movie of a line segment whose midpoint slides along a given curve. The curve generated by the end points of the line segment is drawn as well.

Initialization

<< Graphics`Colors`

Off[General::spell1]

Off[ParametricPlot::ppcom]

tangent[c_][t_]:=((c'[t])/(Sqrt[c'[t].c'[t]]))

deltoid[a_][t_] := {-a + 2 a Cos[t] (1 + Cos[t]), 
        2 a (1 - Cos[t]) Sin[t]}

DeltoidMovie::usage = "DeltoidMovie[d,fnum] Outputs fnum frames for \
an animation of a segment of length d whose midpoint slides along a \
deltoid"

\(DeltoidMovie[d_, fnum_:  60] := 
      Module[{c, t0, t1, graph1, graph2, graph3, graph4, graph41, graph42, 
          graph5, graph51, graph52}, 
c = deltoid[1]; 
        t0 = 0.0001; \ t1 = 2  Pi; \ 

        Do[

graph1 = 
            ParametricPlot[c[t], \ {t, t0, \ t1}, \ Axes -> None, 
              AspectRatio -> 1, PlotStyle -> Red, 
              DisplayFunction -> 
                Identity]; 

graph2 = 
            Show[Graphics[{AbsolutePointSize[4], 
                  Point[c[t0 + n \((t1 - t0)\)/fnum]]}], 
              DisplayFunction -> 
                Identity]; 

graph3 = 
            Show[Graphics[{Blue, 
                  Line[{c[t0 + n \((t1 - t0)\)/fnum] - 
                        d\ \(tangent[c]\)[t0 + n \((t1 - t0)\)/fnum], 
                      c[t0 + n \((t1 - t0)\)/fnum] + 
                        d\ \(tangent[c]\)[t0 + n \((t1 - t0)\)/fnum]}]}], 
              DisplayFunction -> 
                Identity]; 

graph4 = 
            ParametricPlot[c[t] + d\ \(tangent[c]\)[t], \ {t, t0, 2  Pi/3}, 
              PlotStyle -> {Magenta, Thickness[ .006]}, \ 
              Axes -> None, 
              DisplayFunction -> 
                Identity]; 

graph41 = 
            ParametricPlot[
              c[t] + d\ \(tangent[c]\)[t], \ {t, 2  Pi/3, 4  Pi/3}, 
              PlotStyle -> {Magenta, Thickness[ .006]}, \ 
              Axes -> None, 
              DisplayFunction -> 
                Identity]; 

graph42 = 
            ParametricPlot[
              c[t] + d\ \(tangent[c]\)[t], \ {t, 4  Pi/3, 2  Pi}, 
              PlotStyle -> {Magenta, Thickness[ .006]}, \ 
              Axes -> None, 
              DisplayFunction -> 
                Identity]; 

graph5 = 
            ParametricPlot[c[t] - d\ \(tangent[c]\)[t], \ {t, t0, \ 2  Pi/3}, 
              PlotStyle -> {Magenta, Thickness[ .006]}, \ 
              Axes -> None, 
              DisplayFunction -> 
                Identity]; 

graph51 = 
            ParametricPlot[
              c[t] - d\ \(tangent[c]\)[t], \ {t, \ 2  Pi/3, 4  Pi/3}, 
              PlotStyle -> {Magenta, Thickness[ .006]}, \ 
              Axes -> None, 
              DisplayFunction -> 
                Identity]; 

graph52 = 
            ParametricPlot[
              c[t] - d\ \(tangent[c]\)[t], \ {t, \ 4  Pi/3, 2  Pi}, 
              PlotStyle -> {Magenta, Thickness[ .006]}, \ 
              Axes -> None, 
              DisplayFunction -> Identity]; 

Show[
            graph1, graph2, graph3, graph4, graph41, graph42, graph5, 
            graph51, 
            graph52, 
DisplayFunction -> $DisplayFunction], 
{n, 0, \ fnum - 1}]]\)

BicycleMovie::usage = "BicycleMovie[c,t0,t1,d,fnum] Outputs fnum \
frames for an animation of a segment of length d whose midpoint slides along \
the curve c[t0,t1]"

\(BicycleMovie[c_, t0_, t1_, d_, 
        fnum_:  40] := 
Module[{graph1, graph2, graph3, 
          graph4, graph41, graph5, graph51}, 

        Do[
graph1 = 
            ParametricPlot[c[t], \ {t, t0, \ t1}, \ Axes -> None, 
              PlotStyle -> Red, AspectRatio -> Automatic, 
              DisplayFunction -> 
                Identity]; 

graph2 = 
            Show[Graphics[{AbsolutePointSize[5], Red, 
                  Point[c[t0 + n \((t1 - t0)\)/fnum]]}], 
              DisplayFunction -> 
                Identity]; 

graph3 = 
            Show[Graphics[{Blue, 
                  Line[{c[t0 + n \((t1 - t0)\)/fnum] - 
                        d\ \(tangent[c]\)[t0 + n \((t1 - t0)\)/fnum], 
                      c[t0 + n \((t1 - t0)\)/fnum] + 
                        d\ \(tangent[c]\)[t0 + n \((t1 - t0)\)/fnum]}]}], 
              DisplayFunction -> 
                Identity]; 

graph4 = 
            ParametricPlot[c[t] + d\ \(tangent[c]\)[t], \ {t, t0, t1}, 
              PlotStyle -> {Magenta, Thickness[ .006]}, \ 
              Axes -> None, 
              DisplayFunction -> 
                Identity]; 

graph41 = 
            Show[Graphics[{AbsolutePointSize[5], Magenta, 
                  Point[c[t0 + n \((t1 - t0)\)/fnum] + 
                      d\ \(tangent[c]\)[t0 + n \((t1 - t0)\)/fnum]]}], 
              DisplayFunction -> 
                Identity]; 

graph5 = 
            ParametricPlot[
              c[t] - d\ \(tangent[c]\)[t], \ {t, t0, \ 
                t1}, 
PlotStyle -> {Green, 
                  Thickness[ .006]}, \ Axes -> None, 
              DisplayFunction -> 
                Identity]; 

graph51 = 
            Show[Graphics[{AbsolutePointSize[5], Green, 
                  Point[c[t0 + n \((t1 - t0)\)/fnum] - 
                      d\ \(tangent[c]\)[t0 + n \((t1 - t0)\)/fnum]]}], 
              DisplayFunction -> Identity]; 

Show[
            graph1, graph2, graph3, graph4, graph41, graph5, 
            graph51, 
DisplayFunction -> $DisplayFunction], 
{n, 0, \ fnum - 1}]]\)

Examples

DeltoidMovie[23]

BicycleMovie[ellipse[2, 1], 0, 2  Pi, 2.5]