Results 1 to 3 of 3

Math Help - Map Coordinates

  1. #1
    Newbie
    Joined
    May 2009
    Posts
    2

    Map Coordinates

    Hey math geniuses, I hope this is the right forums, and I have a rather difficult math question here.

    I'm learning games development and currently have a project in the making using DarkBasic, one thing I always fail on is math, luckily the language I use has many libraries of functions available that take a load off, especially when it comes to mathimatics.

    Programming logic is no problem for me, but math is where I fail miserably

    Anyways what I'm getting to is, I have a virtual world which has a size of 2000.0 x 2000.0, however the actual coordinates for the world are:

    x = -1000.0 (West) to +1000.0 (East)
    z = -1000.0 (South) to +1000.0 (North)

    And 0,0 would be dead center.

    I want to create a birds-eye view mini-map of the world, and plot a mark where I am on the mini-map relative to the vitual world, the mini-map would be 500 x 500 pixels, in programming terms in case you don't know this would be:

    x = 0 (Left) to 500 (Right)
    z = 0 (Top) to 500 (Bottom).

    And 250,250 would be dead center, now how would I do the math for this?

    Cheers.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member
    Joined
    Jan 2009
    Posts
    591
    Quote Originally Posted by W1z8it View Post
    ...
    Programming logic is no problem for me...

    a virtual world which has a size of 2000.0 x 2000.0,
    the actual coordinates for the world are:

    x = -1000.0 (West) to +1000.0 (East)
    z = -1000.0 (South) to +1000.0 (North)

    And 0,0 would be dead center.


    I want to create a birds-eye view mini-map of the world, and plot a mark where I am on the mini-map relative to the vitual world, the mini-map would be 500 x 500 pixels, in programming terms in case you don't know this would be:

    x = 0 (Left) to 500 (Right)
    z = 0 (Top) to 500 (Bottom).

    And 250,250 would be dead center, now how would I do the math for this?

    IF the mini-map point WORLD(250,250) matches the virtual-world coordinate point mini(250,250) then it is merely
    scale and translation

    If all Points in the World-Map [ Wpt(Wx,Wz) ]
    are to be mapped to the mini-view [ Mpt(Mx,Mz) ]
    Then the mini view is going to be at the ratio of 500/2000 or 0.25
    ratio = 500/2000 = 0.25
    Scale:
    Mx = ratio * Wx
    Mz = ratio * Wz
    Note: this will grab only every 4th pixel (horizontally/vertically) or
    1/16th of the image. You may want to get the average of the pixels
    in the world view before plotting in the mini-view.

    Translation:
    Mx now will be in the range -250 to 250. Same for Mz
    Translate to the mini-view dead zero:
    Mx = Mx + 250 Mx is now in the range 0 to 500
    Mz = Mz + 250 Same for Mz

    If you want to have the option of placing the mini-map any place on the world-map, then you will need to remove the hard coded values.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    May 2009
    Posts
    2
    How would I work out where to plot the player on the map? if I have the x and z coords?
    Last edited by W1z8it; May 20th 2009 at 02:50 AM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 1
    Last Post: March 28th 2011, 10:40 PM
  2. Replies: 10
    Last Post: September 24th 2010, 04:33 AM
  3. Replies: 6
    Last Post: August 30th 2010, 03:34 PM
  4. Covert Cartesian coordinates eq. into Cylindrical coordinates
    Posted in the Differential Geometry Forum
    Replies: 0
    Last Post: August 6th 2010, 06:56 AM
  5. Replies: 6
    Last Post: February 4th 2009, 12:12 AM

Search Tags


/mathhelpforum @mathhelpforum