Let x and y be on the screen that is 600 by 400 and the tile is 1000 by 800. Then you get to tile coordinates with u(x,y)=(x - 600/2)* sin(a) + (y - 400/2)* cos(a) + 1000/2 v(x,y)=(x - 600/2)*cos(a) - (y - 400/2)*sin(a) + 800/2
The quick algorithm only uses integers and looks like this : s=sin(a)*256 c=cos(a)*256 u256=u(0,0)*256 v256=v(0,0)*256 for y=0 to 399 for x=0 to 599 screen[x,y]=map[u256 / 256, v256 / 256] u256 += s v256 += c end u256 += c - s*600 v256 += -s - c*600 end Dividing by 256 is right shift 8. You are correct that text will sometimes be upside down. Not very nice. So it's much better not to use image tiles, but to store the data in vector format. Then the PoIs and their text will not be rotated. But the program will look completely different ! 2009/6/12 jiatao83 <[email protected]> > Hi, Thanks for your kind reply! In fact, I have implemented the 2D > transform function,and when you get a big map tile, say 600*400, you will be > get an error of "Out of Memory" as you run this function.So could you please > show me your algorithm, Or give me some hints? Any suggestion is welcome, > Thanks. > However,If we rotate the map tile successfully,there is another problem, > For example, If i am driving along the road toward the south, and I get > an Map tile, I rotate the map tile by 180 degree, then the driving direction > is north, But the road name will be reversed. I mean the road name is a part > of the map tile image, it did not separate from the map tile, say the > annotation. This situation is really a problem. Any suggestions about this? > Thanks! Please help me! > Regards. > > tao > > > > ------------------------------ > 网易全新推出企业邮箱 <http://qiye.163.com/?ft=2> > _______________________________________________ > Routing mailing list > [email protected] > http://lists.openstreetmap.org/listinfo/routing > >
_______________________________________________ Routing mailing list [email protected] http://lists.openstreetmap.org/listinfo/routing
