add annotation on decoration points

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[dot/.style={
  postaction=decorate,
  decoration={markings,mark= between positions 0 and 1 step #1mm with{%
    \node[circle,inner sep=0.5pt,fill, label=\pgfdecoratedangle-90:{%
      \number\numexpr\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}-1}]{};%
    }
  }
}
]

\coordinate (O) at (0,0);
   \draw[dot=10] (O)
      \foreach \n in {1,...,4} {
         -- ++(-120:{\n*3-2}) --  ++(0:{\n*3-1}) -- ++(120:{\n*3})
      };
\end{tikzpicture}
\end{document}

enter image description here


One modified version to decorate with perpendicular lines.

\documentclass[tikz,border=10pt,convert={outfile=\jobname.jpg}]{standalone}
\usetikzlibrary{decorations.markings,calc}
\begin{document}
\tiny\begin{tikzpicture}
\tikzset{dot/.style={
  postaction=decorate,
   decoration={markings,mark=between positions 0 and 1 step #1mm with{%
    \pgfmathsetmacro{\desc}{int(\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}-1)}
    \draw (0,-3pt) -- node [label={\pgfdecoratedangle-90:\desc}] {} ++(0,6pt);
    } 
    }
  }
}
\def\m{5}
\coordinate (O) at (0,0);
   \draw[dot=3] (O)
      \foreach \n in {1,...,22} {
         -- ++({360/\m*Mod(\n,\m)}:{\n*0.3})
      };
\end{tikzpicture}
\end{document}

Output: enter image description here