Advertisement
Matthen

Screw trick

Jul 5th, 2011
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. f[r_, t_] := r (t (4 Pi - t)/(4 Pi^2))^0.2;
  2. screw[x_, dir_] := Show[
  3. ParametricPlot3D[
  4. x + {f[r, t] Sin[ 2 t], f[r, t] Cos[ 2 t], t}, {t, 0, 4 Pi}, {r, 0,
  5. 1}, Axes -> None, Boxed -> False, Lighting -> "Neutral",
  6. Mesh -> {2, 2}, PlotRange -> All,
  7. PlotStyle -> RGBColor[0.7, 0.2, 0.2]],
  8. Graphics3D[{RGBColor[0.7, 0.7, 0.7],
  9. If[dir == 1,
  10. {Cylinder[{x, x + {0, 0, 6 Pi}}, 0.4], GrayLevel[0.2],
  11. Cylinder[{x + {0, 0, 6 Pi}, x + {0, 0, 6 Pi + 0.5}}, 1]
  12. }
  13. ,
  14. {Cylinder[{x - {0, 0, 2 Pi}, x + {0, 0, 4 Pi}}, 0.4],
  15. GrayLevel[0.2],
  16. Cylinder[{x - {0, 0, 2 Pi}, x - {0, 0, 2 Pi + 0.5}}, 1]}
  17. ]
  18. }]];
  19. frame[t_] :=
  20. Show[screw[{0, 0, 0}, 1], screw[{1.3 Cos[t], 1.3 Sin[t], 0}, -1],
  21. ImageSize -> {300}, ViewPoint -> {4, 5 Cos[t/3], 5 Cos[t/3]}];
  22. Manipulate[frame[t], {t, 0, 6 Pi}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement