∡OPR处表示角度的圆弧的曲率是向后的。我用来绘制它的命令是代码中的最后一行。
\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw[-latex,name path=ray_1] (O) -- (10:8);
\coordinate (label_for_ray_r_1) at ($(10:8) +(10:3mm)$);
\node at (label_for_ray_r_1){$r_{1}$};
\draw[-latex,name path=ray_2] (O) -- (50:8);
\coordinate (label_for_ray_r_2) at ($(45:8) +(50:0.3)$);
\node at (label_for_ray_r_2){$r_{2}$};
\draw[-latex,name path=ray_3] (O) -- (75:8);
\coordinate (label_for_ray_r_3) at ($(75:8) +(75:0.3)$);
\node at (label_for_ray_r_3){$r_{3}$};
\coordinate (Q) at (75:6.5);
\draw[fill] (Q) circle (1.5pt);
\coordinate (P) at ($(O)!(Q)!(50:8)$);
\draw[fill,blue] (P) circle (1.5pt);
\draw[name path=path_PQ] (P) -- (Q);
%A right-angle mark is drawn at P.
\coordinate (U) at ($(P)!4mm!-45:(O)$);
\draw[dashed] (U) -- ($(P)!(U)!(O)$);
\draw[dashed] (U) -- ($(P)!(U)!(Q)$);
\coordinate (A) at ($(O)!(Q)!(10:8)$);
\draw[fill] (A) circle (1.5pt);
\draw[name path=path_AQ] (A) -- (Q);
\coordinate (B) at ($(O)!(P)!(10:8)$);
\draw[fill] (B) circle (1.5pt);
\draw (B) -- (P);
\coordinate (R) at ($(A)!(P)!(Q)$);
\draw[fill,blue] (R) circle (1.5pt);
\draw (P) -- (R);
%The label for O is typeset.
\coordinate (label_O_below_left) at ($(O)!-7mm!(10:8)$);
\coordinate (label_O_below) at ($(O)!-7mm!(75:8)$);
\coordinate (label_O) at ($(label_O_below_left)!0.5!(label_O_below)$);
\node[blue] at ($(O)!3mm!(label_O)$){$O$};
%The label for Q is typeset.
\coordinate (label_Q_left) at ($(Q)!-7mm!(P)$);
\coordinate (label_Q_right) at ($(Q)!-7mm!(A)$);
\coordinate (label_Q) at ($(label_Q_left)!0.5!(label_Q_right)$);
\node[blue] at ($(Q)!3mm!(label_Q)$){$Q$};
%The label for P is typeset.
\coordinate (label_P_above_right) at ($(P)!15mm!(50:8)$);
\coordinate (label_P_below) at ($(P)!15mm!(B)$);
\coordinate (label_P) at ($(label_P_above_right)!0.5!(label_P_below)$);
\node[blue] at ($(P)!3mm!(label_P)$){$P$};
%The label for R is typeset.
\coordinate (label_R) at ($(R)!-4mm!(P)$);
\node[blue] at (label_R){$R$};
%The labels for A and B are typeset.
\coordinate (label_A) at ($(A)!-3mm!(Q)$);
\node[blue] at (label_A){$A$};
\coordinate (label_B) at ($(B)!-3mm!(P)$);
\node[blue] at (label_B){$B$};
%A right-angle mark is drawn at A.
\coordinate (U_2) at ($(A)!4mm!-45:(O)$);
\draw[dashed] (U_2) -- ($(A)!(U_2)!(O)$);
\draw[dashed] (U_2) -- ($(A)!(U_2)!(Q)$);
%A right-angle mark is drawn at B.
\coordinate (U_3) at ($(B)!4mm!-45:(O)$);
\draw[dashed] (U_3) -- ($(B)!(U_3)!(O)$);
\draw[dashed] (U_3) -- ($(B)!(U_3)!(P)$);
%A right-angle mark is drawn at R.
\coordinate (U_4) at ($(R)!4mm!45:(P)$);
\draw[dashed] (U_4) -- ($(R)!(U_4)!(Q)$);
\draw[dashed] (U_4) -- ($(R)!(U_4)!(P)$);
%The angle at O with a measure of x is drawn.
\draw[draw=blue] (O) ++(10:5mm) arc (10:50:5mm);
\coordinate (label_for_x) at (30:0.75);
\node[font=\footnotesize] at (label_for_x){$x$};
%The angle at O with a measure of y is drawn.
\draw[draw=blue] (O) ++(50:7.5mm) arc (50:75:7.5mm);
\coordinate (label_for_y) at (62.5:0.9);
\node[font=\footnotesize] at (label_for_y){$y$};
%An angle at Q with measure x is drawn.
\draw[draw=blue] let \p1=($(A)-(Q)$), \n1={atan(\y1/\x1)}, \p2=($(P)-(Q)$), \n2={atan(\y2/\x2)} in ($(Q)!0.5cm!(A)$) arc (\n1:\n2:0.5);
%The label x for the measure of the angle at Q is typeset.
\coordinate (midpoint_of_PR) at ($(P)!0.5!(R)$);
\coordinate (label_for_x_at_Q) at ($(Q)!0.75cm!(midpoint_of_PR)$);
\node[font=\footnotesize] at (label_for_x_at_Q){$x$};
%An angle at P with measure x is drawn.
\draw[draw=blue] let \p1=($(P)-(O)$), \n1={atan(\y1/\x1)}, \p2=($(P)-(R)$), \n2={atan(\y2/\x2)} in ($(P)!0.5cm!(R)$) arc (\n1:\n2:0.5);
\end{tikzpicture}
\end{document}
答案1
答案2
解决歧义的另一种方法atan
是反射使用xscale=-1
并将起始点移动到($(P)!0.5cm!(O)$)
:
\draw[draw=blue,xscale=-1]
let \p1=($(P)-(O)$),
\n1={atan(\y1/\x1)},
\p2=($(P)-(R)$),
\n2={atan(\y2/\x2)}
in
($(P)!0.5cm!(O)$) arc (\n1:\n2:0.5);
完整代码:
\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw[-latex,name path=ray_1] (O) -- (10:8);
\coordinate (label_for_ray_r_1) at ($(10:8) +(10:3mm)$);
\node at (label_for_ray_r_1){$r_{1}$};
\draw[-latex,name path=ray_2] (O) -- (50:8);
\coordinate (label_for_ray_r_2) at ($(45:8) +(50:0.3)$);
\node at (label_for_ray_r_2){$r_{2}$};
\draw[-latex,name path=ray_3] (O) -- (75:8);
\coordinate (label_for_ray_r_3) at ($(75:8) +(75:0.3)$);
\node at (label_for_ray_r_3){$r_{3}$};
\coordinate (Q) at (75:6.5);
\draw[fill] (Q) circle (1.5pt);
\coordinate (P) at ($(O)!(Q)!(50:8)$);
\draw[fill,blue] (P) circle (1.5pt);
\draw[name path=path_PQ] (P) -- (Q);
%A right-angle mark is drawn at P.
\coordinate (U) at ($(P)!4mm!-45:(O)$);
\draw[dashed] (U) -- ($(P)!(U)!(O)$);
\draw[dashed] (U) -- ($(P)!(U)!(Q)$);
\coordinate (A) at ($(O)!(Q)!(10:8)$);
\draw[fill] (A) circle (1.5pt);
\draw[name path=path_AQ] (A) -- (Q);
\coordinate (B) at ($(O)!(P)!(10:8)$);
\draw[fill] (B) circle (1.5pt);
\draw (B) -- (P);
\coordinate (R) at ($(A)!(P)!(Q)$);
\draw[fill,blue] (R) circle (1.5pt);
\draw (P) -- (R);
%The label for O is typeset.
\coordinate (label_O_below_left) at ($(O)!-7mm!(10:8)$);
\coordinate (label_O_below) at ($(O)!-7mm!(75:8)$);
\coordinate (label_O) at ($(label_O_below_left)!0.5!(label_O_below)$);
\node[blue] at ($(O)!3mm!(label_O)$){$O$};
%The label for Q is typeset.
\coordinate (label_Q_left) at ($(Q)!-7mm!(P)$);
\coordinate (label_Q_right) at ($(Q)!-7mm!(A)$);
\coordinate (label_Q) at ($(label_Q_left)!0.5!(label_Q_right)$);
\node[blue] at ($(Q)!3mm!(label_Q)$){$Q$};
%The label for P is typeset.
\coordinate (label_P_above_right) at ($(P)!15mm!(50:8)$);
\coordinate (label_P_below) at ($(P)!15mm!(B)$);
\coordinate (label_P) at ($(label_P_above_right)!0.5!(label_P_below)$);
\node[blue] at ($(P)!3mm!(label_P)$){$P$};
%The label for R is typeset.
\coordinate (label_R) at ($(R)!-4mm!(P)$);
\node[blue] at (label_R){$R$};
%The labels for A and B are typeset.
\coordinate (label_A) at ($(A)!-3mm!(Q)$);
\node[blue] at (label_A){$A$};
\coordinate (label_B) at ($(B)!-3mm!(P)$);
\node[blue] at (label_B){$B$};
%A right-angle mark is drawn at A.
\coordinate (U_2) at ($(A)!4mm!-45:(O)$);
\draw[dashed] (U_2) -- ($(A)!(U_2)!(O)$);
\draw[dashed] (U_2) -- ($(A)!(U_2)!(Q)$);
%A right-angle mark is drawn at B.
\coordinate (U_3) at ($(B)!4mm!-45:(O)$);
\draw[dashed] (U_3) -- ($(B)!(U_3)!(O)$);
\draw[dashed] (U_3) -- ($(B)!(U_3)!(P)$);
%A right-angle mark is drawn at R.
\coordinate (U_4) at ($(R)!4mm!45:(P)$);
\draw[dashed] (U_4) -- ($(R)!(U_4)!(Q)$);
\draw[dashed] (U_4) -- ($(R)!(U_4)!(P)$);
%The angle at O with a measure of x is drawn.
\draw[draw=blue] (O) ++(10:5mm) arc (10:50:5mm);
\coordinate (label_for_x) at (30:0.75);
\node[font=\footnotesize] at (label_for_x){$x$};
%The angle at O with a measure of y is drawn.
\draw[draw=blue] (O) ++(50:7.5mm) arc (50:75:7.5mm);
\coordinate (label_for_y) at (62.5:0.9);
\node[font=\footnotesize] at (label_for_y){$y$};
%An angle at Q with measure x is drawn.
\draw[draw=blue] let \p1=($(A)-(Q)$), \n1={atan(\y1/\x1)}, \p2=($(P)-(Q)$), \n2={atan(\y2/\x2)} in ($(Q)!0.5cm!(A)$) arc (\n1:\n2:0.5);
%The label x for the measure of the angle at Q is typeset.
\coordinate (midpoint_of_PR) at ($(P)!0.5!(R)$);
\coordinate (label_for_x_at_Q) at ($(Q)!0.75cm!(midpoint_of_PR)$);
\node[font=\footnotesize] at (label_for_x_at_Q){$x$};
%An angle at P with measure x is drawn.
\draw[draw=blue,xscale=-1]
let \p1=($(P)-(O)$),
\n1={atan(\y1/\x1)},
\p2=($(P)-(R)$),
\n2={atan(\y2/\x2)}
in
($(P)!0.5cm!(O)$) arc (\n1:\n2:0.5);
\end{tikzpicture}
\end{document}
答案3
我不知道你为什么加载了angles
库却不使用它。让库来做工作吧。quotes
如果你想标记角度,也可以使用库。
\usetikzlibrary{angles,quotes}
%An angle at Q with measure x is drawn.
\path pic[draw=blue,angle radius=5mm,"$\scriptstyle{x}$",angle eccentricity=1.25] {angle = A--Q--P};
%An angle at P with measure x is drawn.
\path pic[draw=blue,angle radius=5mm,angle eccentricity=1.25] {angle = R--P--O};
通过这种方法,您的代码可以大大减少。我在下面的代码中留下了注释。
\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz}
\usetikzlibrary{calc,angles,quotes,positioning,intersections}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw[-latex,name path=ray_1] (O) -- (10:8);
\coordinate (label_for_ray_r_1) at ($(10:8) +(10:3mm)$);
\node at (label_for_ray_r_1){$r_{1}$};
\draw[-latex,name path=ray_2] (O) -- (50:8);
\coordinate (label_for_ray_r_2) at ($(45:8) +(50:0.3)$);
\node at (label_for_ray_r_2){$r_{2}$};
\draw[-latex,name path=ray_3] (O) -- (75:8);
\coordinate (label_for_ray_r_3) at ($(75:8) +(75:0.3)$);
\node at (label_for_ray_r_3){$r_{3}$};
\coordinate (Q) at (75:6.5);
\draw[fill] (Q) circle (1.5pt);
\coordinate (P) at ($(O)!(Q)!(50:8)$);
\draw[fill,blue] (P) circle (1.5pt);
\draw[name path=path_PQ] (P) -- (Q);
%A right-angle mark is drawn at P.
\coordinate (U) at ($(P)!4mm!-45:(O)$);
\draw[dashed] (U) -- ($(P)!(U)!(O)$);
\draw[dashed] (U) -- ($(P)!(U)!(Q)$);
\coordinate (A) at ($(O)!(Q)!(10:8)$);
\draw[fill] (A) circle (1.5pt);
\draw[name path=path_AQ] (A) -- (Q);
\coordinate (B) at ($(O)!(P)!(10:8)$);
\draw[fill] (B) circle (1.5pt);
\draw (B) -- (P);
\coordinate (R) at ($(A)!(P)!(Q)$);
\draw[fill,blue] (R) circle (1.5pt);
\draw (P) -- (R);
%The label for O is typeset.
\coordinate (label_O_below_left) at ($(O)!-7mm!(10:8)$);
\coordinate (label_O_below) at ($(O)!-7mm!(75:8)$);
\coordinate (label_O) at ($(label_O_below_left)!0.5!(label_O_below)$);
\node[blue] at ($(O)!3mm!(label_O)$){$O$};
%The label for Q is typeset.
\coordinate (label_Q_left) at ($(Q)!-7mm!(P)$);
\coordinate (label_Q_right) at ($(Q)!-7mm!(A)$);
\coordinate (label_Q) at ($(label_Q_left)!0.5!(label_Q_right)$);
\node[blue] at ($(Q)!3mm!(label_Q)$){$Q$};
%The label for P is typeset.
\coordinate (label_P_above_right) at ($(P)!15mm!(50:8)$);
\coordinate (label_P_below) at ($(P)!15mm!(B)$);
\coordinate (label_P) at ($(label_P_above_right)!0.5!(label_P_below)$);
\node[blue] at ($(P)!3mm!(label_P)$){$P$};
%The label for R is typeset.
\coordinate (label_R) at ($(R)!-4mm!(P)$);
\node[blue] at (label_R){$R$};
%The labels for A and B are typeset.
\coordinate (label_A) at ($(A)!-3mm!(Q)$);
\node[blue] at (label_A){$A$};
\coordinate (label_B) at ($(B)!-3mm!(P)$);
\node[blue] at (label_B){$B$};
%A right-angle mark is drawn at A.
\coordinate (U_2) at ($(A)!4mm!-45:(O)$);
\draw[dashed] (U_2) -- ($(A)!(U_2)!(O)$);
\draw[dashed] (U_2) -- ($(A)!(U_2)!(Q)$);
%A right-angle mark is drawn at B.
\coordinate (U_3) at ($(B)!4mm!-45:(O)$);
\draw[dashed] (U_3) -- ($(B)!(U_3)!(O)$);
\draw[dashed] (U_3) -- ($(B)!(U_3)!(P)$);
%A right-angle mark is drawn at R.
\coordinate (U_4) at ($(R)!4mm!45:(P)$);
\draw[dashed] (U_4) -- ($(R)!(U_4)!(Q)$);
\draw[dashed] (U_4) -- ($(R)!(U_4)!(P)$);
%The angle at O with a measure of x is drawn.
\draw[draw=blue] (O) ++(10:5mm) arc (10:50:5mm);
\coordinate (label_for_x) at (30:0.75);
\node[font=\footnotesize] at (label_for_x){$x$};
%The angle at O with a measure of y is drawn.
\draw[draw=blue] (O) ++(50:7.5mm) arc (50:75:7.5mm);
\coordinate (label_for_y) at (62.5:0.9);
\node[font=\footnotesize] at (label_for_y){$y$};
%An angle at Q with measure x is drawn.
%\draw[draw=blue] let \p1=($(A)-(Q)$), \n1={atan(\y1/\x1)}, \p2=($(P)-(Q)$), \n2={atan(\y2/\x2)} in ($(Q)!0.5cm!(A)$) arc (\n1:\n2:0.5);
\path pic[draw=blue,angle radius=5mm,"$\scriptstyle{x}$",angle eccentricity=1.25] {angle = A--Q--P};
%The label x for the measure of the angle at Q is typeset. Not needed with angles library
%\coordinate (midpoint_of_PR) at ($(P)!0.5!(R)$);
%\coordinate (label_for_x_at_Q) at ($(Q)!0.75cm!(midpoint_of_PR)$);
%\node[font=\footnotesize] at (label_for_x_at_Q){$x$};
%An angle at P with measure x is drawn.
%\draw[draw=blue] let \p1=($(P)-(O)$), \n1={atan(\y1/\x1)}, \p2=($(P)-(R)$), \n2={atan(\y2/\x2)} in ($(P)!0.5cm!(R)$) arc (\n1:\n2:0.5);
\path pic[draw=blue,angle radius=5mm,angle eccentricity=1.25] {angle = R--P--O};
\end{tikzpicture}
\end{document}