hexagram30 / map

A map-making library for worlds, cities, dungeons, and buildings in hexagram30 projects
Apache License 2.0
2 stars 0 forks source link

Calculate sizes of tiles #5

Closed oubiwann closed 6 years ago

oubiwann commented 6 years ago

Steps:

  1. [x] Get row
  2. [x] Check if the row is the first or last one and special-case those two
  3. [x] Count pixels in row
  4. [x] Calculate lon degrees per pixel
  5. [x] Calculate lat degrees per pixel
  6. [x] Calculate geodesic surfaces for each pixel
    1. [x] At poles, use triangles
    2. [x] Everywhere else, use rectangles
  7. [x] Calculate centers for each geodesic
    1. [x] For geodesic triangles, approximate with half base and 2/3 from top
    2. [x] For geodesic rectangles, halve each to find the distance to the center point of tile from any size of the tile
    3. [x] Multiply by pixel index and lat/lon degrees to get 4 corner coordinates and the center tile coordinate
oubiwann commented 6 years ago

Gonna need a function that calculates the equator based on starting and ending rows. This can then be used to normalize lat sign (-/+; if 0, then equator).

oubiwann commented 6 years ago

Done.