Forgot password?
 Create new account
View 1355|Reply 0

Tikz绘制三维图形

[Copy link]

462

Threads

969

Posts

9934

Credits

Credits
9934

Show all posts

青青子衿 Posted at 2020-9-3 21:03:38 |Read mode
  1. \documentclass[tikz,border=5pt]{standalone}
  2. \usetikzlibrary{calc}
  3. \usetikzlibrary{arrows.meta}
  4. \usepackage{tikz-3dplot}
  5. \begin{document}
  6. \tdplotsetmaincoords{70}{110}
  7. \begin{tikzpicture}[>=latex,scale=2,tdplot_main_coords]
  8. \pgfmathsetmacro{\x}{1.4}
  9. \pgfmathsetmacro{\y}{1.2}
  10. \pgfmathsetmacro{\z}{1.2}
  11. \path
  12. (\x,0,0) coordinate (A) (\x,\y,0) coordinate (B) (0,\y,0) coordinate (C) (0,0,0) coordinate (D)
  13. (\x,0,\z) coordinate (E) (\x,\y,\z) coordinate (F) (0,\y,\z) coordinate (G) (0,0,\z) coordinate (H)
  14. (2.5*\x,0,0) coordinate (I) (2.5*\x,\y,0) coordinate (J)
  15. (\x,2.5*\y,0) coordinate (K) (0,2.5*\y,0) coordinate (L)
  16. (2.5*\x,2.5*\y,0) coordinate (M);
  17. \draw[canvas is xy plane at z = 0, transform shape, draw = red, fill = red!50, opacity = 0.5] (B) rectangle (D);
  18. \node[canvas is xy plane at z = 0] at (0.5*\x,0.5*\y,0) {\rotatebox[origin=c]{90}{$\Omega_0$}};
  19. \draw[canvas is xy plane at z = 0, transform shape, dashed, draw = blue, fill = blue!50, opacity = 0.5] (J) rectangle (A);
  20. \node[canvas is xy plane at z = 0] at (1.75*\x,0.5*\y,0) {\rotatebox[origin=c]{90}{$\Omega_1$}};
  21. \draw[canvas is xy plane at z = 0, transform shape, dashed, draw = yellow, fill = yellow!50, opacity = 0.5] (B) rectangle (M);
  22. \node[canvas is xy plane at z = 0] at (1.75*\x,1.75*\y,0) {\rotatebox[origin=c]{90}{$\Omega_2$}};
  23. \draw[thin,Stealth-Stealth]($(A)+(0,25pt)$) -- node[above,sloped]{$\tiny{a}$}($(B)+(0,26pt)$);
  24. \draw[thin,Stealth-Stealth] ($(B)+(0,26pt)$) -- node[above,sloped]{$\tiny{a}$}($(C)+(0,25pt)$);
  25. \draw (A)--(B)--(C)--(D)--(A);
  26. \draw (A)--(E) (B)--(F) (C)--(G);
  27. \draw (A)--(I) (B)--(J) (B)--(K) (C)--(L);
  28. \draw [densely dashed] (D)--(H);
  29. \end{tikzpicture}
  30. \end{document}
Copy the Code
252403210042.png

手机版Mobile version|Leisure Math Forum

2025-4-20 22:18 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list