Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- corner[x_] :=
- Module[{\[Theta] = N@SawtoothWave[{0, 2 Pi}, x/(2 Pi)]}, Piecewise[{
- {{-1 - Cos[\[Theta]], Sin[\[Theta]]}, 0 <= \[Theta] < Pi/2},
- {{-Sqrt[2] Cos[\[Theta] - Pi/4], Sqrt[2] Sin[\[Theta] - Pi/4]},
- Pi/2 <= \[Theta] < Pi},
- {{1 + Sin[\[Theta] - Pi], Cos[\[Theta] - Pi]},
- Pi <= \[Theta] < 3 Pi/2},
- {{2, 0}, \[Theta] >= 3 Pi/2}
- }] + {4 Floor[x/(2 Pi)], 0}
- ];
- frame[\[Theta]_] := Module[{t},
- t = If[\[Theta] <= 3.5 Pi, \[Theta], 7 Pi - \[Theta]];
- Show[Graphics[{
- RGBColor[0.8, 0.3, 0.2],
- Polygon[{corner[t], corner[t + Pi/2] - {1, 0},
- corner[t + Pi] - {2, 0}, corner[t + 3 Pi/2] - {3, 0}}
- ], Black,
- PointSize[Medium], Point[corner[t]]
- }
- , PlotRange -> {{-2, 5}, {-0.1, 1.5}}],
- If[\[Theta] >= 3.5 Pi,
- ParametricPlot[corner[x], {x, t, 3.5 Pi + 0.001},
- PlotStyle -> Black]
- ,
- Graphics[]]
- ]];
- Manipulate[frame[\[Theta]], {\[Theta], 0, 7 Pi}]
Advertisement
Add Comment
Please, Sign In to add comment