因此,我是 TeX 的新手,我需要绘制一些类似这样的图:
我尝试做的是:
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{perspective}
\begin{document}
\begin{tikzpicture}[3d view={140}{20},>=stealth,
line join=round,semithick,dot/.style={circle,fill,inner sep=1pt},
declare function={xmax=9;ymax=10;zmax=8;}]
\draw[->] (tpp cs:x=0,y=0,z=0) coordinate (O)
-- (tpp cs:x=xmax,y=0,z=0) coordinate[label=left:$x$] (X);
\draw[->] (O) -- (tpp cs:x=0,y=ymax,z=0) coordinate[label=above:$y$] (Y);
\draw[->] (O) -- (tpp cs:x=0,y=0,z=zmax) coordinate[label=above right:$z$] (Z);
\path (tpp cs:x=2,y=-sqrt(3),z=3) coordinate[dot,label=above:$A$](A)
(tpp cs:x=6,y=-sqrt(3),z=3) coordinate[dot,label=left:$B$](B)
(tpp cs:x=8,y=0,z=0) coordinate[dot,label=left:$C$](C)
(tpp cs:x=6,y=-sqrt(3),z=-3) coordinate[dot,label=below:$D$](D)
(tpp cs:x=2,y=sqrt(3),z=-3) coordinate[dot,label=right:$E$](E)
(tpp cs:x=0,y=4*sqrt(3),z=4) coordinate[dot,label=right:$F$](F)
(tpp cs:x=2,y=3*sqrt(3),z=7) coordinate[dot,label=right:$G$](G)
(tpp cs:x=6,y=3*sqrt(3),z=7) coordinate[dot,label=below:$H$](H)
(tpp cs:x=8,y=4*sqrt(3),z=4) coordinate[dot,label=right:$I$](I)
(tpp cs:x=6,y=5*sqrt(3),z=1) coordinate[dot,label=below:$J$](J)
(tpp cs:x=2,y=5*sqrt(3),z=1) coordinate[dot,label=right:$K$](K);
\draw (A) edge (B) -- (B) edge (C) -- (C) edge (D) -- (D) edge[dashed] (E)
-- (E) edge[dashed] (O) -- (A) edge (G) -- (B) edge (H) -- (C) edge (I) -- (D) edge (J) -- (E) edge[dashed] (K) -- (O) edge[dashed] (F) -- (G) edge (F) -- (F) edge (K) -- (K) edge (J) -- (J) edge (I) -- (I) edge (H) -- (H) edge (G) --;
\end{tikzpicture}
\end{document}
然而,有些事情是错误的(我真的不知道它是什么),因为出现了这个错误信息:
(pastebin,因为错误太大)
所以我想问你们是否有人能帮我...我想要一些类似于手绘平面的线条(这就是我尝试的)和 r 线,但我不知道该怎么做。我希望它能穿过实体,并从实体中完全消失。
无论如何,提前感谢你的帮助,抱歉我的英语不是母语!祝一切顺利!
答案1
因此,经过(大量)反复试验后,我终于做到了我想做的事,也许不是最好的方式,但它有效,所以......这对我来说足够了。
如果有人感兴趣的话我会把它留在这里:
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{perspective}
\begin{document}
\begin{tikzpicture}[3d view={155}{16},>=stealth,
line join=round,line width=2pt,dot/.style={circle,fill,inner sep=2pt},
declare function={xmax=12;ymax=12;zmax=8;kmax=1.73205;}]
\path (tpp cs:x=0,y=0,z=0) coordinate[dot](O)
(tpp cs:x=2,y=-1.73205,z=3) coordinate[dot](A)
(tpp cs:x=6,y=-1.73205,z=3) coordinate[dot](B)
(tpp cs:x=8,y=0,z=0) coordinate[dot](C)
(tpp cs:x=6,y=1.73205,z=-3) coordinate[dot](D)
(tpp cs:x=2,y=1.73205,z=-3) coordinate[dot](E)
(tpp cs:x=0,y=6.9282,z=4) coordinate[dot](F)
(tpp cs:x=2,y=5.19615,z=7) coordinate[dot](G)
(tpp cs:x=6,y= 5.19615,z=7) coordinate[dot](H)
(tpp cs:x=8,y=6.9282,z=4) coordinate[dot](I)
(tpp cs:x=6,y=8.660254,z=1) coordinate[dot](J)
(tpp cs:x=2,y=8.660254,z=1) coordinate[dot](K)
(tpp cs:x=0,y=4.5755,z=0) coordinate(M)
(tpp cs:x=0,y=0,z=5.372) coordinate(N)
(tpp cs:x=4,y=-3.58*kmax,z=-3.58) coordinate(S)
(tpp cs:x=4,y=6.9282,z=4) coordinate(P)
(tpp cs:x=4,y=10*kmax,z=10) coordinate(Q)
(tpp cs:x=4,y=-6*kmax,z=-6) coordinate(R);
\draw (S) edge[dashed] (P);
\draw (P) edge (Q);
\draw (S) edge (R);
\draw (O) edge[dashed] (C);
\draw (C) edge (tpp cs:x=xmax,y=0,z=0) coordinate (X);
\draw (O) edge[dashed] (M);
\draw (M) edge (tpp cs:x=0,y=ymax,z=0) coordinate (Y);
\draw (O) edge[dashed] (N);
\draw (N) edge (tpp cs:x=0,y=0,z=zmax) coordinate (Z);
\draw (E) edge[dashed] (O);
\draw (F) edge[dashed] (O);
\draw (A) edge[dashed] (O);
\draw (A) edge[dashed] (G);
\draw (A) edge[dashed] (B);
\draw (J) edge (I);
\draw (H) edge (I);
\draw (G) edge (H);
\draw (C) edge (I);
\draw (E) edge (K);
\draw (J) edge (K);
\draw (F) edge (K);
\draw (B) edge (C);
\draw (D) edge (C);
\draw (D) edge (E);
\draw (D) edge (J);
\draw (B) edge (H);
\draw (G) edge (F);
\end{tikzpicture}
\end{document}
最终结果如下: