I have a path consisting of a series of straight lines and arcs, and now I would like to modify that path by replacing some segments of the line/the arc with another small arc whose centre is on the original paths (see picture below).

[![The kind of path transformation I want to have (explained in words above)](https://i.stack.imgur.com/PYIhl.png)](https://i.stack.imgur.com/PYIhl.png)

Ideally I would like to only specify the original path and the locations (in per cent) of the original path where the detours should be added (and whether they should go to the left or to the right). The radius of all the small detour arcs is the same.

Is something like that possible (e.g. with decorations)?

I know how to do it manually, but that gets fairly tedious once you have a few of those detours, and you have to readjust a lot of things if you change the size of things.

**UPDATE**

As an example of what I had in mind, here's a curve with corresponding TikZ code as generated by a simple Haskell program. In the program I simply have to lists that specify at which y positions the vertical lines get wiggles and at which angles the arc gets wiggles. The rest involves only a little fiddling with the arc sine function.

This was more what I had in mind: To create a path using some macros (essentially just a "for each" loop).

[![A curve whose TikZ code has been generated by a program](https://i.stack.imgur.com/mElUw.png)](https://i.stack.imgur.com/mElUw.png)

```
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=6]
\draw[color=red,line width=0.4mm] (0.5,0.8660)arc (60.0000:72.1349:1) arc (-16.4325:166.4325:0.0500) arc (77.8651:87.1349:1) arc (-1.4325:181.4325:0.0500) arc (92.8651:102.1349:1) arc (373.5675:196.4325:0.0500) arc (107.8651:120.0000:1) -- (-0.5000, 1.0660) arc (270:90:0.0500) -- (-0.5000, 1.3160) arc (270:90:0.0500) -- (-0.5000, 1.5660) arc (270:90:0.0500) -- (-0.5000, 1.8660)  -- (0.5,1.8660) -- (0.5000, 1.6660) arc (90:270:0.0500) -- (0.5000, 1.4160) arc (90:270:0.0500) -- (0.5000, 1.1660) arc (90:270:0.0500) -- cycle;
\end{tikzpicture}
\end{document}

```

And the program that generated it:

```
import Text.Printf

foo' :: Double -> Double -> Double -> [Double] -> Double -> String
foo' r x l [] u = printf "-- (%.4f, %.4f) " x u
foo' r x l (y : ys) u = printf "-- (%.4f, %.4f) arc (270:90:%.4f) " x (y - r) r ++ foo' r x (y + r) ys u

foo'' :: Double -> Double -> Double -> [Double] -> Double -> String
foo'' r x l [] u = printf "-- cycle;"
foo'' r x l (y : ys) u = printf "-- (%.4f, %.4f) arc (90:270:%.4f) " x (y + r) r ++ foo'' r x (y - r) ys u

bar' :: Double -> Double -> [(Bool, Double)] -> Double -> String
bar' r l [] u = printf "arc (%.4f:%.4f:1) " l u
bar' r l ((left, y) : ys) u = printf "arc (%.4f:%.4f:1) arc (%.4f:%.4f:%.4f) " l (y - alpha) (y - s * beta + delta) (y + s * beta) r ++ bar' r (y + alpha) ys u
  where alpha = 2 * asin (r/2) * 180 / pi
        beta = asin (r / 2) * 180 / pi + 90
        s = signum (u - l)
        delta = if left /= (l > u) then 0 else 360 * s

ys = map ((+) (sqrt 3 / 2)) [0.25, 0.5, 0.75]
phis = [(True, 75), (True, 90), (False, 105)]

narf r h ys phis = "\\draw[contour1] " ++
   printf "(0.5,%.4f)" (sqrt 3 / 2 :: Double) ++
   bar' r 60 phis 120 ++
   foo' r (-0.5) (sqrt 3 / 2) ys (h + sqrt 3 / 2) ++
   printf " -- (0.5,%.4f) " (h + sqrt 3 / 2) ++
   foo'' r 0.5 (h + sqrt 3 / 2) (reverse ys) (sqrt 3 / 2)

main = 
  do putStrLn $ narf 0.05 1 ys phis

```