找回密码
 快速注册
搜索
查看: 1246|回复: 0

Tikz绘制三维图形

[复制链接]

471

主题

945

回帖

9837

积分

积分
9837

显示全部楼层

青青子衿 发表于 2020-9-3 21:03 |阅读模式
  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}
复制代码
252403210042.png

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 12:02

Powered by Discuz!

× 快速回复 返回顶部 返回列表