# How to incrementally shorten lines generated by TikZ's foreach command?

I'm trying to draw a picture of an initial segment of the cumulative hierarchy of set theory. I generated the following MWE:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[thick, scale=2.0]
\draw[ultra thick] (0,0) -- (1,2);
\draw[ultra thick] (0,0) -- (-1,2);
\foreach \y in {.3, .6,...,2}
\draw (-1,\y) -- (1,\y);
\end{tikzpicture}
\end{document}


Which produces the following picture:

The vertical spacing of the horizontal lines is correct, but how do I shorten them so that they end at the lines of the V rather than stretching beyond them?

EDIT: The accepted answer perfectly answers the question asked. The answer from cfr, however, provides a more general solution and so may be preferred.

-

The solution is solving two linear equations.

\documentclass[border=6pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[thick, scale=2.0, auto]
\draw[ultra thick] (0,0) -- (1,2);
\draw[ultra thick] (0,0) -- (-1,2);
\foreach \y in {.3, .6,...,2}
\draw (-1/2*\y,\y) -- (1/2*\y,\y);
\end{tikzpicture}
\end{document}


-

This doesn't, strictly speaking, answer the question because it does not work within the loop but acts as a constraint on the loop. However, the effect is the same.

You can use \clip to clip the lines to the required area and not worry about specifying how long they should be. Although it is relatively simple to figure out how long they should be in this case, that is not always so. Hence, clipping is a generally useful technique which can be applied in more complex cases.

\documentclass[margin=10pt,tikz,multi]{standalone}
\begin{document}
\begin{tikzpicture}[thick, scale=2.0]
\draw[ultra thick] (-1,2) -- (0,0) -- (1,2);
\clip (-1,2) -- (0,0) -- (1,2) -- cycle;
\foreach \y in {.3, .6,...,2} \draw (-1,\y) -- (1,\y);
\end{tikzpicture}
\end{document}


-
Thanks, this answers the question I should have asked :) – Dennis Jan 17 at 3:35