title: skyline algorithm for triangles
body: <p>I am trying to write an algorithm to find the upper envelop (skyline) of triangles.
  By following you can see the skyline of rectangles:
  <img src="https://i.stack.imgur.com/7eHhk.gif" alt="enter image description here"></p>
  
  <p>I have an algorithm for merging two skylines(L and R) of rectangles as follows: </p>
  
  <ul>
  <li>represent each rectangle by (x1, x2, h) where h is height and x2-x1 is width</li>
  <li>represent each skyline by a list of couple (x, h) </li>
  <li>for i= min(L[ 1].x, R[ 1].x) to max(L[size of L].x, R[size of R].x) choose max(L[i].h, R[i].h)</li>
  </ul>
  
  <p>Now, my question is how can I <strong>represent triangle</strong> and how I can <strong>merge skylines of two triangles</strong></p>
  
  <p>any idea will be appreciated</p>