我尝试通过测量四个角来创建一个四边形,如下图所示:
我的代码
\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}
还有其他方法可以构造这样的四边形吗?
答案1
有一个更简单的解决方案:
\tkzDefTriangle[two angles ...
\documentclass[border=1.5mm,12pt]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\a}{6}
\tkzDefPoints{0/0/A,\a/0/B}
\tkzDefTriangle[two angles = 60 and 80](A,B)
\tkzGetPoint{Z}
\tkzDefMidPoint(Z,B)
\tkzGetPoint{C}
\tkzDefTriangle[two angles = 60 and 40](C,Z)
\tkzGetPoint{D}
\tkzLabelAngle[pos=.5](Z,B,A){$80^{\circ}$}
\tkzLabelAngle[pos=.6](B,A,Z){$60^{\circ}$}
\tkzLabelAngle[pos=.5](D,C,B){$120^{\circ}$}
\tkzLabelAngle[pos=.5](A,D,C){$100^{\circ}$}
\tkzLabelPoints[](A,B)
\tkzLabelPoints[right](C)
\tkzLabelPoints[left](D)
\tkzDrawPolygon(A,B,C,D)
\end{tikzpicture}
\end{document}
更新面对新的限制
\documentclass[border=1.5mm,12pt]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\a}{6}
\pgfmathsetmacro\angleA{60}
\pgfmathsetmacro\angleB{80}
\pgfmathsetmacro\angleC{120}
\tkzDefPoints{0/0/A,\a/0/B}
\tkzDefTriangle[two angles = {\angleA} and {\angleB}](A,B)
\tkzGetPoint{Z}
\tkzDefMidPoint(Z,B)
\tkzGetPoint{C}
\tkzDefTriangle[two angles = {180-\angleC} and {(180-(\angleA+\angleB))}](C,Z)
\tkzGetPoint{D}
\tkzLabelAngle[pos=.5](Z,B,A){$80^{\circ}$}
\tkzLabelAngle[pos=.6](B,A,Z){$60^{\circ}$}
\tkzLabelAngle[pos=.5](D,C,B){$120^{\circ}$}
\tkzLabelAngle[pos=.5](A,D,C){$100^{\circ}$}
\tkzLabelPoints[](A,B)
\tkzLabelPoints[right](C)
\tkzLabelPoints[left](D)
\tkzDrawPolygon(A,B,C,D)
\end{tikzpicture}
\end{document}
答案2
如果我没看错的话,重点是C介于两者之间乙和是在哪里是只是广告的公元前。
两条直线留置权的交点可以很容易地找到intersection of
句法calc
。通过的语法可以找到中间点($(B)!.5!(Z)$)
。(您也可以这样做\path[overlay] (B) -- coordinate (C) (Z);
。)
围绕另一个坐标旋转一个坐标可以通过以下方式完成rotate around
:
([rotate around=<angle>:(A)]B)
或者再次借助calc
($(A)!1!wa:(B)$)
在这里我们甚至可以改变A和新点。但对于intersection of
语法来说,距离是无关紧要的(当然不应该为零)。
代码
\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}
输出
答案3
这是使用 Asymptote 实现的另一种方法(不必担心边界框的冗余)。另请参阅这用于计算和标记角度。
将其翻译成 TikZ 非常简单。
size(6cm);
// change t to control the length AT = t;
// change s to move C and D
real t=1.2,s=2.5;
pair A=(0,0), T=A+t*dir(60);
pair Bt=rotate(100,T)*A;
pair B=extension(T,Bt,A,A+dir(0));
pair D=A+s*(T-A),Bs=B+dir(100);
pair Ds=rotate(100,D)*A;
pair C=extension(D,Ds,B,Bs);
draw(B--T,red); label("$T$",T,W,red);
draw(A--B--C--D--cycle);
label("$A$",A,SW);
label("$B$",B,SE);
label("$C$",C,NE);
label("$D$",D,NW);
real angleA=degrees(D);
real angleB=180-degrees(C-B);
real angleD=-angleA+degrees(T-B);
real angleC=360-angleA-angleB-angleD;
write("The angle A is: ",angleA);
write("The angle B is: ",angleB);
write("The angle C is: ",angleC);
write("The angle D is: ",angleD);
shipout(bbox(5mm,invisible));
答案4
您可以使用能够导出“LaTeX”代码的外部软件。例如geogebra
并导出tikz
。这是一个非常简单的方法。
\documentclass[10pt]{standalone}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\newcommand{\degre}{\ensuremath{^\circ}}
\begin{document}
\definecolor{uququq}{rgb}{0.25,0.25,0.25}
\definecolor{xdxdff}{rgb}{0.49,0.49,1}
\definecolor{qqwuqq}{rgb}{0,0.39,0}
\definecolor{qqqqff}{rgb}{0,0,1}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(-3.3,-2) rectangle (24.02,9.6);
\draw [shift={(1.18,1.92)},color=qqwuqq,fill=qqwuqq,fill opacity=0.1] (0,0) -- (0.64:0.6) arc (0.64:60.64:0.6) -- cycle;
\draw [shift={(3.98,6.9)},color=qqwuqq,fill=qqwuqq,fill opacity=0.1] (0,0) -- (-119.36:0.6) arc (-119.36:-19.36:0.6) -- cycle;
\draw [shift={(8.38,2)},color=qqwuqq,fill=qqwuqq,fill opacity=0.1] (0,0) -- (100.64:0.6) arc (100.64:180.64:0.6) -- cycle;
\draw [shift={(7.71,5.59)},color=qqwuqq,fill=qqwuqq,fill opacity=0.1] (0,0) -- (160.64:0.6) arc (160.64:280.64:0.6) -- cycle;
\draw (1.18,1.92)-- (8.38,2);
\draw (1.18,1.92)-- (3.98,6.9);
\draw (3.98,6.9)-- (7.71,5.59);
\draw (8.38,2)-- (7.71,5.59);
\begin{scriptsize}
\fill [color=qqqqff] (1.18,1.92) circle (1.5pt);
\draw[color=qqqqff] (0.9,2.02) node {$A$};
\fill [color=qqqqff] (8.38,2) circle (1.5pt);
\draw[color=qqqqff] (8.66,2.1) node {$B$};
\draw[color=qqwuqq] (1.62,2.14) node {$60\textrm{\degre}$};
\fill [color=xdxdff] (3.98,6.9) circle (1.5pt);
\draw[color=xdxdff] (3.82,7.12) node {$C$};
\draw[color=qqwuqq] (4.12,6.62) node {$100\textrm{\degre}$};
\fill [color=uququq] (7.71,5.59) circle (1.5pt);
\draw[color=uququq] (7.86,5.86) node {$D$};
\draw[color=qqwuqq] (8.08,2.28) node {$80\textrm{\degre}$};
\draw[color=qqwuqq] (7.44,5.44) node {$120\textrm{\degre}$};
\end{scriptsize}
\end{tikzpicture}
\end{document}