-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathantipode.lua
More file actions
23 lines (21 loc) · 839 Bytes
/
Copy pathantipode.lua
File metadata and controls
23 lines (21 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- antipode — palette action that flies the camera to the
-- diametrically opposite point on the sphere.
--
-- Useful for the "if I dug straight down, where would I come out?"
-- moment. Most of the time it's the middle of an ocean — Tokyo's
-- antipode is empty Atlantic south of Argentina, Sydney's is the
-- North Atlantic, etc. ttymap's hemispheric-coverage tile fetch
-- + Mercator-aware fly_to handle the cross-globe pan cleanly.
local anim = require "ttymap.animation"
local geo = require "ttymap.geo"
ttymap.register_palette_command({
label = "Fly to antipode",
invoke = function()
local lon, lat = ttymap.map:center()
local alat, alon = geo.antipode(lat, lon)
anim.fly_to(alon, alat)
ttymap.notify(string.format(
"Antipode: %.4f, %.4f", alat, alon
))
end,
})