Guest User

Untitled

a guest
Nov 17th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. documentclass[tikz,border=3.14mm]{standalone}
  2. usepackage{tikz-3dplot}
  3. usetikzlibrary{3d,shapes.geometric,shadows.blur}
  4. % small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
  5. makeatletter
  6. tikzoption{canvas is xy plane at z}[]{%
  7. deftikz@plane@origin{pgfpointxyz{0}{0}{#1}}%
  8. deftikz@plane@x{pgfpointxyz{1}{0}{#1}}%
  9. deftikz@plane@y{pgfpointxyz{0}{1}{#1}}%
  10. tikz@canvas@is@plane}
  11. makeatother
  12. pgfmathsetmacro{rvec}{4}
  13. pgfmathsetmacro{thetavec}{30}
  14. pgfmathsetmacro{phivec}{60}
  15. begin{document}
  16. tdplotsetmaincoords{60}{130}
  17. begin{tikzpicture}[tdplot_main_coords,>=latex,line join=bevel]
  18. coordinate (O) at (0,0,0);
  19. draw[thick,->] (O) -- (5,0,0) node[anchor=north east]{$x$};
  20. draw[thick,->] (O) -- (0,5,0) node[anchor=north west]{$y$};
  21. draw[thick,->] (O) -- (0,0,5) node[anchor=south]{$z$};
  22. draw[dashed] (O) -- (-5,0,0);
  23. begin{scope}[canvas is yz plane at x=5,transform shape]
  24. node[ellipse,fill=blue,fill opacity=0.7,draw,minimum width=2cm,minimum height=8mm,
  25. rotate=65] (elliL) at (2,2) {};
  26. path (elliL.west) -- (elliL.east) coordinate[pos=0.1] (L1b)
  27. coordinate[pos=0.3] (L1t) coordinate[pos=0.4] (L2b)
  28. coordinate[pos=0.6] (L2t) coordinate[pos=0.7] (L3b)
  29. coordinate[pos=0.9] (L3t);
  30. foreach X in {1,2,3}
  31. {draw[thick,-latex] (LX b) -- (LX t);}
  32. coordinate (L) at (2,0);
  33. end{scope}
  34. begin{scope}[canvas is yz plane at x=-1,transform shape]
  35. node[ellipse,fill=blue,fill opacity=0.7,draw,minimum width=2cm,minimum height=8mm,
  36. rotate=80] (elliR) at (2,2) {};
  37. path (elliR.west) -- (elliR.east) coordinate[pos=0.1] (R1b)
  38. coordinate[pos=0.3] (R1t) coordinate[pos=0.4] (R2b)
  39. coordinate[pos=0.6] (R2t) coordinate[pos=0.7] (R3b)
  40. coordinate[pos=0.9] (R3t);
  41. foreach X in {1,2,3}
  42. {draw[thick,-latex] (RX b) -- (RX t);}
  43. coordinate (R) at (2,0);
  44. end{scope}
  45. %
  46. tdplotsetcoord{P}{rvec}{thetavec}{phivec}
  47. node[anchor=south west,color=red] at (P) {$P$};
  48. draw[-stealth,color=red] (O) -- (P);
  49. draw[dashed, color=red] (O) -- (Pxy);
  50. draw[dashed, color=red] (P) -- (Pxy);
  51. tdplotdrawarc{(O)}{1}{0}{phivec}{anchor=north}{$phi$}
  52. tdplotsetthetaplanecoords{phivec}
  53. tdplotdrawarc[tdplot_rotated_coords]{(0,0,0)}{1.5}{0}%
  54. {thetavec}{anchor=-110}{$theta$}
  55. %
  56. pgflowlevelsynccm
  57. draw[ultra thick,blue!70,latex-latex] (L) -- (R) node[midway,below] {$d$};
  58. end{tikzpicture}
  59. end{document}
Add Comment
Please, Sign In to add comment