4

I'd like to make the markings of the angles of a triangle, in three dimensional space, automatically, using the \tdplotdrawpolytopearc.

I tried something like:

\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}

But the command \tdplotdefinepoints(B)(A)(C); does not work.

It works only if the vertices are described explicitly, as in

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

In the plane, I don't have ploblem. See this solutions.

Could someone please offer some help?


It will help a lot.

But now I have another problem. In my case a point is calculated from others. For example, we can take the midpoint, $M$, $0.5*(B) + 0.5*(C)$ on the side BC. How to mark the angle between the sides AC and AM?

Something like

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

did not work.

4

I think the answer is: impossible. \tdplotdefinepoints needs to have three coordinates 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 saves the node A in 2D and two points in the plane may have different coordinates in 3D.

A workaround

\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}  

enter image description here

Todo

A good idea is to define a macro \tdplotdefinepoints* for example, to work with macros (\ptA, etc.).

Another idea is to create a macro to define the coordinate A, B etc. and at the same time \ptA etc.

1

We can draw the mark of an angle, considering a whole circle and then making the intersection with the triangle. I also wrote a small macro to draw right angles.

Without the use of the command \tdplotdefinepoints, we have much more freedom.

%---------------------------------------------------------------------
\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}
1
0

@Joseph Wright @Alain Mattheus

I modified my old code. Now it allows the points are calculated with the help of "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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.