Longitude/Latitude to screen coordinates

In summary, the game has 3 levels of view: 2d view, 2d view with textures, and 3d view with a sphere. Level 3 view is a rectangular bitmap that covers the sphere.
  • #36
jarednjames said:
You then plot them on the grid overlaid on the map.

i already have the process against the DB, mean i have an image pattern for each object i have on the DB and i can draw it on the big texture based on the object's coordinate (long, lat).
but after that all of the objects are draw on the big image, i need to distort the image to be like image #1 ( or maybe distort the object before i plot it on the biug image) and this is what I'm looking for: how can i know how much distortion (via transformation) i need to do for object that for instance, located on the equator of for object that located on the north?
 
Technology news on Phys.org
  • #37
Why do you need to distort it?

If you print the images onto the map, and then save that as a new temporary image (so you have a flat map with the objects on it as a picture file), you can simply wrap that directly onto the world with your engine. It will do the distortion for you.

It's not the best way to do it, but it's the easieast if you want to check the results.
 
  • #38
as i understanding, the distortion is needed.
to show you that - i took the same 2d image like before (2d.png) and i added a non-distorted object on it (the gray one) but i left the distorted one (yellow), now, you can see those objects on the sphere (sphere1.jpg, sphere2.jpg and sphere3.jpg), the distorted (yellow) look realistic but the gray one (that have the same dimensions like the red but another location on the world) not appear realistic, if I'll convert it with the same distortion like the yellow one it'll looks fine.

Over the weekend i read a children book (of my little daughters) that explain things about geography and i found an explanation about how create maps based on sphere (see cBookMerkator.jpg) and i found the 'Mercator projection' method, i think this is what i need but i need to find the proper math formula that let me create the distortion function.
i found http://www.experts-exchange.com/Programming/Algorithms/Q_24509438.html" article on the internet but the answers are costing money :) so i'll keep search.

[P.S. sphere1.jpg and cBookMerkator.jpg are attached on the next post]
 

Attachments

  • 2d.jpg
    2d.jpg
    5.6 KB · Views: 385
  • sphere2.jpg
    sphere2.jpg
    8.8 KB · Views: 384
  • sphere3.jpg
    sphere3.jpg
    13.5 KB · Views: 369
Last edited by a moderator:
  • #39
attached sphere1.jpg and cBookMerkator.jpg for the previous post
 

Attachments

  • sphere1.jpg
    sphere1.jpg
    13.3 KB · Views: 411
  • cBookMerkator.jpg
    cBookMerkator.jpg
    31.7 KB · Views: 426
  • #40
I don't know what you're going on about. You're not reading anything I've written.

I've told you exactly what you need to do.

You do not need the above merkator technique - that is for expanding a globe and you are not doing that.

For the last time:

1. Plot your objects onto the flat 2D map (the rectangle one you want to wrap).
2. Save that as a temporary image.
3. Wrap it on the globe.
4. The engine will distort the map and the items you marked on it.

That's all there is to it.
 
  • #41
OK.. thanks for your patient... i'll try it.
 
Back
Top