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
http://stackoverflow.com/questions/2808393/draw-2-5d-or-3d-map-with-c-from-lines
However, above solution is quite okay for lines within the view port which is 0 < x < width and 0 < y < height . However there are lines that its points may have y < 0 or x < 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?
vvvv With 3D algorithm vvvv
.
vvvv Without 3D algorithm vvvv
Update:: After using this code
double x = p->x();
double y = p->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->setX(u);
p->setY(v);
return p;
The map become like following
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.