tikz.dev / tkz-euclide Manual

tkz-euclide

Intersections and angles

20 Angles

20.1 Definition and usage with tkz-euclide

In Euclidean geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle [Wikipedia]. With tkz-euclide a ray is defined by two points, so an angle is defined by three points, as in \(\widehat{AOB}\); the vertex \(O\) is the second point. Their order matters, because the angle is assumed to be given counterclockwise. In trigonometry and mathematics in general, plane angles are conventionally measured counterclockwise, starting with \(0^\circ\) pointing directly to the right (or east), and \(90^\circ\) pointing straight up (or north) [Wikipedia]. Let us agree that an angle measured counterclockwise is positive.

Compiled output
Compiled output

Angles are involved in several macros, such as \tkzDefPoint, \tkzDefPointBy[rotation = …], \tkzDrawArc and \tkzGetAngle, described next. Except for the last one, all these macros accept negative angles.

Compiled output

As we can see, the \(-80^\circ\) rotation defines a clockwise angle but the macro \tkzFindAngle recovers a counterclockwise angle.

20.2 Recovering an angle \tkzGetAngle
  • \tkzGetAngle(⟨name of macro⟩)

  • Assigns the value in degrees of an angle to a macro. The value is positive, between \(0^\circ\) and \(360^\circ\). This macro retrieves \tkzAngleResult and stores it in a new macro.

    argumentsexampleexplanation
    name of macro\tkzGetAngle{ang}\ang contains the value of the angle.

This auxiliary macro retrieves the result of the next macro, \tkzFindAngle.

20.3 Angle formed by three points
  • \tkzFindAngle(⟨pt1,pt2,pt3⟩)

  • The result is stored in a macro \tkzAngleResult.

    argumentsexampleexplanation
    (pt1,pt2,pt3)\tkzFindAngle(A,B,C)\tkzAngleResult gives the angle (\(\overrightarrow{BA},\overrightarrow{BC}\))

    The measure is always positive, between \(0^\circ\) and \(360^\circ\). With the usual conventions, a counterclockwise angle smaller than a straight angle always measures between \(0^\circ\) and \(180^\circ\), while a clockwise angle smaller than a straight angle measures more than \(180^\circ\). \tkzGetAngle retrieves the angle.

20.3.1 Verification of angle measurement

Compiled output

\begin{tikzpicture}[scale=.75]
\tkzDefPoint(-1,1){A}
\tkzDefPoint(5,2){B}
\tkzDefEquilateral(A,B)
\tkzGetPoint{C}
\tkzDrawPolygon(A,B,C)
\tkzFindAngle(B,A,C) \tkzGetAngle{angleBAC}
\edef\angleBAC{\fpeval{round(\angleBAC)}}
\tkzDrawPoints(A,B,C)
\tkzLabelPoints(A,B)
\tkzLabelPoint[right](C){$C$}
\tkzLabelAngle(B,A,C){\angleBAC$^\circ$}
\tkzMarkAngle[size=1.5](B,A,C)
\end{tikzpicture}
20.3.2 Determination of the three angles of a triangle

Compiled output

\begin{tikzpicture}
\tikzset{label angle style/.append style={pos=1.4}}
\tkzDefPoints{0/0/a,5/3/b,3/6/c}
\tkzDrawPolygon(a,b,c)
\tkzFindAngle(c,b,a)\tkzGetAngle{angleCBA}
\pgfmathparse{round(1+\angleCBA)}
\let\angleCBA\pgfmathresult
\tkzFindAngle(a,c,b)\tkzGetAngle{angleACB}
\pgfmathparse{round(\angleACB)}
\let\angleACB\pgfmathresult
\tkzFindAngle(b,a,c)\tkzGetAngle{angleBAC}
\pgfmathparse{round(\angleBAC)}
\let\angleBAC\pgfmathresult
\tkzMarkAngle(c,b,a)
\tkzLabelAngle(c,b,a){\tiny $\angleCBA^\circ$}
\tkzMarkAngle(a,c,b)
\tkzLabelAngle(a,c,b){\tiny $\angleACB^\circ$}
\tkzMarkAngle(b,a,c)
\tkzLabelAngle(b,a,c){\tiny $\angleBAC^\circ$}
\end{tikzpicture}
20.3.3 Angle between two circles

We look for the angle formed by the tangents at a point of intersection.

Compiled output

\begin{tikzpicture}[scale=.4]
\pgfkeys{/pgf/number format/.cd,%
fixed,precision=1}
\tkzDefPoints{0/0/A,6/0/B,4/2/C}
\tkzDrawCircles(A,C B,C)
\tkzDefLine[tangent at=C](A) \tkzGetPoint{a}
\tkzDefPointsBy[symmetry = center C](a){d}
\tkzDefLine[tangent at=C](B) \tkzGetPoint{b}
\tkzDrawLines[add=1 and 4](a,C C,b)
\tkzFillAngle[fill=teal,opacity=.2%
,size=2](b,C,d)
\tkzFindAngle(b,C,d)\tkzGetAngle{bcd}
\tkzLabelAngle[pos=1.25](b,C,d){%
\tiny $\pgfmathprintnumber{\bcd}^\circ$}
\end{tikzpicture}
20.4 Angle formed by a straight line with the horizontal axis \tkzFindSlopeAngle

More interesting than the previous one: the result is between \(-180^\circ\) and \(+180^\circ\).

  • \tkzFindSlopeAngle(⟨A,B⟩)

  • Determines the slope (as an angle) of the straight line \((AB)\). The result is stored in the macro \tkzAngleResult.

    argumentsexampleexplanation
    (pt1,pt2)\tkzFindSlopeAngle(A,B)

    \tkzGetAngle retrieves the result; if you don’t need to keep it, you can use \tkzAngleResult.

20.4.1 How to use \tkzFindSlopeAngle

Here \((AB)\) is the bisector of \(\widehat{CAD}\), and the slope of \((AD)\) is zero. We get the slope of \((AB)\), then rotate twice.

Compiled output

\begin{tikzpicture}
\tkzDefPoint(1,5){A} \tkzDefPoint(5,2){B}
\tkzFindSlopeAngle(A,B)\tkzGetAngle{tkzang}
\tkzDefPointBy[rotation= center A angle \tkzang ](B)
\tkzGetPoint{C}
\tkzDefPointBy[rotation= center A angle -\tkzang ](B)
\tkzGetPoint{D}
\tkzDrawSegment(A,B)
\tkzDrawSegments[new](A,C A,D)
\tkzDrawPoints(A,B,C,D)
\tkzCompass[length=1](A,C)
\tkzCompass[delta=10,brown](B,C)
\tkzLabelPoints(B,C,D)
\tkzLabelPoints[above left](A)
\end{tikzpicture}
20.4.2 Use of \tkzFindSlopeAngle and \tkzGetAngle

Here is another construction of a perpendicular bisector (mediator).

Compiled output

\begin{tikzpicture}
\tkzInit
\tkzDefPoint(0,0){A} \tkzDefPoint(3,2){B}
\tkzDefLine[mediator](A,B) \tkzGetPoints{I}{J}
\tkzCalcLength(A,B) \tkzGetLength{dAB}
\tkzFindSlopeAngle(A,B) \tkzGetAngle{tkzangle}
\begin{scope}[rotate=\tkzangle]
\tkzSetUpArc[color=gray,line width=0.2pt,%
/tkzcompass/delta=10]
\tkzDrawArc[R,arc](B,3/4*\dAB)(120,240)
\tkzDrawArc[R,arc](A,3/4*\dAB)(-45,60)
\tkzDrawLine(I,J) \tkzDrawSegment(A,B)
\end{scope}
\tkzDrawPoints(A,B,I,J) \tkzLabelPoints(A,B)
\tkzLabelPoints[right](I,J)
\end{tikzpicture}
20.4.3 Another use of \tkzFindSlopeAngle

Compiled output

\begin{tikzpicture}[scale=1.5]
\tkzDefPoint(1,2){A} \tkzDefPoint(3,4){B}
\tkzDefPoint(3,2){C} \tkzDefPoint(3,1){D}
\tkzDrawSegments(A,B A,C A,D)
\tkzDrawPoints[color=red](A,B,C,D)
\tkzLabelPoints(A,B,C,D)
\tkzFindSlopeAngle(A,B)\tkzGetAngle{SAB}
\tkzFindSlopeAngle(A,C)\tkzGetAngle{SAC}
\tkzFindSlopeAngle(A,D)\tkzGetAngle{SAD}
\pgfkeys{/pgf/number format/.cd,fixed,precision=2}
\tkzText(1,5){The slope of (AB) is :
$\pgfmathprintnumber{\SAB}^\circ$}
\tkzText(1,4.5){The slope of (AC) is :
$\pgfmathprintnumber{\SAC}^\circ$}
\tkzText(1,4){The slope of (AD) is :
$\pgfmathprintnumber{\SAD}^\circ$}
\end{tikzpicture}