Advertisement
Matthen

Logarithmic Spiral Roll

Jan 15th, 2014
1,894
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. a = 0.25;
  2. spiral[\[Theta]_] :=
  3. Exp[ a \[Theta]] {-Sin[\[Theta]], Cos[\[Theta]]};
  4. s = Integrate[
  5. Sqrt[D[spiral[\[Theta]t][[1]], \[Theta]t]^2 +
  6. D[spiral[\[Theta]t][[2]], \[Theta]t]^2], {\[Theta]t, 0, x}];
  7. tracep[t_, trace\[Theta]_] := Module[{p, dp, n},
  8. p = spiral[t];
  9. dp = spiral'[t];
  10. n = {-dp[[2]], dp[[1]]};
  11. n = n/Norm[n];
  12. RotationMatrix[{n, {0, 1}}].(spiral[trace\[Theta]] -
  13. p) + {s /. {x -> t}, 0}
  14. ];
  15. soft[x_] := 0.5 + 0.5 Tanh[7 (x - 0.5)];
  16. pr = {{-15, 50}, {-12, 20}};
  17. trace\[Theta]s = {-100, 4, 10};
  18. cols = Table[
  19. ColorData["DarkRainbow"][i/Length@trace\[Theta]s], {i,
  20. Length@trace\[Theta]s}];
  21. frame[tt_] :=
  22. Module[{t, op},
  23. If[tt < 1,
  24. t = -2 + soft[tt]*12;
  25. op = 1.0;,
  26. t = 10 - 12*soft[(tt - 1)];
  27. op = 1 - (tt - 1)^0.5;
  28. ];
  29. Show[
  30. ParametricPlot[
  31. tracep[t, \[Theta]]
  32. , {\[Theta], -10, 10}, PlotRange -> pr, Axes -> None,
  33. PlotStyle -> Directive[Black]],
  34. Reverse@Table[
  35. ParametricPlot[
  36. tracep[\[Theta], trace\[Theta]s[[i]]],
  37. {\[Theta], -2 - 0.001, If[tt > 1, 10, t]},
  38. PlotStyle ->
  39. If[i == 1, Directive[Opacity[op], Thick, cols[[i]]],
  40. Directive[Opacity[op], cols[[i]]]]
  41. ], {i, Length@trace\[Theta]s}]
  42. ,
  43. Graphics[{
  44. {
  45. Darker@Red,
  46. Table[
  47. {
  48. PointSize[Medium],
  49. cols[[i]],
  50. Point[tracep[t, trace\[Theta]s[[i]]]]},
  51. {i, Length@trace\[Theta]s}]
  52. },
  53. Line[{{-5, 0}, {46.106603757811996`, 0}}]
  54. }]
  55. ]
  56. ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement