title: How to implement line sweep which has been used in van kreveld algorithm in c language for viewshed computation?
body: <p>Earlier I was using this algorithm to compute viewshed from a given point <code>V</code>:</p>
  
  <ol>
  <li><p>for a given point <code>V</code> go through every point (coordinate) in the grid (calling it a target point <code>T</code>).</p></li>
  <li><p>find every coordinate point <code>p</code> through which <code>VT</code> is passing.</p></li>
  <li><p>if <code>height(p) &lt; height(V) + |p - V|/|T - V| * (T-V)</code> then the point <code>T</code> is visible from <code>V</code></p></li>
  </ol>
  
  <p>computing it for every point in the set (by considering them targets T) is daunting task &amp; when I try to compute viewshed for every point then it becomes scary.</p>
  
  <p>I read about line sweep used by van kreveld but I didn't understand and have no idea how to proceed &amp; please suggest me appropriate data structure for storing the data (DEM), its processing and storing the processed data. I am a novice programmer, please help me.</p>
  
  <p>PS: if you have some better approach/algorithm then please share it and put this poor man out of this misery.</p>