三维空间中的角度

三维空间中的角度

我想使用 自动在三维空间中标记三角形的各个角度\tdplotdrawpolytopearc

我尝试过类似的事情:

\documentclass{article}

\usepackage{tikz}

\usepackage{tikz-3dplot}


\begin{document}

\tdplotsetmaincoords{80}{110}

\begin{tikzpicture}[tdplot_main_coords,>=stealth']

\coordinate (A) at (3,1,1);

\coordinate (B) at (8,7,1);

\coordinate (C) at (3,6,3);

\draw[-] (A) -- (B) -- (C) -- cycle;

\tdplotdefinepoints(C)(A)(B);
\tdplotdrawpolytopearc[thick]{0.6}{}{$\alpha$}

\tdplotdefinepoints(A)(B)(C);
\tdplotdrawpolytopearc[thick]{0.6}{}{$\beta$}

\tdplotdefinepoints(B)(C)(A);
\tdplotdrawpolytopearc[thick]{0.6}{}{$\gamma$}

\end{tikzpicture}

\end{document}

但该命令\tdplotdefinepoints(B)(A)(C);不起作用。

它仅在顶点被明确描述时才有效,例如

\tdplotdefinepoints(8,7,1)(3,6,3)(3,1,1);

在飞机上,我没有遇到任何问题。看看这个解决方案

有人可以提供一些帮助吗?


这将会有很大帮助。

但现在我又遇到了一个问题。在我的例子中,一个点是根据其他点计算出来的。例如,我们可以取$M$, $0.5*(B) + 0.5*(C)$边 BC 上的中点。如何标记边 AC 和 AM 之间的角度?

就像是

\ptdedef\temp{\noexpand\tdplotdefinepoints(\ptC)(\ptB)($0.5*(A)+0.5*(B)$);} \temp

不工作。

答案1

我认为答案是:不可能。\tdplotdefinepoints需要三个坐标x, y and z

\def\tdplotdefinepoints(#1,#2,#3)(#4,#5,#6)(#7,#8,#9){%
  \pgfmathsetmacro{\tdplotvertexx}{#1}
  \pgfmathsetmacro{\tdplotvertexy}{#2}
  \pgfmathsetmacro{\tdplotvertexz}{#3}  \pgfmathsetmacro{\tdplotax}{#4}
  \pgfmathsetmacro{\tdplotay}{#5}  \pgfmathsetmacro{\tdplotaz}{#6}
  \pgfmathsetmacro{\tdplotbx}{#7}  \pgfmathsetmacro{\tdplotby}{#8}
  \pgfmathsetmacro{\tdplotbz}{#9}
}

TikZ 将节点 A 保存在二维中,而平面上的两个点在三维中可能有不同的坐标。

解决方法

\documentclass{article}

\usepackage{tikz}

\usepackage{tikz-3dplot} 
\makeatletter 
\let\ptdedef\protected@edef
 
\begin{document}

\tdplotsetmaincoords{80}{110}

\begin{tikzpicture}[tdplot_main_coords,>=stealth']

\def\ptA{3,1,1}   
\def\ptB{8,7,1}
\def\ptC{3,6,3}

\coordinate (A) at (3,1,1);
\coordinate (B) at (8,7,1);
\coordinate (C) at (3,6,3);

\draw[-] (A) -- (B) -- (C) -- cycle;

 \ptdedef\temp{\noexpand\tdplotdefinepoints(\ptC)(\ptA)(\ptB);} \temp
\tdplotdrawpolytopearc[thick]{1}{below}{$\alpha$}

 \ptdedef\temp{\noexpand\tdplotdefinepoints(\ptA)(\ptC)(\ptB);} \temp   
 \tdplotdrawpolytopearc[thick]{1}{right}{$\beta$}

 \ptdedef\temp{\noexpand\tdplotdefinepoints(\ptB)(\ptC)(\ptA);} \temp   
 \tdplotdrawpolytopearc[thick]{1}{above left}{$\gamma$} 

\end{tikzpicture}

\end{document}  

在此处输入图片描述

去做

一个好主意是定义一个宏,\tdplotdefinepoints*例如,使用宏(\ptA,等等)。

另一个想法是创建一个宏来定义坐标 A,B 等,同时\ptA等等。

答案2

我们可以画一个角的标记,考虑整个圆,然后与三角形相交。我还写了一个小宏来画直角。

如果不使用命令\tdplotdefinepoints,我们就有更大的自由。

%---------------------------------------------------------------------
\documentclass[]{article}
\usepackage{tikz,calc}
\usepackage{tikz-3dplot}

%------ Macro to draw right angles --------------------------------------------
%--- parameters (A,B,C,t,s):
%--- A, B, C are points in the space, and t and s are numbers between 0 and 1.
%--- t is the fraction of the segment AB, and s is the fraction of the segment BC used to build the right angle at the angle ABC.
%------------------------------------------------------------------------------

\newcommand\drawrightangle[5]{
  \draw[-] ($#2 - #4*#2 + #4*#1$)  -- ($#2 - #4*#2 + #4*#1 - #5*#2 + #5*#3$) -- ($#2 - #5*#2 + #5*#3$);
}

\begin{document}

\tdplotsetmaincoords{80}{110}

\begin{tikzpicture}[tdplot_main_coords,>=stealth']

\coordinate (A) at (6,0,3);
\coordinate (B) at (6,0,0);
\coordinate (C) at (4,4,0);

\draw[-] (A) node[above] {A} -- (B) node[below] {B} -- (C) node[below] {C} -- cycle;

\drawrightangle{(A)}{(B)}{(C)}{0.14}{0.1};

\begin{scope}
    \clip (A) -- (B) -- (C) -- cycle;
    \draw[-] circle[at=(C),radius=7mm];  
\end{scope}

\begin{scope}
    \clip (A) -- (B) -- (C) -- cycle;
    \draw[-] circle[at=(C),radius=8mm];  
\end{scope}

\begin{scope}
    \clip (A) -- (B) -- (C) -- cycle;
    \draw[-] circle[at=(A),radius=5mm];  
\end{scope}

\end{tikzpicture}

\end{document}

答案3

@Joseph Wright @Alain Mattheus

我修改了旧代码。现在它允许在“calc”的帮助下计算点数。

\documentclass{report}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\centerline{
\begin{tikzpicture}
    \coordinate (A) at (0,0);
    \coordinate (B) at (4,0);
    \coordinate (C) at (3,2);
    %--------------------
    \begin{scope}
        \clip (A) -- ($(B)!0.5!(C)$) -- (B) -- cycle;
        \draw[fill=blue] ($(B)!0.5!(C)$) circle (0.3cm);
   \end{scope}
    %----------------
    \begin{scope}
         \clip (A) -- (C) -- (B) -- cycle;
         \draw[fill=red] (C) circle (0.25cm);
    \end{scope}
    %----------------
    \draw[-] (A) node[left] {$A$} -- (B) node[right] {$B$} -- (C) node[above] {$C$} -- cycle;
    \draw[-] (A) -- ($(B)!0.5!(C)$) node[right] {$M$};
    %-------------------------------------------------------
    %-------------------------------------------------------
    \coordinate (P) at (6,-1);
    \coordinate (Q) at (9,1);
    \coordinate (R) at (7,2);
    %--------------------
    \begin{scope}
         \clip ($(P)!0.5!(R)$) -- ($(P)!0.5!(Q)$) -- ($(Q)!0.5!(R)$) -- cycle;
         \draw[fill=green] ($(P)!0.5!(Q)$) circle (0.3cm);
    \end{scope}
    %----------------
    \begin{scope}
      \clip (P) -- (R) -- (Q) -- cycle;
      \draw[fill=yellow] (R) circle (0.25cm);
   \end{scope}
    %----------------
    \draw[-] (P) node[left] {$P$} -- (Q) node[right] {$Q$} -- (R) node[above] {$R$} -- cycle;
    \draw[-] ($(P)!0.5!(R)$) -- ($(P)!0.5!(Q)$) -- ($(Q)!0.5!(R)$) -- cycle;
    %-------------------------------------------------------
    %-------------------------------------------------------
   \draw[] (5,-4) circle (2cm);
    %----------------
    \begin{scope}
      \clip ($(5,-4)+(240:2)$) -- (5,-4) -- ($(5,-4)+(-45:2)$) -- cycle;
      \draw[-] (5,-4) circle (0.25cm) node[below,xshift=1pt,yshift=-6pt] {$2\alpha$}; 
   \end{scope}
    %----------------
    \begin{scope}
       \clip ($(5,-4)+(240:2)$) -- ($(5,-4)+(100:2)$) -- ($(5,-4)+(-45:2)$) -- cycle;
       \draw[-] ($(5,-4)+(100:2)$) circle (0.25cm); 
     \end{scope}
    %----------------
    \begin{scope}
       \clip ($(5,-4)+(240:2)$) -- ($(5,-4)+(100:2)$) -- ($(5,-4)+(-45:2)$) -- cycle;
       \draw[-] ($(5,-4)+(100:2)$) circle (0.31cm) node[below,xshift=2pt,yshift=-9pt] {$\alpha$}; 
   \end{scope}
    %----------------
    \draw[-] ($(5,-4)+(240:2)$) -- (5,-4) -- ($(5,-4)+(-45:2)$);
    \draw[-] ($(5,-4)+(240:2)$) -- ($(5,-4)+(100:2)$) -- ($(5,-4)+(-45:2)$) -- cycle;
\end{tikzpicture}}

\end{document}

在此处输入图片描述

相关内容