答案1
答案是不需要。只需加载3d
库并让 Ti钾Z 为您计算“倾斜度”。关键要素包括canvas is <plane> plane at x=<x0>
和 transform shape
在
\begin{scope}[canvas is zy plane at x=0,transform shape]
\draw ({4*cos(30)-cos(15)},{sin(15)}) node[right,xscale=-1,font=\large]{$30^\circ$};
\end{scope}
这将为您完成投影。您可以设置 3D 坐标系,也可以不设置。如果没有,Ti钾Z 将采用默认值z=(-0.5,-0.5)
。您的图片看起来有点像使用这些默认值,但由于这些是投影,所以谁也不知道。
(编辑:使用 添加了“倾斜”箭头\pgflowlevelsynccm
。第二次编辑:现在我想我明白了你说的倾斜直角符号是什么意思。我的错!第三次编辑:添加了解释并对动画做了微小的修正。)
\documentclass[margin=3.14mm,tikz]{standalone}
\usetikzlibrary{3d,arrows.meta}
\tikzset{bullet/.style={circle,fill,scale=0.4}}
\begin{document}
\begin{tikzpicture}[z={({-cos(45)*1cm},{-sin(45)*1cm})},x={(1cm,0cm)}, y={(0cm,1cm)}]
\draw (-2,0,0) -- (5,0,0);
\draw (0.4,0,0) -- (0.4,0,0.4) -- (0,0,0.4);
\draw (0,0,0) node[bullet,label={above left:$P$}] (P){} -- (0,1,0);
\draw (0,{4*sin(30)},0) node[bullet,label={right:$T$}] (T){};
\begin{scope}[canvas is zy plane at x=0,transform shape]
\draw (0,0) -- (6,0);
\draw plot[variable=\x,domain=0:30] ({4*cos(30)-cos(\x)},{sin(\x)});
\draw ({4*cos(30)-cos(15)},{sin(15)}) node[right,xscale=-1,font=\large]{$30^\circ$};
\end{scope}
\begin{scope}[canvas is xz plane at y=0]
\pgflowlevelsynccm
\draw[-{Stealth[length=12pt,width=8pt,inset=3pt]},line width=1mm] (0,-1) -- (0,-2);
\end{scope}
\node[font=\large\sffamily] at (0,0.2,-2) {N};
\draw (0,0,{4*cos(30)}) node[bullet,label={below:$B$}] (B){};
\draw (B) -- (T) -- (P);
\node[bullet,label=above right:$L$] (L) at (4,0,0){};
\draw (L) -- (3,0,6);
\draw[{Triangle[]}-{Triangle[].Bar[]},dashed] ([yshift=9pt]P.center) -- ([yshift=9pt]L.center)
node[midway,fill=white]{1 km};
\end{tikzpicture}
\end{document}
这种方法的优点是,它可以对任何视角进行正确的倾斜。(人们只需稍微注意一下方向,这就是为什么\mysign
在工作中有一些技巧。)
\documentclass[margin=3.14mm,tikz]{standalone}
\usetikzlibrary{3d,arrows.meta}
\tikzset{bullet/.style={circle,fill,scale=0.4}}
\begin{document}
\foreach \X in {0,5,...,355}
{\begin{tikzpicture}[z={({-cos(\X)*1cm},{-0.45*sin(\X)*1cm})},x={(1cm,0cm)}, y={(0cm,1cm)}]
\path[use as bounding box] (-6,-5) rectangle (6,5);
\draw (-2,0,0) -- (5,0,0);
\draw (0.4,0,0) -- (0.4,0,0.4) -- (0,0,0.4);
\draw (0,0,0) node[bullet,label={above left:$P$}] (P){} -- (0,1,0);
\draw (0,{4*sin(30)},0) node[bullet,label={right:$T$}] (T){};
\node[bullet,label=above right:$L$] (L) at (4,0,0){};
\draw (L) -- (3,0,6);
\draw[{Triangle[]}-{Triangle[].Bar[]},dashed] ([yshift=9pt]P.center) -- ([yshift=9pt]L.center)
node[midway,fill=white]{1 km};
\begin{scope}[canvas is zy plane at x=0,transform shape]
\draw (0,0) -- (6,0);
\draw plot[variable=\x,domain=0:30] ({4*cos(30)-cos(\x)},{sin(\x)});
\pgfmathtruncatemacro{\mysign}{sign(-cos(\X))}
\ifnum\mysign=1
\draw ({4*cos(30)-cos(15)},{sin(15)}) node[left]{$30^\circ$};
\else
\draw ({4*cos(30)-cos(15)},{sin(15)}) node[xscale={-1},right]{$30^\circ$};
\fi
\end{scope}
\begin{scope}[canvas is xz plane at y=0]
\pgflowlevelsynccm
\draw[-{Stealth[length=12pt,width=8pt,inset=3pt]},line width=1mm] (0,-1) -- (0,-2);
\end{scope}
\node[font=\large\sffamily] at (0,0.2,-2) {N};
\draw (0,0,{4*cos(30)}) node[bullet,label={below:$B$}] (B){};
\draw (B) -- (T) -- (P);
\end{tikzpicture}}
\end{document}