Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. Clear["Global`*"];
  2.  
  3. x1[t_] := -((16*(290 - 15*Sqrt[29]*Cosh[t] + 2*Sqrt[3103]*Sinh[t]))/3103)
  4. y1[t_] := (16*(-116 + 6*Sqrt[29]*Cosh[t] + 5*Sqrt[3103]*Sinh[t]))/3103
  5. z1[t_] := 5*x1[t] + 2*y1[t] + 8
  6. x2[t_] := -((16*(290 + 15*Sqrt[29]*Cosh[t] + 2*Sqrt[3103]*Sinh[t]))/3103)
  7. y2[t_] := (16*(-116 - 6*Sqrt[29]*Cosh[t] + 5*Sqrt[3103]*Sinh[t]))/3103
  8. z2[t_] := 5*x2[t] + 2*y2[t] + 8
  9. boven1 = Flatten[{{x, y} /. Solve[{(9/4)*(x^2 + y^2) == 21^2, 5*x + 2*y + 8 == 21}, {x, y}][[1]], 21}];
  10. boven2 = Flatten[{{x, y} /. Solve[{(9/4)*(x^2 + y^2) == 21^2, 5*x + 2*y + 8 == 21}, {x, y}][[2]], 21}];
  11. m1 = (boven1 + boven2)/2;
  12. onder1 = Flatten[{{x, y} /. Solve[{(9/4)*(x^2 + y^2) == 21^2, 5*x + 2*y + 8 == -21}, {x, y}][[1]], -21}];
  13. onder2 = Flatten[{{x, y} /. Solve[{(9/4)*(x^2 + y^2) == 21^2, 5*x + 2*y + 8 == -21}, {x, y}][[2]], -21}];
  14. m2 = (onder1 + onder2)/2;
  15. distance[{start_, end_}, pt_] := Module[{param}, param = (pt - start) . (end - start)/Norm[end - start]^2; Which[param < 0, EuclideanDistance[start, pt], param > 1,
  16. EuclideanDistance[end, pt], True, EuclideanDistance[pt, start + param*(end - start)]]];
  17.  
  18. Export["hyperbola.mov", Table[Show[
  19. Graphics3D[{Opacity[.4], RGBColor[1, 1, 1], Specularity[White, 100],
  20. Sphere[{0, 0, 1.95}, 1.08]}, Boxed -> False],
  21. Graphics3D[{Opacity[.4], RGBColor[1, 1, 1], Specularity[White, 100],
  22. Sphere[{0, 0, -3.95}, 2.18]}, Boxed -> False],
  23. ParametricPlot3D[{x1[t], y1[t], z1[t]}, {t, -1.82306, 1.82306},
  24. RegionFunction -> Function[{x, y, z}, z >= 7 - u], PlotStyle -> {Yellow},
  25. Method -> {"TubePoints" -> 1}] /.
  26. Line[pts_, rest___] :> Tube[pts, 0.08, rest],
  27. ParametricPlot3D[{x2[t], y2[t], z2[t]}, {t, -1.61735, 1.61735},
  28. RegionFunction -> Function[{x, y, z}, z >= 7 - u], PlotStyle -> {Yellow},
  29. Method -> {"TubePoints" -> 1}] /.
  30. Line[pts_, rest___] :> Tube[pts, 0.08, rest],
  31. ParametricPlot3D[{0.895 Cos[t], 0.895 Sin[t], 1.342}, {t, 0, 2 Pi},
  32. Boxed -> False, Axes -> False, PlotStyle -> {Yellow},
  33. Method -> {"TubePoints" -> 2}] /.
  34. Line[pts_, rest___] :> Tube[pts, 0.02, rest],
  35. ParametricPlot3D[{1.86 Cos[t], 1.86 Sin[t], -2.79}, {t, 0, 2 Pi},
  36. Boxed -> False, Axes -> False, PlotStyle -> {Yellow},
  37. Method -> {"TubePoints" -> 2}] /.
  38. Line[pts_, rest___] :> Tube[pts, 0.02, rest],
  39. Plot3D[5 x + 2 y + 8, {x, -9, 9}, {y, -9, 9},
  40. RegionFunction ->
  41. Function[{x, y, z},
  42. z <= 21.1 - u && z >= 6.9 - u && distance[{m1, m2}, {x, y, z}] <= 6],
  43. PlotStyle ->
  44. Directive[Opacity[.55], Specularity[White, 100], RGBColor[1, 0, 0]],
  45. BoundaryStyle -> {Thickness[0.003], Yellow}, Mesh -> False, Boxed -> False,
  46. Axes -> False, PlotPoints -> 200],
  47. Graphics3D[{Opacity[.6], Specularity[White, 200], RGBColor[0, 0, 1/2],
  48. EdgeForm[{Thickness[0.003], Yellow}],
  49. Cone[{{0, 0, -7}, {0, 0, 0}}, 4*7/6]}, Boxed -> False],
  50. Graphics3D[{Opacity[.6], Specularity[White, 200], RGBColor[0, 0, 1/2],
  51. EdgeForm[{Thickness[0.003], Yellow}],
  52. Cone[{{0, 0, 7}, {0, 0, 0}}, 4*7/6]}], ImageSize -> {2000, 2000},
  53. Lighting -> {{"Point", White, {10, 0, 0}}, {"Point",
  54. White, {-10, 0, 0}}, {"Point", White, {0, 0, 0}}, {"Point",
  55. White, {0, 0, 10}}, {"Point", White, {0, 0, -10}}}, Background -> Black,
  56. ViewVector -> {{20 Sin[1.15 Pi + u], 20 Cos[1.15 Pi + u], 10}, {0, 0, 0}},
  57. ViewAngle -> 50 [Degree]], {u, -3, 14, .05}]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement