6

I'm aware of the pgf macros:

\pgfmathanglebetweenpoints

and

\pgfmathanglebetweenlines

What I'd like to know is whether there are any macros in tkz-euclide that more easily accomplish the same thing.

For example, if I have two coordinates A and B, to measure the angle of the line passing through these two points, I can write

\pgfmathanglebetweenpoints{\pgfpointanchor{A}{center}}{\pgfpointanchor{B}{center}}
\edef\aeABangle{\pgfmathresult}

It would be convenient if there were a macro in tkz-euclide that could do this in a manner like

\tkzAngleAlong(A,B)

and then have some mechanism to retrieve the value of the angle.

I barely have a reading knowledge of French. It's passable enough that I can usually figure out what's in the manual to tkz-euclide, but it's not sufficient for me to guess key words to search on. So, I apologize if this is already well documented.

I know I could write my own macro to do this. I'd just like to not have to reinvent the wheel (even though it's a relatively simple wheel to recreate).

4
  • You can search for \tkzFindAngle() in the manual.
    – percusse
    May 23, 2015 at 15:39
  • @percusse I always feel so stupid after such questions. But thank you. You got me to the correct location in the manual!!! :-)
    – A.Ellett
    May 23, 2015 at 15:40
  • @percusse Perhaps you could post a solution about \tkzFindAngle, \tkzFindSlopeAngle, and \tkzGetAngle. That way a web search will result in a quicker find.
    – A.Ellett
    May 23, 2015 at 15:43
  • @A.Ellett See also this answer of mine. It's not actually about it, but I used them to find and print angles.
    – Alenanno
    May 23, 2015 at 18:57

1 Answer 1

6

Basically you have:

  1. \tkzFindAngle(c,b,a)
    The angle in the center is the one being found. Or in this case, the vertex b.
  2. \tkzGetAngle{angleCBA}
    Gives the name to the angle.
  3. \FPround\angleCBA\angleCBA{0}
    Rounds the angle to integers. The 0 indicates numbers after the decimal separator. I set one angle to have 10 of them as a demonstration.
  4. \tkzMarkAngle[size=.5](c,b,a)
    Marks the angle with the arc. You can customize this using draw, fill and even opacity.
  5. \tkzLabelAngle[pos=-.82](c,b,a){\tiny $\angleCBA^\circ$}
    Labels the angle. Pos indicates the position of the label, while the rest is similar to the syntax of a node. (c,b,a) indicates what angle/where the label should appear; and $\angleCBA$ prints the angle.

Output

figure 1

Code

\documentclass[margin=10pt]{standalone}
\usepackage{amsmath,tkz-euclide}
\usepackage{tikz}
\usetkzobj{all}

\usetikzlibrary{calc,angles,positioning}

\tikzset{
    myangle/.style={fill=green!20!white, draw=green!50!black,size=.3,opacity=.3}
}


\begin{document}
\begin{tikzpicture}

\coordinate (a) at (0,0);
\coordinate (b) at (5,3);
\coordinate (c) at (3,6);

\draw (a) coordinate[label=left:A] -- (b) coordinate[label=right:B] -- (c) coordinate[label=above:C] -- cycle;

\tkzFindAngle(c,b,a)
\tkzGetAngle{angleCBA};
\FPround\angleCBA\angleCBA{0}
\tkzFindAngle(a,c,b)
\tkzGetAngle{angleACB};
\FPround\angleACB\angleACB{10}
\tkzFindAngle(b,a,c)
\tkzGetAngle{angleBAC};
\FPround\angleBAC\angleBAC{0}

\tkzMarkAngle[size=.5](c,b,a)
\tkzLabelAngle[pos=-.82](c,b,a){\tiny $\angleCBA^\circ$}

\tkzMarkAngle[size=.5](a,c,b)
\tkzLabelAngle[pos=0.6](a,c,b){\tiny $\angleACB^\circ$}

\tkzMarkAngle[size=.5](b,a,c)
\tkzLabelAngle[pos=.7](b,a,c){\tiny $\angleBAC^\circ$}

\end{tikzpicture}
\end{document}
4
  • Very nice work.
    – A.Ellett
    May 23, 2015 at 19:51
  • @A.Ellett I noticed a problem though (trying to fix it), but the angle B shouldn't be -273. It never happened to me. I'm looking into it.
    – Alenanno
    May 23, 2015 at 20:02
  • I noticed that too, but I wasn't worried about that part.
    – A.Ellett
    May 23, 2015 at 20:19
  • Hi Alenanno, is it possible to use \FPRound with measuring arcs of circles? See e.g. this question: tex.stackexchange.com/questions/542375/… May 19, 2021 at 10:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .