2

I tried to create a quadrilateral with the measure of its four angles, as shown in the picture:

enter image description here

My code

\documentclass[border=1.5mm,12pt]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\a}{3} 
\tkzDefPoints{0/0/A,\a/0/B}
\tkzDefPointBy[rotation= center A angle 60](B)  
\tkzGetPoint{X}
\tkzDefPointBy[rotation= center B angle -80](A)     
\tkzGetPoint{Y}
\tkzInterLL(A,X)(B,Y)
\tkzGetPoint{Z}
\tkzDefMidPoint(Z,B)
 \tkzGetPoint{C}
\tkzDefPointBy[rotation= center C angle 60](Z)  
\tkzGetPoint{T}
\tkzInterLL(C,T)(A,Z)
\tkzGetPoint{D}
\tkzLabelAngle[pos=.5](Z,B,A){$80^{\circ}$} 
\tkzLabelAngle[pos=.6](B,A,Z){$60^{\circ}$} 
%\tkzLabelAngle[pos=.6](Z,C,D){$30^{\circ}$}    
\tkzLabelAngle[pos=.5](D,C,B){$120^{\circ}$}
\tkzLabelAngle[pos=.5](A,D,C){$100^{\circ}$}
\tkzLabelPoints[](A,B)
%\tkzLabelPoints[above](Z)
\tkzLabelPoints[right](C)
\tkzLabelPoints[left](D)
\tkzDrawPolygon(A,B,C,D)
    \end{tikzpicture}
\end{document} 

Is there another way to construct such a quadrilateral?

Ingmar
  • 6,690
  • 5
  • 26
  • 47

5 Answers5

6

If I'm seeing this right, the point C is half way between B and Z where Z is just the intersection of AD of BC.

The intersection of two straight liens can be easily foudn with the intersection of syntax. The halfway point is found via calc's syntax ($(B)!.5!(Z)$). (You could also do \path[overlay] (B) -- coordinate (C) (Z);.)

Rotating one coordinate around another can be done via rotate around:

([rotate around=<angle>:(A)]B)

or again with the help of calc

($(A)!1!wa:(B)$)

Here we can even change the distance between A and the new point. But for the intersection of syntax the distance is irrelevant (shouldn't be zero, of course).

Code

\documentclass[tikz]{standalone}
\usetikzlibrary{angles, calc, quotes}
\tikzset{math nodes/.style={execute at begin node=$, execute at end node=$}}
\begin{document}
\begin{tikzpicture}[
  declare function={a=3; wa=60; wb=80; wc=120; wd=100;},
  every label/.append style=math nodes,
  angle eccentricity=1, angle radius=4.5mm,
  pics/angle/.append style={/tikz/nodes={font=\footnotesize}},
]
\coordinate["A" below] (A) at (0,0)
 coordinate["B" below] (B) at (right:a)
 coordinate[overlay]  (B') at ([rotate around=wa:(A)]B)
%coordinate[overlay]  (B') at ($(A)!1!wa:(B)$)
 coordinate[overlay]   (Z) at (intersection of A--B' and B--{[rotate around=-wb:(B)]A})
%coordinate[overlay]   (Z) at (intersection of A--B' and B--{$(B)!1!-wb:(A)$})
 coordinate["C" right] (C) at ($(B)!.5!(Z)$)
 coordinate["D" left ] (D) at (intersection of A--B' and C--{[rotate around=-wc:(C)]B})
%coordinate["D" left ] (D) at (intersection of A--B' and C--{$(C)!1!-wc:(B)$})
;

%\draw[help lines] (D) -- (Z) node[above]{$Z$} -- (C) % pic["$\pgfmathprint{int(180-wa-wb)}^\circ$" gray, angle radius=7mm] % {angle = D--Z--C}; \draw (A) -- (B) -- (C) -- (D) -- cycle foreach \v/\a in {wa/B--A--D, wb/C--B--A, wc/D--C--B, wd/A--D--C}{ pic["$\pgfmathprint{\v}^\circ$"] {angle/.expand once = \a} }; \end{tikzpicture} \end{document}

Output

enter image description here enter image description here

Qrrbrbirlbel
  • 119,821
  • @JohnPaulPeter Yes, that is indeed possible. Let me note that instead of PGFMath function you can also simply use macros, as you did in your Q with \pgfmathsetmacro. – Qrrbrbirlbel Jul 12 '23 at 00:13
  • There is a bug withdeclare function={a=3; wa=90; wb=90; wc=90; wd=90;} – John Paul Peter Jul 12 '23 at 01:08
  • @JohnPaulPeter Not really a bug. Z doesn't exist then (or only in infinity). Where should C lie then? – Qrrbrbirlbel Jul 12 '23 at 01:56
  • Thank you very much. – John Paul Peter Jul 12 '23 at 09:14