Украсьте контур стрелками в разных направлениях.

Украсьте контур стрелками в разных направлениях.

Вэтотpost подробно объясняется, как украсить контур стрелками. Как сделать то же самое, но так, чтобы один контур имел стрелки в одном направлении, а другой контур имел стрелки в противоположном? Контуры находятся в одной tikzpictureсреде. Возможно ли определить несколько экземпляров украшений, возможно?

решение1

Вы можете определить несколько разметок, а также изменить направление, нарисовав путь в обратном направлении или определив разметку с помощью обратных стрелок.

введите описание изображения здесь

\documentclass[border=2mm]{standalone}

\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\tikzset
  {marking1/.style=
     {decoration=
        {markings,
         mark=at position 0.5 with {\arrow[line width=1pt]{>}}
        },
      postaction=decorate
     },
   marking1reversed/.style=
     {decoration=
        {markings,
         mark=at position 0.5 with {\arrow[line width=1pt]{<}}
        },
      postaction=decorate
     },
   marking2/.style=
     {decoration=
        {markings,
         mark=at position 0.33 with {\arrow[line width=1pt]{stealth}},
         mark=at position 0.66 with {\arrow[line width=1pt,xscale=-1]{stealth}}
        },
      postaction=decorate
     }
  }
\begin{document}
\begin{tikzpicture}
  % a path with three sections
  \draw[marking1] (0,0) -- (2,0);
  \draw[marking1] (2,0) -- (1,1);
  \draw[marking1] (1,1) -- (0,0);
  % path drawn in the opposite direction, with the same marking
  \begin{scope}[xshift=3cm]
    \draw[marking1] (0,0) -- (1,1);
    \draw[marking1] (1,1) -- (2,0);
    \draw[marking1] (2,0) -- (0,0);
  \end{scope}
  % the original path, but with another marking that reverses the arrows
  \begin{scope}[xshift=6cm]
    \draw[marking1reversed] (0,0) -- (2,0);
    \draw[marking1reversed] (2,0) -- (1,1);
    \draw[marking1reversed] (1,1) -- (0,0);
  \end{scope}
  % the original path with a completely different marking
  \begin{scope}[xshift=9cm]
    \draw[marking2] (0,0) -- (2,0);
    \draw[marking2] (2,0) -- (1,1);
    \draw[marking2] (1,1) -- (0,0);
  \end{scope}
\end{tikzpicture}
\end{document}

Связанный контент