Jump to content
  • Advertisement
Sign in to follow this  

Sphere to plane formula (and 2 other questions)

This topic is 4523 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a map of the earth which is a 2:1 ratio (1024x512). The projection used to obtain that map is "Behrmann Cylindrical Equal-Area" (I got it from NASA). I would be interested to find out the formula that would convert a 2d (x, y) point on that map to a 3d point on a shpere (x, y, z). Another thing I am interested in is a formula to calculate the shortest path between 2 points on a sphere (no obstacles between those 2 points). Finally, does someone know the algorithm to make such a map sun lit, giving the time of the year and hour? As in, which points are in the night, which ar ein the day, and which are in between. Thanks, and Happy New Year!

Share this post


Link to post
Share on other sites
Advertisement
Question 1:

You're looking to map a Plane to a Sphere, not visa versa, and it kinda matters. Google it. The easiest way (IMO) is cylinder projection. There are some other projection models, but I think this will work for you.

The shortest path between any two points on a sphere (without penetrating the sphere) is an arc (obviously), and for that you can use an arc length calculation.

Lastly, for the solar system, you basically have to map out the orbit of the planet. There are tons of resources on how to do this, but this step has also got to be the worst. There are commercially available sun-light systems that cost a pretty penny (and I believe one comes built into 3D Studio Max), you might want to check out one of those before you implement your own.

Hope this helps.

Share this post


Link to post
Share on other sites
Hi, and thanks for the answers.
That projection technique is not exactly the one used by my map, because the height of the cylinder seems to be equal with the height of the map, but in the link you posted the height of the cylinder is bigger. And now that you've mentioned it, I need both the converisons between plane->sphere and sphere->plane.
Basically, what I am trying to do is have a game similar to the first X-Com games, but instead of using a globe, use a flat map, so you have everything on the screen at once.

For the #2, I actually need the path too, not only the distance. And unfortunatly my maths skills are not that good when it comes to calculus, so is there any formula that deals only with geometry, trigonometry and algebra?

The #3 thing, I don't think it is that complicated, and my goal is to have the night moving 'in real time' on the map (actually much faster than the real time). I am not interested in a lot of accuracy though, it is for a game afterall.
I know there have to be more simple ways because I've seen some web pages that can display the map of the earth with the night map by providing the time and date.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!