# Tangential Quadrilateral wrong angle from \tkzFindAngle

1. The angle calculated is 250 degree for angle BOC... How to correct it...

2. Is there any better way of drawing Tangential Quadrilateral

\documentclass[border=2pt]{standalone}
\usepackage[usenames,dvipsnames,svgnames]{xcolor}
\usepackage{tikz-dimline}
\usepackage{tkz-euclide}
\usetkzobj{all}
\definecolor{fondpaille}{cmyk}{0,0,0.1,0}
\pagecolor{fondpaille}
\color{Maroon}
\begin{document}

\begin{tikzpicture}[scale=1.0]
\tkzInit
\tkzDefPoint(0,0){O}

\tkzDrawSegments[dashed](O,A O,B O,C O,D)
\tkzDrawCircle(O,A)
\tkzTangent[at=A](O) \tkzGetPoint{h}
\tkzTangent[at=B](O) \tkzGetPoint{i}
\tkzTangent[at=C](O) \tkzGetPoint{j}
\tkzTangent[at=D](O) \tkzGetPoint{k}

\tkzInterLL(A,h)(B,i) \tkzGetPoint{R}
\tkzInterLL(A,h)(D,k) \tkzGetPoint{Q}
\tkzInterLL(C,j)(B,i) \tkzGetPoint{S}
\tkzInterLL(C,j)(D,k) \tkzGetPoint{P}

\tkzDrawSegments[thick,brown](P,Q Q,R R,S S,P)

\tkzDrawPoints[color=red,size=3mm,fill=red!60](P,Q,R,S)
\tkzLabelPoints[below](O,P,Q,R,S)
\tkzLabelPoints[below](A,B,C,D)

\tkzFindAngle(C,O,D)
\tkzGetAngle{angleCOD};
\FPround\angleCOD\angleCOD{0}
\tkzMarkAngle[size=.5](C,O,D)
\tkzLabelAngle[pos=.7](C,O,D){\tiny $\angleCOD^\circ$}

\tkzFindAngle(D,O,A)
\tkzGetAngle{angleAOD};
\FPround\angleAOD\angleAOD{0}
\tkzMarkAngle[size=.6](D,O,A)
\tkzLabelAngle[pos=.8](D,O,A){\tiny $\angleAOD^\circ$}

\tkzFindAngle(C,O,B)
\tkzGetAngle{angleBOC};
\FPround\angleBOC\angleBOC{0}
\tkzMarkAngle[size=.8](B,O,C)
\tkzLabelAngle[pos=-0.9](C,O,B){\tiny $\angleBOC^\circ$}

\tkzFindAngle(A,O,B)
\tkzGetAngle{angleAOB};
\FPround\angleAOB\angleAOB{0}
\tkzMarkAngle[size=.7](A,O,B)
\tkzLabelAngle[pos=0.9](A,O,B){\tiny $\angleAOB^\circ$}

\end{tikzpicture}
\end{document}


Just \tkzFindAngle(B,O,C) instead of \tkzFindAngle(C,O,B) but I worked with my new version. If you have a problem I can upload a beta version on my site.

\documentclass{article}
\usepackage[usenames,dvipsnames,svgnames]{xcolor}
\usepackage{tikz-dimline}
\usepackage{tkz-euclide}
\usetkzobj{all}
\definecolor{fondpaille}{cmyk}{0,0,0.1,0}
\pagecolor{fondpaille}
\color{Maroon}
\makeatletter
%<--------------------------------------------------------------------------–>
% thanks karu : http://tex.stackexchange.com/questions/151667/tkzgetangle-strange-behavior/196224#196224  \tkzGetAngle strange behavior
% defines \tkz@FirstAngle and \tkz@SecondAngle sens  trigo
%<--------------------------------------------------------------------------–>
\def\tkzNormalizeAngle(#1,#2){%
\begingroup
\pgfmathparse{#1}\xdef\tkz@FirstAngle{\pgfmathresult}%
\pgfmathparse{#2}\xdef\tkz@SecondAngle{\pgfmathresult}%
\pgfmathgreaterthan{\tkz@FirstAngle}{0}
\ifdim\pgfmathresult pt=1 pt\relax%
\pgfmathgreaterthan{\tkz@FirstAngle}{\tkz@SecondAngle}
\ifdim\pgfmathresult pt=1 pt\relax%
\pgfmathsubtract{\tkz@FirstAngle}{360}
\xdef\tkz@FirstAngle{\pgfmathresult}%
\fi
\else
\pgfmathgreaterthan{\tkz@FirstAngle}{\tkz@SecondAngle}
\ifdim\pgfmathresult pt=1 pt\relax%
\xdef\tkz@SecondAngle{\pgfmathresult}%
\fi
\fi
\endgroup
}
%<--------------------------------------------------------------------------–>
%                          Angle
%<--------------------------------------------------------------------------–>
\def\tkzFindSlopeAngle(#1,#2){%
\begingroup
\tkzmathanglebetweenpoints{\pgfpointanchor{#1}{center}}{%
\pgfpointanchor{#2}{center}}
\global\let\tkzAngleResult\pgfmathresult
\endgroup
}
%<--------------------------------------------------------------------------–>
%                          Angle  avec trois nodes
%<--------------------------------------------------------------------------–>
\def\tkzFindAngle(#1,#2,#3){% new code 2016
\begingroup
\tkzFindSlopeAngle(#2,#1)\tkzGetAngle{tkz@FirstAngle}
\tkzFindSlopeAngle(#2,#3)\tkzGetAngle{tkz@SecondAngle}
\tkzNormalizeAngle(\tkz@FirstAngle,\tkz@SecondAngle)
\global\let\tkzAngleResult\tkz@Angle
\endgroup
}
%<--------------------------------------------------------------------------–>
% Find angle
%<--------------------------------------------------------------------------–>
\def\tkzGetAngle#1{%
\global\expandafter\edef\csname #1\endcsname{\tkzAngleResult}
}
\makeatother
\begin{document}

\begin{tikzpicture}[scale=1.0]
\tkzInit
\tkzDefPoint(0,0){O}

\tkzDrawSegments[dashed](O,A O,B O,C O,D)
\tkzDrawCircle(O,A)
\tkzTangent[at=A](O) \tkzGetPoint{h}
\tkzTangent[at=B](O) \tkzGetPoint{i}
\tkzTangent[at=C](O) \tkzGetPoint{j}
\tkzTangent[at=D](O) \tkzGetPoint{k}

\tkzInterLL(A,h)(B,i) \tkzGetPoint{R}
\tkzInterLL(A,h)(D,k) \tkzGetPoint{Q}
\tkzInterLL(C,j)(B,i) \tkzGetPoint{S}
\tkzInterLL(C,j)(D,k) \tkzGetPoint{P}

\tkzDrawSegments[thick,brown](P,Q Q,R R,S S,P)

\tkzDrawPoints[color=red,size=3mm,fill=red!60](P,Q,R,S)
\tkzLabelPoints[below](O,P,Q,R,S)
\tkzLabelPoints[below](A,B,C,D)

\tkzFindAngle(C,O,D)
\tkzGetAngle{angleCOD};
\FPround\angleCOD\angleCOD{0}
\tkzMarkAngle[size=.5](C,O,D)
\tkzLabelAngle[pos=.7](C,O,D){\tiny $\angleCOD^\circ$}

\tkzFindAngle(D,O,A)
\tkzGetAngle{angleAOD};
\FPround\angleAOD\angleAOD{0}
\tkzMarkAngle[size=.6](D,O,A)
\tkzLabelAngle[pos=.8](D,O,A){\tiny $\angleAOD^\circ$}

\tkzFindAngle(B,O,C)
\tkzGetAngle{angleBOC};
\FPround\angleBOC\angleBOC{0}
\tkzMarkAngle[size=.8](B,O,C)
\tkzLabelAngle[pos=-0.9](C,O,B){\tiny $\angleBOC^\circ$}

\tkzFindAngle(A,O,B)
\tkzGetAngle{angleAOB};
\FPround\angleAOB\angleAOB{0}
\tkzMarkAngle[size=.7](A,O,B)
\tkzLabelAngle[pos=0.9](A,O,B){\tiny $\angleAOB^\circ$}

\end{tikzpicture}
\end{document}


• Matthes : I am getting -ve value. Commented Aug 18, 2018 at 10:04
• Sorry you need the new version of tkz-euclide. I updated my answer Commented Aug 18, 2018 at 19:12
• @sandu but you need to write \tkzFindAngle(B,O,C) instead of \tkzFindAngle(C,O,B) Commented Aug 18, 2018 at 19:14
• @sandu the new version is coming soon Commented Aug 18, 2018 at 19:17

With some thought, and a custom mark_angle macro you can do all that in plain Metapost too, here wrapped up in luamplib to make the labels simpler. Compile this with lualatex.

\documentclass[border=5mm]{standalone}
\usepackage{luatex85}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
pair O, A, B, C, D, P, Q, R, S;
path c;
c = fullcircle scaled 4cm;

O = origin;

A = point   20 / 360 * 8 of c;
B = point  100 / 360 * 8 of c;
C = point -150 / 360 * 8 of c;
D = point  -70 / 360 * 8 of c;

P = whatever [C, O rotatedabout(C, 90)] = whatever [D, O rotatedabout(D, 90)];
Q = whatever [D, O rotatedabout(D, 90)] = whatever [A, O rotatedabout(A, 90)];
R = whatever [A, O rotatedabout(A, 90)] = whatever [B, O rotatedabout(B, 90)];
S = whatever [B, O rotatedabout(B, 90)] = whatever [C, O rotatedabout(C, 90)];

color brown, maroon;
brown = 2/3 (red + 1/2 green);
maroon = 2/3 (red + 1/4 blue);

draw P--Q--R--S--cycle withcolor brown;

vardef mark_angle(expr a, b, c, r, shade) =
save arc; path arc;
arc = fullcircle scaled 2r rotated angle (a-b) shifted b cutafter (b--c);
save theta; numeric theta;
theta = round(angle (c-b) - angle (a-b)) mod 360;
label("$\scriptstyle " & decimal theta & "^\circ$",
(r+8) * unitvector (a-b) rotated 1/2 theta) withcolor shade;
enddef;

mark_angle(D, O, A, 18, maroon);
mark_angle(A, O, B, 16, maroon);
mark_angle(B, O, C, 20, maroon);
mark_angle(C, O, D, 16, maroon);

draw c;
forsuffixes @=A, B, C, D:
draw O -- @ dashed evenly scaled 1/2;
label("$" & str @ & "$", @ + 8 unitvector @);
endfor

forsuffixes @=P, Q, R, S:
fill fullcircle scaled dotlabeldiam shifted @ withcolor 1/4 [red, white];
draw fullcircle scaled dotlabeldiam shifted @ withcolor 1/2 red;
label("$" & str @ & "$", @ + 8 unitvector @);
endfor

fill fullcircle scaled dotlabeldiam shifted O;
label("$O$", 8 dir 160);

cmykcolor straw; straw = (0, 0, 0.1, 0);
picture P; P = currentpicture;
fill bbox P withcolor straw;
draw P;

endfig;
\end{mplibcode}
\end{document}