#### Archived

This topic is now archived and is closed to further replies.

# 3d sphere and 2d map

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

## Recommended Posts

Hi, i''m not sure if this is the good forum to post in, but i''m pretty stuck on this problem. Here''s the point: for a project in my studies, i got some kind of game to code where i''m given as parameters the size of the map (for example: 10x10, 15x25, 30x30). This map is composed of squares of equal size. The thing is that the map is circular, meaning that getting off an edge will make you re appear on opposite edge. I think that a 2d planar representation would really suck, and i would try to represent that as a real little planet. My problem is the following: given for example a map of 20x20, how can i divide a sphere surface in order to get 20x20 "cells" of equal size, and be sure that on any cell, a player will be surrounded by 8 cells. The other problem being of course to place correctly a player, knowing only his position is 4x6 for example I can''t really think of an easy solution. Any suggestion would be greatly appreciated ! Thank you.

##### Share on other sites
This forum is a fine place for your question. Although the forum policy doesn''t approve of homework questions in general, your problem is game development related so it is on topic. However, I ask forum members to only provide suggestions or hints to school projects, not answers.

That said, you can''t tessellate a sphere into 20 x 20 equal size quadrilateral cells that are convenient for mapping. But, if you''re willing to let your cells be NON-uniform in size (on the sphere---they''ll still be equal size in your map) then I suggest you look into UTM (Universal Transverse Mercator) projections. Google will help!

Your 2D wrapping approach is basically the same as a thing called toroidal terrain mapping, which actually works quite well for games, and is simpler than performing a UTM mapping.

Graham Rhodes
Principal Scientist
Applied Research Associates, Inc.

##### Share on other sites
don''t worry as my problem doesn''t really fit in the "homework stuff" as it is more of a bonus i''d like to implement for myself.

I''ve tried several possibilities now, and still none are suitable for my problem.
The fact is that i have several constraints. Let''s say my map is 20x20. Around 0x0, i should have the following:

20x20 | 20x00 | 20x01

00x20 | 00x00 | 00x01

01x20 | 00x01 | 01x01

As you can see, i can''t use mercator projection, because 20x20 and 0x0 would be diametrally opposed instead of being contiguous.

I''m really starting to wonder if there''s actually an answer to this problem =]

##### Share on other sites
there isnt.

you cant map a plane to a sphere without huge distortions AND some discontinueties. youd best check if its possible to drop the whole 20x20 grid idea.

1. 1
2. 2
3. 3
4. 4
Rutin
17
5. 5

• 11
• 20
• 12
• 11
• 41
• ### Forum Statistics

• Total Topics
631401
• Total Posts
2999869
×