Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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.

share|improve this answer

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}
share|improve this answer
2  
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). –  Caramdir Jul 9 '12 at 20:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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