Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x[t_] := (1 + Cos[t]) Sin[t];
- y[t_] := -(1 + Cos[t]) Cos[t];
- tmin = 0; tmax = 2 Pi;
- n = 41;
- notzero[x_] := If[x == 0, 0.001, x];
- normals = N@Table[{y'[t], -x'[t]}, {t, tmin, tmax, (tmax - tmin)/n}];
- ps = N@Table[{x[t], y[t]}, {t, tmin, tmax, (tmax - tmin)/n}];
- ts = N@Table[t, {t, tmin, tmax, (tmax - tmin)/n}];
- X[t_] := x[t] -
- y'[t] ( x'[t]^2 + y'[t]^2)/notzero[x'[t] y''[t] - x''[t] y'[t]];
- Y[t_] := y[t] +
- x'[t] ( x'[t]^2 + y'[t]^2)/notzero[x'[t] y''[t] - x''[t] y'[t]];
- Manipulate[
- Show[
- Graphics[{}, PlotRange -> {{-2, 2}, {-3, 1}},
- ImageSize -> {300, 300}],
- Reverse@Table[
- ParametricPlot[
- ps[[i]] + t normals[[i]]/notzero@Norm[normals[[i]]], {t, -100,
- 100},
- PlotStyle ->
- If[i == \[Tau] || i == \[Tau] - Length@ts,
- Directive[Thickness[0.01], RGBColor[0.4, 0.4, 0.9]],
- Directive[Thick, Opacity[0.4], RGBColor[0.1, 0.1, 0.1]]]
- ], {i, If[\[Tau] > Length[ts], \[Tau] - Length[ts], 1],
- If[\[Tau] > Length[ts], Length[ts], \[Tau]]}],
- ParametricPlot[{{x[t], y[t]}, {X[t], Y[t]}}, {t, tmin, tmax},
- PlotStyle -> {Directive[Thick, RGBColor[0.9, 0.2, 0.3]],
- Directive[Thick, RGBColor[1.0, 0.1, 0.2]]}],
- Graphics[{PointSize[0.05], RGBColor[0.2, 0.2, 0.6],
- Point[ps[[Mod[\[Tau], Length@ts, 1]]]]}]
- ],
- {\[Tau], 1, 2 Length[ts], 1}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement