title: Problem with bird's eye view or 2.5D rendering of Map
body: <p>I'm developing a turn-by-turn navigation software and I'm using the following solution to make my lines of roads into 2.5D or 3D View</p>
  
  <p><a href="https://stackoverflow.com/questions/2808393/draw-2-5d-or-3d-map-with-c-from-lines">Draw 2.5D or 3D Map with C# from lines</a></p>
  
  <p>However, above solution is quite okay for lines within the view port which is 0 &lt; x &lt; width and 0 &lt; y &lt; height . However there are lines that its points may have y &lt; 0 or x &lt; 0 or y > height or x > width and then the above solution gone crazy. Could anyone help me figure out how to solve the problem?</p>
  
  <p>vvvv With 3D algorithm vvvv</p>
  
  <p><img src="https://i.stack.imgur.com/z1els.png" alt="alt text"></p>
  
  <p>.</p>
  
  <p>vvvv Without 3D algorithm vvvv</p>
  
  <p><img src="https://i.stack.imgur.com/Dxp6t.png" alt="alt text"></p>
  
  <p>Update::
  After using this code</p>
  
  <pre><code>double x = p-&gt;x();
  double y = p-&gt;y();
  
  double t = -0.5;
  x = x - w / 2;
  y = y - h / 2;
  double a = h / (h + y* sin(t));
  double u = a * x + w / 2;
  double v = a * y * cos(t) + h / 2;
  
  p-&gt;setX(u);
  p-&gt;setY(v);
  return p;
  </code></pre>
  
  <p>The map become like following
  <img src="https://i.stack.imgur.com/rtEAz.png" alt="alt text"></p>
  
  <p>I think there's something wrong with Y calculations when they go way beyond negative values. I'm using Qt and cracks at line seems bug with Qt renderer, not related to our original problem.</p>