Decorating an edge of a cycle in tikz
A simple solution with using of node
in the border where needed:
\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[fill=gray, rounded corners]
(0,0) -- (0,1) -- node[circle, draw, fill=white, inner sep=1.5pt] {} (1,1) -- (1,0) -- cycle;
\end{tikzpicture}
\end{document}
Addendum: Instead nodes with selected shapes, you can also use pic
which can contain arrows etc. For example:
\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[
arr/.pic = {\draw[-{Straight Barb[width=3pt]}] (-1pt,0) -- (1pt,0);}
]
\draw[fill=gray, rounded corners]
(0,0) -- (0,1) -- pic {arr} (1,1) -- (1,0) -- cycle;
\end{tikzpicture}
\end{document}
The answer to "Decorating an edge of a cycle in tikz" is to use edge[decorate]
.
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\draw[fill=gray, rounded corners, decoration={markings,mark=at position .5 with {\draw[black, fill=white] circle[radius=2pt];}}]
(0,0) -- (0,1) edge[decorate] (1,1) --
(1,1) -- (1,0)-- cycle;
\end{tikzpicture}
\end{document}
Here is an extended comment since there is another post which points out what had been pointed out several times already, e.g. here: you can use a pic
for the arrow. I'd like to complement the statement by adding that you need the sloped
and allow upside down
keys to make that work properly.
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[circ/.style={circle, draw, fill=white, inner sep=1.5pt},
pics/arr/.style={code={\draw[-{Stealth[length=#1,fill=black]}] (-#1/2,0) --
(#1/2,0); }},pics/arr/.default=1ex]
% https://tex.stackexchange.com/a/430486
\draw[fill=gray, rounded corners]
(0,0) -- (0,1) -- node[circ]{} (1,1) --
pic[sloped,allow upside down]{arr} (1,0) --
pic[sloped,allow upside down]{arr=1.2ex} cycle;
\end{tikzpicture}
\end{document}