如何使用TiKz重绘经典透视示意图并优化绘图代码
TiKz透视结构示意图复现问题
参考目标效果

现有实现代码
\documentclass[tikz]{standalone} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture} \node[anchor = south west, inner sep = 0, minimum width = 1170 pt, minimum height = 500 pt] (image) at (0, 0) {}; \begin{scope}[x = {(image.south east)}, y = {(image.north west)}] % \clip (0, 0) rectangle(1, 1); \coordinate (C) at (0.33, 1.05); \coordinate (R) at (1.6, 1.05); \coordinate (L) at (0.33 - 1.27, 1.05); \coordinate (P1) at (8 * 0.09, 0.07); \coordinate (P2) at (0.03 + 8 * 0.09, 0.07); \coordinate (P3) at (8 * 0.09, 0.9) node [above] {p3}; \coordinate (P4) at (0.03 + 8 * 0.09, 0.9) node {p4}; \draw [dashed, blue, name path = P3C] (P3) -- (C); \draw [dashed, blue] (P4) -- (C); \draw (L) -- (R); \foreach \x in {0, 0.09, ..., 1} { \draw [dashed, blue] (\x, 0.07) -- (C); \draw [dashed, violet] (\x, 0.07) -- (R); \draw [dashed, red] (\x, 0.07) -- (L); } \draw [name path = L1] (0, 0.2871) -- (1, 0.2871); \draw [name path = L2] (0, 0.19) -- (1, 0.19); \path [name path = P1C] (P1) -- (C); \coordinate [name intersections = {of = P1C and L1, by = P1a}]; \draw [orange, thick] (P1) -- (P1a); \path [name path = P1aV] (C) -| (P1a); \coordinate [name intersections = {of = P1aV and P3C, by = P13}]; \draw [orange, thick] (P13) circle (3 pt); \filldraw [gray] (0, 0) rectangle (11 * 0.09, 0.07); \filldraw [gray] (P1) rectangle (0.03 + 8 * 0.09, 0.9); \draw [red, fill] (P1) circle (2 pt); \draw [violet, fill] (P1a) circle (2 pt); \draw [green, fill] (P2) circle (2 pt); \draw [blue, fill] (P3) circle (2 pt); \draw [orange, fill] (P4) circle (2 pt); \end{scope} \end{tikzpicture} \end{document}
待解决问题
- 路径交点计算的细节处理存在阻碍,需要代码精简优化的实现思路
- 需要八边形板及其透视投影的绘制指导
当前代码运行效果

内容的提问来源于stack exchange,提问作者mk9y
相关产品推荐
相关产品推荐

