SHARE
TWEET

Logarithmic Spiral's Caustic

Matthen Jan 13th, 2014 208 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. a = 0.2;
  2. \[Theta]max = Pi;
  3. \[Theta]cont = 4 Pi;
  4. \[Theta]min = -15;
  5. s[\[Theta]_] := Exp[a \[Theta]] {Cos[\[Theta]], Sin[\[Theta]]};
  6. red = RGBColor[222/255, 55/255, 29/255];
  7. transf[t_] := ((1 - t) + t (2 a/(1 + a^2))) {{a t + (1 - t), t}, {-t,
  8.      a t + (1 - t)}};
  9. frame[t_] :=
  10.   Show[
  11.    ParametricPlot[
  12.     {
  13.      s[\[Theta]],
  14.      transf[1 - If[t < 1.2, 0, Min[1, 1.5 (t - 1.2)]]].s[\[Theta]]
  15.      }, {\[Theta], -20, 40},
  16.     PlotStyle -> {Directive[red, Thick,
  17.        Opacity[0.5 - 0.5 Tanh[5 (t - 1)]]],
  18.       Directive[red, Thick, Opacity[0.5 Tanh[5 (t - 1.1)] + 0.5]]}
  19.     , PlotRange -> 1.1 Norm[s[\[Theta]max]], Axes -> None,
  20.     Background -> RGBColor[44/255, 71/255, 98/255]],
  21.    Graphics[
  22.     Table[
  23.      {
  24.       White,
  25.       Opacity[0.32 (0.5 - 0.5 Tanh[7 (t - 1.1)])],
  26.       Line[{{0, 0}, s[\[Theta]]}],
  27.       Block[{p = s'[\[Theta]], q},
  28.        q = {-p[[2]], p[[1]]};
  29.        Line[{s[\[Theta]], s[\[Theta]] + 100 q/Norm[q]}]
  30.        ]
  31.       }
  32.      , {\[Theta], \[Theta]min - 0.01, \[Theta]min +
  33.        Min[t, 1] (\[Theta]max + \[Theta]cont - \[Theta]min), \
  34. (\[Theta]max - \[Theta]min)/143}]
  35.     , PlotRange -> 1.1 Norm[s[\[Theta]max]]]
  36.    ];
  37. Manipulate[frame[t], {{t, 0.8}, 0, 1.9}]
RAW Paste Data
Challenge yourself this year...
Learn something new in 2017
Top