spatial index for lines
<p>I have lots of line segments (that represent various surfaces such as walls, ceilings and floors).  I want to efficiently determine which lines are within the player's bounding box.</p>

<p>(Right now I'm cycling through all lines, and whilst correct, it is proving much too slow).</p>

<p>There are several kd-tree and other spatial indices in Javascript but they all store points rather than lines.</p>

<p>I actually only need to query by the x axis; it would suffice with a 1D range tree of some sort.</p>

<p>How can you efficiently store and retrieve shapes such as lines?</p>

<p>Once built, the index would not be added to.</p>
