# Place symbols/nodes at intersection between an arc and some horizontal lines with \foreach in TikZ

I'd like to place an symbol I've defined at all the intersection point between an arc and some horizontal lines:

I know how to use \foreach for other cases, but I'm really not sure how to setup the code in order to make this work

E.g. I want to place

\def\pulse{+(0.1,0) -- +(0.2,0.1) -- +(0.3,-0.1) -- +(0.4,0)}


at every position where the line for the arc intersects the horizontal lines, but I've obviously not reached that level for using TikZ yet.

So the question is, does anyone know how I can do this?

I'd assume it'd be something like

\foreach \pos in {don't know what to type here}
{
some kind of if-checking
place if true
}


but I don't know what to write. Any help is greatly appreciated!

best regards, dm

*Edit: In case it will be easier to help if having the code for the figure available:

\tikzstyle{branch} = [circle, inner sep = 0pt, minimum size = 0.5mm, fill = black, draw = black]

\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}

\begin{tikzpicture}[semithick,>=latex']
\def\pulse{+(0.1,0) -- +(0.2,0.1) -- +(0.3,-0.1) -- +(0.4,0)}

\node[branch] (fp) at (-2,10) {};
\node[above] at (fp.north) {\scriptsize Focal point};

% draw rectangle in array
\draw[semithick] (2,9.5) -- (2.25,9.5) -- (2.25,5) -- (2,5) -- cycle;

% draw horizontal lines inside array
\foreach \y in {5,5.5,...,9}
\draw[semithick] (2,\y) -- (2.25,\y);
\node[above] at (2.125,9.5) {\scriptsize Array};

\foreach \y in {5.25,5.75,...,9.25}
{
% draw lines from focal point to array
\draw[semithick,->] (fp.center) -- (2,\y);

% draw VGA amplifiers
\draw[semithick,fill=white] (5.5,\y) -- ($(5.5,\y)+(0,0.2)$) -- (6,\y) -- ($(5.5,\y)+(0,-0.2)$) -- cycle;
% draw arrows thru VGA amplifiers
\begin{pgfonlayer}{background}
\draw[semithick,->] ($(5.6,\y)+(0,-0.25)$) -- ($(5.95,\y)+(0,0.2)$);
\end{pgfonlayer}

\draw[semithick] (6.2,\y) -- ($(6.4,\y)+(0,0.2)$) -- ($(7.2,\y)+(0,0.2)$) -- ($(7.2,\y)+(0,-0.2)$) -- ($(6.4,\y)+(0,-0.2)$) -- cycle;

% draw FIFO block
\draw[semithick] (7.6,\y) -- ($(7.6,\y)+(0,0.2)$) -- ($(8.4,\y)+(0,0.2)$) -- ($(8.4,\y)+(0,-0.2)$) -- ($(7.6,\y)+(0,-0.2)$) -- cycle;
\node[] at (8,\y) {\scriptsize FIFO};

% draw lines in between the blocks already drawn
\draw[semithick,->] (2.25,\y) -- (5.5,\y);
\draw[semithick,->] (6,\y) -- (6.2,\y);
\draw[semithick,->] (7.2,\y) -- (7.6,\y);
\draw[semithick,->] (8.4,\y) -- (9,\y) -- ($(9,\y)+(0,0.2)$) -- ($(9.2,\y)+(0,0.2)$) -- (9.2,\y) -- (10,\y);
}

% draw arc before array
\draw[semithick,dashed] (2,9.6) arc(0:-60:5.15);
% draw arc after array
\draw[semithick,dashed] (5.1,9.6) arc(0:-60:5.15);

% draw rectangle for digital adder
\draw[semithick] (10,9.5) -- (10.5,9.5) -- (10.5,5) -- (10,5) -- cycle;
\node[rotate=90] at (10.25,7.25) {\scriptsize Digital adder};

% draw output signal
\draw[semithick,] (10.5,7.25) -- (11,7.25) -- (11,7.75) -- (11.25,7.75) -- (11.25,7.25) -- (11.5,7.25);
\node[above] at (11.125,7.75) {\scriptsize$\begin{matrix}\text{Output}\\\text{signal}\end{matrix}$};

% draw arrow for sampling clock
\draw[semithick,->] (6.7,4.5) -- (6.7,5.05);
\node[below] at (6.7,4.5) {\scriptsize Sampling clock};

% draw line in between every ADC
\foreach \y in {5.25,5.75,...,8.75}
\draw[semithick] ($(6.7,\y)+(0,0.2)$) -- ($(6.7,\y)+(0,0.3)$);

\end{tikzpicture}

-

You can use the intersections library for this. To use it, give the paths you want to intersect a name using name path, then name the intersections using intersections={of=<path 1> and <path 2>}. The intersections will then be available as intersection-1, intersection-2, etc.

\documentclass[12pt]{article}

\usepackage{tikz}
\usetikzlibrary{intersections}

\begin{document}

\begin{tikzpicture}
\def\pulse{+(0.1,0) -- +(0.2,0.1) -- +(0.3,-0.1) -- +(0.4,0)}

\draw[semithick,dashed,name path=arcafter] (5.1,9.6) arc(0:-60:5.15);

\foreach \y in {5.25,5.75,...,9.25}
{
\draw[semithick,->,name path=arrow] (2.25,\y) -- (5.5,\y);
\draw[name intersections={of=arcafter and arrow}] (intersection-1) ++(-0.2,0) \pulse;
}

\end{tikzpicture}

\end{document}

-
Thanks for your answer! Exactly what I was looking for. I found out about the intersections library yesterday, but I didn't figure out how to access the intersections, so thanks again! Best regards, dm –  militiaOfDeath Aug 1 '11 at 9:33