在 3D 三角图中标记角度

在 3D 三角图中标记角度

我正在尝试使用 TikZ 绘制下面的图表。

在此处输入图片描述

到目前为止,我的尝试如下。我的尝试似乎很复杂,因为它是二维和三维坐标的混合。我试图标记和标记2035度数。

\documentclass{article}
\usepackage{tikz,tikz-3dplot}
\tdplotsetmaincoords{70}{120}
\usepackage{tkz-euclide}

\begin{document}
\begin{tikzpicture}[scale=2, tdplot_main_coords,axis/.style={},thick]

  \draw[axis] (-2, 0, 0)node [right]{North} -- (4, 0, 0) node [left] {$P$};
  \draw[axis] (0, -1, 0)node[above right]{West} -- (0, 4, 0) node [above] {$Q$};
  \draw[axis] (0, 0, 0)node[above left]{$A$} -- (0, 0, 2) node [above] {$B$};

% define points
  \coordinate  (d1) at (0,0,0){};
  \tkzDefPoint(0,0){A}
  \tkzDefPoint(2,0){P}
  \tkzDefPoint(0,4){Q}
  \coordinate  (d2) at (4,0,0){};
  \coordinate  (d4) at (0,4,0){};
  \coordinate  (d5) at (0,3.5){};
  \coordinate  (d9) at (0,0,2){};

% connect lines
  \draw [] (d1)--(d2)--(d4)node[below,midway]{$400$ m} -- (d1);
  \draw [] (d2) --(d9)-- (d4);

% right-angle mark done here
  \tkzMarkRightAngle[size=0.25](d2,d1,d4)

% label and mark angles
  \tkzLabelAngle[pos = 0.2](d9,P,A){$20^{\circ}$}

  \tkzLabelAngle[](A,Q,d9){$35^{\circ}$}

\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

一种可能性是使用 TiZ3d库和canvas is...选项。还有一个剪辑。

在我的示例中,我也做了一些清理。有些点被定义了两次,有些线也被画了两次。我只用 Ti 就完成了这一切。Z 包(以及siunitx单位/角度)。

例如:

\documentclass[tikz,border=2mm]{standalone}
\usepackage{siunitx}
\usetikzlibrary{3d,perspective}

\begin{document}
\begin{tikzpicture}[scale=2,line cap=round,line join=round, 3d view={120}{20},thick]
% define points
\coordinate  (A) at (0,0,0);
\coordinate  (B) at (0,0,2);
\coordinate  (P) at (4,0,0);
\coordinate  (Q) at (0,4,0);
% axis
\draw (-2,0,0) node[right]       {North} -- (P) node [left]  {$P$};
\draw (0,-1,0) node[above right] {West}  -- (Q) node [right] {$Q$};
\draw (A)      node[above left]  {$A$}   -- (B) node [above] {$B$};
% connect line
\draw (P) -- (Q) node[below,midway] {\qty{400}{m}} -- (B) -- cycle;
% angles
\draw[canvas is xy plane at z=0] (0.25,0) |- (0,0.25);
\node[xshift= 2mm,yshift=8mm] at (P) {\ang{20}};
\node[xshift=-4mm,yshift=8mm] at (Q) {\ang{35}};
\clip (A) -- (P) -- (B) -- (Q) -- cycle;
\draw[canvas is xz plane at y=0] (P) circle (0.5);
\draw[canvas is yz plane at x=0] (Q) circle (0.5);
\end{tikzpicture}
\end{document}

在此处输入图片描述

编辑:另一个选项,更加可定制:

\documentclass[tikz,border=2mm]{standalone}
\usepackage{siunitx}
\usetikzlibrary{3d,perspective}

\begin{document}
\begin{tikzpicture}[scale=2,line cap=round,line join=round, 3d view={120}{20},thick]
% define points
\def\zb{2}
\def\angp{20}
\def\angq{35}
\pgfmathsetmacro\xp{\zb/tan(\angp)}
\pgfmathsetmacro\yq{\zb/tan(\angq)}
\coordinate (A) at (0,0,0);
\coordinate (B) at (0,0,\zb);
\coordinate (P) at (\xp,0,0);
\coordinate (Q) at (0,\yq,0);
% axis
\draw (-2,0,0) node[above left]  {North} -- (P) node [left]  {$P$};
\draw (0,-1,0) node[above right] {West}  -- (Q) node [right] {$Q$};
\draw (A)      node[above left]  {$A$}   -- (B) node [above] {$B$};
% connect line
\draw (P) -- (Q) node[below,midway,sloped] {\qty{400}{m}} -- (B) -- cycle;
% angles
\draw[canvas is xy plane at z=0] (0.25,0) |- (0,0.25);
\draw[canvas is xz plane at y=0] (P) ++ (-0.5,0) arc (180:180-\angp:0.5) node[yshift=4mm] {\ang{\angp}};
\draw[canvas is yz plane at x=0] (Q) ++ (-0.5,0) arc (180:180-\angq:0.5) node[yshift=4mm] {\ang{\angq}};
\end{tikzpicture}
\end{document}

输出几乎相同,角度的比例更为均衡。

答案2

解决正四面体
四面体是 3D 的,因此继续使用 Asymptote 以 3D 形式绘图。

在此处输入图片描述

我看到了一款非常棒的通过在线编译器使用 Asymptote 进行教学的工具渐近线.ualberta.ca:可自由使用鼠标旋转改变图形的视点;并显示计算结果,本例中为AB = 4.17177757239393AP = 1.51840286033071AQ = 2.92111010392443

在此处输入图片描述

AB这里利用三角形中的勾股定理,给出的公式APQ,即AP^2 + AQ^2 = PQ^2 = 40^2

在此处输入图片描述

完整代码

// Run on http://asymptote.ualberta.ca/
unitsize(1cm);
size(9cm);
import three;
//3d view={120}{20}
//triple V=dir(120,20);
currentprojection=orthographic(3,2,1.5,center=true,zoom=.95);
//currentprojection=perspective(V,center=true,zoom=.8);
real t=1/((Tan(20))^2)+1/((Tan(35))^2);
real z=40/sqrt(t);  
write("AB = ",z);      // the value of z = AB
triple A=O, B=(0,0,z);
triple P=(z/Tan(20),0,0); 
triple Q=(0,z/Tan(35),0);
write("AP = ",P.x);  // the value of AP
write("AQ = ",Q.y);  // the value of AQ
pen p=magenta;
draw(B--P^^B--Q^^Q--(-5Y)^^P--(-5X));
draw(Label("$40$ m",p,align=S),P--Q);
draw(Label("$z$",p,align=E),A--B);
label("West",align=W,-5Y,p);
label("North",align=NE,-5X,p);

label("$A$",align=W+1.2N,A,p);
label("$B$",align=N,B,p);
label("$P$",align=W,P,p);
label("$Q$",align=E,Q,p);

// angles in 3D: right and acute
path3 ra=X--X+Y--Y;
draw(scale3(2)*ra,p);

draw(scale(.8)*"$20^{\circ}$",align=E,arc(P,P+.4(A-P),B),blue,Arrow3);
draw(scale(.8)*"$35^{\circ}$",align=NW,arc(Q,Q+.2(A-Q),B),blue,Arrow3);

答案3

对 Juan Castano 回答的一些更正:

\documentclass[tikz,border=2mm]{standalone}
\usepackage{siunitx}
\usetikzlibrary{3d,perspective}

\begin{document}
    \begin{tikzpicture}[scale=2,line cap=round,line join=round, 3d view={120}{20},thick]
        % define points
        \coordinate  (A) at (0,0,0);
        \coordinate  (B) at (0,0,2);
        \coordinate  (P) at (4,0,0);
        \coordinate  (Q) at (0,4,0);
        % axis
        \draw (-2,0,0) node[right]       {North} -- (P) node [left] {$P$};
        \draw (0,-1,0) node[above right] {West}  -- (Q) node [right] {$Q$};
        \draw (A)      node[above left]  {$A$}   -- (B) node [above] {$B$};
        % connect line
        \draw (P) -- (Q) node[below,midway] {\qty{400}{m}} -- (B) -- cycle;
        % anggles
        \draw[canvas is xy plane at z=0] (0.25,0) |- (0,0.25);
        \node[xshift= 9mm,yshift=8mm] at (P) {\ang{20}};
        \node[xshift=-11mm,yshift=5mm] at (Q) {\ang{35}};
        \clip (A) -- (P) -- (B) -- (Q) -- cycle;
        \draw[canvas is xz plane at y=0] (P) circle (0.5);
        \draw[canvas is yz plane at x=0] (Q) circle (0.5);
    \end{tikzpicture}
\end{document}

输出:

在此处输入图片描述

笔记: 无论如何你不能分别为 20° 和 35°。这两个角度必须具有相同的价值!

相关内容