0

I want to draw an inner angle of a path or a n-gon. I have found out the post Label angle with tikz.

Following the code there and using the package \usetikzlibrary{decorations.markings}, I write

\tikzset{middlearrow/.style={
        decoration={markings,
            mark= at position 0.5 with {\arrow{#1}} ,
        },
        postaction={decorate}
    }
}

\newcommand{\tikzAngleOfLine}{\tikz@AngleOfLine} \def\tikz@AngleOfLine(#1)(#2)#3{% \pgfmathanglebetweenpoints{% \pgfpointanchor{#1}{center}}{% \pgfpointanchor{#2}{center}} \pgfmathsetmacro{#3}{\pgfmathresult}% }

\begin{tikzpicture}

\coordinate (A0) at (-1,-0.3); \coordinate (A1) at (-1.4,-1); \coordinate (A2) at (-1,-1.8); \coordinate (An-2) at (0.8,-1.8); \coordinate (An-1) at (1,-1); \coordinate (An) at (0,0); \coordinate (An+1) at (0,-1);

\draw[middlearrow={latex}] (A0) -- (A1);

\draw[middlearrow={latex}] (A1) -- (A2);

\draw[middlearrow={latex},dashed] (-1,-1.8) to [bend right] (An-2);

\draw[middlearrow={latex}] (An-2) -- (An-1);

\draw[middlearrow={latex}] (An-1) -- (An);

\draw[middlearrow={latex}] (An) -- (An+1);

\node at (-1,0) {\small $A_0$};

\node at (-1.7,-1) {\small $A_1$};

\node at (1.5,-1) {\small $A_{n-1}$};

\node at (0,0.2) {\small $A_{n}$};

\node at (0,-1.25) {\small $A_{n+1}$};

\tikzAngleOfLine(A1)(A0){\AngleStart} \tikzAngleOfLine(A1)(A2){\AngleEnd} \draw[red,<->] (A1)+(\AngleStart:0.2cm) arc (\AngleStart:\AngleEnd:0.2 cm);

\tikzAngleOfLine(An-1)(An-2){\AngleStart} \tikzAngleOfLine(An-1)(An){\AngleEnd} \draw[red,<->] (An-1)+(\AngleStart:0.2cm) arc (\AngleStart:\AngleEnd:0.2 cm);

\tikzAngleOfLine(An)(An-1){\AngleStart} \tikzAngleOfLine(An)(An+1){\AngleEnd} \draw[red,<->] (An)+(\AngleStart:0.3cm) arc (\AngleStart:\AngleEnd:0.3 cm);

\end{tikzpicture}

\begin{tikzpicture}

\coordinate (An-1) at (0:1.2); \coordinate (An) at (45:1.2); \coordinate (A1) at (90:1.2); \coordinate (A2) at (135:1.2); \coordinate (A3) at (180:1.2);

\draw[middlearrow={latex}] (An-1) -- (An);

\draw[middlearrow={latex}] (An) -- (A1);

\draw[middlearrow={latex}] (A1) -- (A2);

\draw[middlearrow={latex}] (A2) -- (A3);

\draw[middlearrow={latex},dashed] (180:1.2) -- (225:1.2);

\draw[middlearrow={latex},dashed] (225:1.2) -- (270:1.2);

\draw[middlearrow={latex},dashed] (270:1.2) -- (315:1.2);

\draw[middlearrow={latex},dashed] (315:1.2) -- (360:1.2);

\node at (0:1.6) {\small $A_{n-1}$}; \node at (45:1.6) {\small $A_n$}; \node at (90:1.6) {\small $A_1$}; \node at (135:1.6) {\small $A_2$}; \node at (180:1.6) {\small $A_3$};

\tikzAngleOfLine(An)(An-1){\AngleStart} \tikzAngleOfLine(An)(A1){\AngleEnd} \draw[red,<->] (An)+(\AngleStart:0.2cm) arc (\AngleStart:\AngleEnd:0.2 cm);

\tikzAngleOfLine(A1)(An){\AngleStart} \tikzAngleOfLine(A1)(A2){\AngleEnd} \draw[red,<->] (A1)+(\AngleStart:0.2cm) arc (\AngleStart:\AngleEnd:0.2 cm);

\tikzAngleOfLine(A2)(A1){\AngleStart} \tikzAngleOfLine(A2)(A3){\AngleEnd} \draw[red,<->] (A2)+(\AngleStart:0.2cm) arc (\AngleStart:\AngleEnd:0.2 cm); \end{tikzpicture}

I am able to draw the following:

enter image description here

The angle $\angle A_0A_1A_2$ in the Figure 1 and the angle $\angle A_1A_2A_3$ in the Figure 2 should be flipped. In other words, I need to draw the complement angle of an angle. However, I cannot figure out how to flip them. Please give me some advices.

  • have alook here --https://tex.stackexchange.com/a/567764/197451 -- the complement of angle is simply put by reversing the vertices from B,C,A to A,C,B in \tkzMarkAngle(B,C,A) – js bibra Oct 28 '20 at 14:18

1 Answers1

1

I'd just use the angles from the angles library. The following code is still more verbose than needed.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{angles,decorations.markings,arrows.meta,bending}
\tikzset{middlearrow/.style={
        decoration={markings,
            mark= at position 0.5 with {\arrow{#1}} ,
        },
        postaction={decorate}
    }}
\begin{document}
\begin{tikzpicture}
 \path[node font=\small] 
  (-1,-0.3) coordinate (A0) node[above]{$A_0$}
  (-1.4,-1) coordinate (A1) node[left]{$A_1$}
  (-1,-1.8) coordinate (A2)
  (0.8,-1.8) coordinate (An-2)
  (1,-1) coordinate (An-1) node[right]{$A_{n-1}$}
  (0,0) coordinate (An) node[above]{$A_n$}
  (0,-1)  coordinate (An+1);
 \path[line cap=round,every edge/.append style={middlearrow=latex}]  
  (A0) edge (A1)
  (A1) edge (A2)
  (A2) edge[bend right,dashed] (An-2)
  (An-2) edge (An-1)
  (An-1) edge (An)
  (An) edge (An+1);
 \path[angle radius=1em,
    pic actions/.append style={draw=red,{Stealth[bend]}-{Stealth[bend]}}] 
  pic{angle=A2--A1--A0} 
  pic{angle=An--An-1--An-2} 
  pic[angle radius=1.5em]{angle=An+1--An--An-1};
\end{tikzpicture}
\end{document}

enter image description here