Advertisement
Matthen

Watt's Curve

Sep 28th, 2012
919
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. d = 0.9; r1 = r2 = 1; l = 1;
  2. \[Theta]min = 0;
  3. \[Theta]max = 2 Pi;
  4. d\[Theta] = Pi/100;
  5. \[Theta]s =
  6. Table[\[Theta], {\[Theta], \[Theta]min, \[Theta]max, d\[Theta]}];
  7. pmids = Table[
  8. Sqrt[r1^2 - (d/2 Sin[\[Theta]] +
  9. Sqrt[(l/2)^2 - (d/2)^2 Cos[\[Theta]]^2])^2] {Cos[\[Theta]],
  10. Sin[\[Theta]]}, {\[Theta], \[Theta]s}];
  11. p1s = {};
  12. p2s = {};
  13. Module[{pmid, \[Theta], p1, p2, \[Theta]2, \[Theta]last = False},
  14. Do[
  15. pmid = pmids[[i]];
  16. \[Theta] = \[Theta]s[[i]];
  17. \[Theta]2 =
  18. First@SortBy[Select[Table[\[Theta], {\[Theta], 0, 2 Pi, 0.01}],
  19. (
  20. p1 = {d/2 + Cos[#], Sin[#]}; p2 = p1 + 2 (pmid - p1);
  21. Abs[Norm[p2 - {-d/2, 0}] - r2] < 0.01
  22. ) &
  23. ],
  24. (Norm[{d/2 + Cos[#], Sin[#]} - pmid] - l/2)^2
  25. &
  26. ];
  27. \[Theta]last = \[Theta]2;
  28. p1 = {d/2 + Cos[\[Theta]2], Sin[\[Theta]2]};
  29. AppendTo[p1s, p1];
  30. AppendTo[p2s, p1 + 2 (pmid - p1)];
  31. , {i, Length@pmids}];
  32. ];
  33.  
  34. Manipulate[
  35. Module[{i = 1 + Mod[j, Length[p1s]], p2, p1, pm},
  36. p2 = p2s[[i]]; p1 = p1s[[i]]; pm = pmids[[i]];
  37. Show[
  38. Graphics[{
  39. {Red,
  40. Line[
  41. Table[
  42. pm, {pm, If[j < Length@pmids, pmids[[;; j]], pmids[[i ;;]]]}]
  43. ]
  44. },
  45. {Dashed,
  46. Circle[{d/2, 0}, r1],
  47. Circle[{-d/2, 0}, r2]
  48. },
  49. {
  50. Line[{{d/2, 0}, p1}],
  51. Line[{{-d/2, 0}, p2}]
  52. },
  53. {PointSize[Large],
  54. Point[{d/2, 0}],
  55. Point[{-d/2, 0}],
  56. Blue,
  57. Thick,
  58. PointSize[Medium],
  59. Point[p1],
  60. Point[p2],
  61. Line[{p1, p2}],
  62. Darker@Red,
  63. Point[pm]
  64. }
  65. }]
  66. ]
  67. ]
  68. ,
  69. {j, 1, 2 Length[p1s] - 1, 1}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement