Advertisement
Matthen

A Falling Target

Sep 26th, 2011
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. Manipulate[
  2. Row[{
  3. Show[Graphics[{
  4. ColorData["DarkBands"][0.3],
  5. Rotate[Rectangle[{-4, 0.5}, {0, -0.5}], Pi/6, {0, 0}],
  6. PointSize[Medium],
  7. Blue, Disk[target[ta], 0.4],
  8. Darker@Red, Point[bullet[ta]],
  9. Black, Dashed, Line[{{0, 0}, 2 target[0]}]
  10. }, PlotRange -> {{-5, 15}, {-3, 10}}],
  11. ParametricPlot[bullet[t], {t, 0, 14}, PlotStyle -> Black]
  12. , ImageSize -> {300, 200}
  13. ],
  14. Show[Graphics[{
  15. ColorData["DarkBands"][0.3],
  16. Rotate[
  17. Rectangle[{-4, 0.5} + {0, 1/2 g ta^2}, {0, -0.5} + {0,
  18. 1/2 g ta^2}], Pi/6, {0, 0} + {0, 1/2 g ta^2}],
  19. PointSize[Medium],
  20. Blue, Disk[target[ta] + {0, 1/2 g ta^2}, 0.4],
  21. Darker@Red, Point[bullet[ta] + {0, 1/2 g ta^2}],
  22. Black, Line[{{0, 0}, 2 target[0]}]
  23. }, PlotRange -> {{-5, 15}, {-3, 10}}],
  24. ParametricPlot[bullet[t] + {0, 1/2 g ta^2}, {t, 0, 14},
  25. PlotStyle -> Directive[Dashed, Black]]
  26. , ImageSize -> {300, 200}]
  27. }]
  28. , {ta, 0, 14},
  29. Initialization :> (
  30. g = 0.1;
  31. bullet[t_] := {Cos[Pi/6], Sin[Pi/6]} t - {0, 0.5 g t^2};
  32. target[t_] := 12 {Cos[Pi/6], Sin[Pi/6]} - {0, 0.5 g t^2};
  33. )]
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement