def to_4326(coord_size: int, point: mi.Point) -> mi.Point: """Convert a point in maps.me-mercator CS to WGS-84 (EPSG:4326).""" merc_bounds = (-180.0, -180.0, 180.0, 180.0) # Xmin, Ymin, Xmax, Ymax x = point.x * (merc_bounds[2] - merc_bounds[0]) / coord_size + merc_bounds[0] y = point.y * (merc_bounds[3] - merc_bounds[1]) / coord_size + merc_bounds[1] y = 360.0 * math.atan(math.tanh(y * math.pi / 360.0)) / math.pi return mi.Point(x, y)
def from_pygen_point(p: geometry.PointD) -> mi.Point: return mi.Point(p.x, p.y)
def mwm_bitwise_split(v) -> mi.Point: hi = mwm_unshuffle(v >> 32) lo = mwm_unshuffle(v & 0xFFFFFFFF) x = ((hi & 0xFFFF) << 16) | (lo & 0xFFFF) y = (hi & 0xFFFF0000) | (lo >> 16) return mi.Point(x, y)