4

The curvature of the circular arc indicating the angle at ∡OPR is backwards. The command that I used to draw it is the last line in the code.

\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}

enter image description here

  • That is not exactly minimal, is it? – cfr Aug 4 '15 at 23:19
  • @cfr No. It looks nice, though. – user74973 Aug 4 '15 at 23:22
  • \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); – Gonzalo Medina Aug 4 '15 at 23:23
  • @Gonzalo Medina It seems that you only added xscale=-1 to this command. I have not seen this option for the \draw command. What does it instruct TikZ to do? – user74973 Aug 4 '15 at 23:26
  • @user74973 it's a reflection through the y-axis. – Gonzalo Medina Aug 4 '15 at 23:27
2

The angles, calculated by atan, are not unambiguous. In the problematic case you get the other angles of the line parts outside P. Adding 180° and moving the starting point to PO helps:

\draw[draw=blue]
  let \p1=($(P)-(O)$),
      \n1={atan(\y1/\x1)+180},
      \p2=($(P)-(R)$),
      \n2={atan(\y2/\x2)+180}
  in
  ($(P)!0.5cm!(O)$) arc (\n1:\n2:0.5);

Result

  • Are you saying that with atan(\y1/\x1) and atan(\y2/\x2), the angles were in Quadrant I? – user74973 Aug 4 '15 at 23:41
  • @user74973 Yes. \n1 is 49.99329° and \n2 is 9.75604° in the code of the question. – Heiko Oberdiek Aug 4 '15 at 23:48
  • I have a question about using arc. Why does ($(P)!0.5cm!(R)$) arc (50:10:0.5) draw the arc the "wrong way" about P? The endpoints of the arc are in the "right places." – user74973 Aug 4 '15 at 23:59
  • 1
    @user74973 The arc has the correct form for an arc in the first quadrant of its center point, because its start and end angles are in the first quadrant. – Heiko Oberdiek Aug 5 '15 at 0:06
  • 1
    @user74973 The center point is indirectly determined in such a way, that the current point ($(P)!0.5cm!(R)$) is the starting point of the arc. The center point is reached by starting at the current point and going 0.5 cm with angle 50° in the reverse direction, that makes an angle of 50° + 180° = 230°. For illustration, the circle of the arc with center point: \draw[red] ($(P)!0.5cm!(R) + (50+180:0.5cm)$) circle[radius=1pt] circle[radius=0.5cm]; – Heiko Oberdiek Aug 5 '15 at 0:36
2

Another way to solve the ambiguity with atan is to reflect using xscale=-1 and moving the strating point to ($(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);

enter image description here

The complete code:

\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}
2

I don't know why you are loading the angles library but not using it. Let the library do the work. Use quotes library too if you want to label the angle.

\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};

Your code can be reduced drastically by this method. I have left comments in your code below.

\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}

enter image description here

  • I should have omitted the angles package. I was using this as an example to use the let - in syntax. – user74973 Aug 5 '15 at 0:27
  • How TikZ determines that P is the center point in the command ($(P)!0.5cm!(R)$) arc (50:10:0.5)? I am also trying to get familiar with the arc syntax. – user74973 Aug 5 '15 at 0:31
1

The last line should read:

\draw[draw=blue] let \p1=($(P)-(O)$), \n1={atan(\y1/\x1)}, \p2=($(P)-(R)$), \n2={atan(\y2/\x2)} in ($(P)!0.5cm!(R)$) arc (\n2:\n1:-.5);

and now this gives you:

enter image description here

  • The only change that you have is -0.5 for the radius. Why does that work? Why does TikZ draw it the wrong way with my command using 0.5 for the radius? – user74973 Aug 4 '15 at 23:29
  • 1
    @user74973 Using -.5 will have the effect of reflecting the radius, but then it will start drawing from PR so we reverse the order. – AboAmmar Aug 4 '15 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.