Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Mapping Points, Zones, etc on a Sphere

  1. #11
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Re: Mapping Points, Zones, etc on a Sphere

    Quote Originally Posted by User137
    Ok i might throw some ideas:
    - First thought came that sphere can consist of spherified cube; say a cube with NxN grid on each of 6 sides and vertices moved so they are from equal length out of center. This divides sphere more evenly into "tiles". Each side is 90 degrees away from each other.
    I'm not sure I quite grasp the purpose of creating a cube for the sake of simulating a sphere... :scratch:

    Quote Originally Posted by User137
    - Day night calculation. 2 parameters needed: Earth rotation angle, Earth angle towards sun.
    I assumed that day/night would probably be the easiest of them all, heck if I went 2D then it would be a simple matter of using the day/night texture too if I wanted.

    Quote Originally Posted by User137
    - Positioning, i'd place every object using 3D coordinates instead of 2D even when it's surface of sphere. That way it is easier to calculate distances and pathing. Note that paths still aren't linear; earth isn't flat Path creates an arc instead of line.. not bothered to draw it, formula might be easy to make.
    This seems like it might be the toughest way to do this. Nevermind that my math is weak in this area, but the fact that determaning zones would be a royal pain, no?

    But you have a very good point about the non-flat earth. I know the kind of arch that a path of that size would make having looked at a few charts that plot stuff like that in the Navy, etc... I do believe that there must be a way to calculate a path in 2D though.

    Quote Originally Posted by User137
    - Zones/continents could propably be made of arrays of 3D points forming the outlines. Bit tricky checking if object is in area. Only other choice i can think of would be marking each "tile" with zone info, however this is very rough solution. Even as rough solution it could still be used as pre-calculation, narrowing down the choices quickly.
    I think this is what kills me wanting to do 3D entirely. It's already my weak area and this blows what I know out of the water. So it looks like full calculations 3D are out.


    I do want to have a 3D representation if I can manage it though. So I guess the only 3D calculations I'll need at from 2 to 3. This does leave the open question of how does one calculate a path simulating the curvature of the earth, given the radius/diameter of the earth across a 2D plane. Gives me something to Google for I guess.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  2. #12

    Mapping Points, Zones, etc on a Sphere

    Here's image explaining the spherified cube:
    http://i8.tinypic.com/67qxyjb.png

    Sounds like you got some interesting 3D maths to study Vectors and matrices are much fun when you get to know them better.

  3. #13
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Mapping Points, Zones, etc on a Sphere

    Ah ha! looky what I found

    Code:
    Distance = Radius * acos( cos(Lat1)*cos(Lat2)*cos((Long1-Long2)) + sin(Lat1)*sin(Lat2) )
    Ok I've got my distance function... Put simply it uses the great-circle formula to figure it out.

    Now... I think what I'm aiming for is to figure out how to get a 2D vector from my current point to the destination point. I'd obviously be updating this vector each iteration of my main game loop to get an accurate simulated curve.


    btw, I think that I'm going to stick with knots and lat/long for my co-ordinate system. It'll be easiest for both development and the players to wrap their heads around. (Has worked for hundreds of years so far, right? )
    Jason McMillen
    Pascal Game Development
    Co-Founder





  4. #14
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Mapping Points, Zones, etc on a Sphere

    Ok this is really killing me. I can't find a direct answer anywhere, is this such a rare thing to look for?

    Best I could find is: this and this. :?


    What I need to know is how do I plot on an orthographic map of the 'real' shortest movement from one point to another on the surface of a sphere in the form of a simple 2D vector?

    I imagine that I'll need an equation that takes the current point, the destination point, the radius of the earth and speed to provide me with a pair of 2D VelX and VelY values. So I guess 2 equations then.

    Anyone know how to do this?

    I should be able to create results similar to something like this...

    Jason McMillen
    Pascal Game Development
    Co-Founder





  5. #15

    Mapping Points, Zones, etc on a Sphere


Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •