# Tikz: drawing a zig zag line inside a circle

I need to draw a zig-zag line inside a circle without using decorations. The size and positioning of the line should be relative to the size of the circle. I used this code:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}

\node[draw,circle,minimum size=1cm] (C) at (0,0){};

\draw    ($($ (C.west)!.1!(C.east) $)-(0,30pt)$)  --($(C.west)!.1!(C.east)$)
--($(C.west)!.25!(C.east)$)              --($($ (C.west)!.3!(C.east) $)+(0,3pt)$)
--($($ (C.west)!.4!(C.east) $)-(0,3pt)$)   --($($ (C.west)!.5!(C.east) $)+(0,3pt)$)
--($($ (C.west)!.6!(C.east) $)-(0,3pt)$)   --($($ (C.west)!.7!(C.east) $)+(0,3pt)$)
--($(C.west)!.75!(C.east)$)              --($(C.west)!.9!(C.east)$)
--($($ (C.west)!.9!(C.east) $)-(0,30pt)$);
\end{tikzpicture}

\end{document}


to get this:

The problem is that if I want to resize the circle, the vertical lines gets too short (or too long) and I have to fix the "vertical coordinate" manually.

It is possible to anchor the vertical coordinate relative to the node's shape??

-
Why does it need to be without decorations? – Jake May 11 '12 at 10:07
I thought this issue was resolved in one of your previous questions. What is your real concern about this picture that has been the subject of 5 questions already? :) Note that, resistor shape must comply with some standards. – percusse May 11 '12 at 10:12
@percusse and jake: in previous questions I used the decoration library but I couldn't fit the shape of the zig-zag lines to my needs. Also the shape I need it's not really a zig zag line. – Angelo May 11 '12 at 10:24
@jake: thank you...the solution was very easy ;) – Angelo May 11 '12 at 10:29

Instead of defining the "legs" as (0,-30pt) (which, of course, doesn't scale), you can use ($(C.north)-(C.south)$):

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}

\node[draw,circle,minimum size=1.2cm] (C) at (0,0){};

\draw    ($($ (C.west)!.1!(C.east) $)-($(C.north)-(C.south)$)$)--($(C.west)!.1!(C.east)$)
--($(C.west)!.25!(C.east)$)--($($ (C.west)!.3!(C.east) $)+(0,3pt)$)
--($($ (C.west)!.4!(C.east) $)-(0,3pt)$)--($($ (C.west)!.5!(C.east) $)+(0,3pt)$)
--($($ (C.west)!.6!(C.east) $)-(0,3pt)$)--($($ (C.west)!.7!(C.east) $)+(0,3pt)$)
--($(C.west)!.75!(C.east)$)--($(C.west)!.9!(C.east)$)
--($($ (C.west)!.9!(C.east) $)-($(C.north)-(C.south)$)$);
\end{tikzpicture}
\begin{tikzpicture}

\node[draw,circle,minimum size=1.8cm] (C) at (0,0){};

\draw    ($($ (C.west)!.1!(C.east) $)-($(C.north)-(C.south)$)$)--($(C.west)!.1!(C.east)$)
--($(C.west)!.25!(C.east)$)--($($ (C.west)!.3!(C.east) $)+(0,3pt)$)
--($($ (C.west)!.4!(C.east) $)-(0,3pt)$)--($($ (C.west)!.5!(C.east) $)+(0,3pt)$)
--($($ (C.west)!.6!(C.east) $)-(0,3pt)$)--($($ (C.west)!.7!(C.east) $)+(0,3pt)$)
--($(C.west)!.75!(C.east)$)--($(C.west)!.9!(C.east)$)
--($($ (C.west)!.9!(C.east) $)-($(C.north)-(C.south)$)$);
\end{tikzpicture}

\end{document}

-