#!/usr/bin/env python2


# Courtesy of cffk:
# http://gis.stackexchange.com/a/13181


from geographiclib.geodesic import Geodesic
import sys


locs = sys.argv[1:]
locs = [i.split() for i in locs]
locs = [(float(a), float(b)) for (a, b) in locs]

print 'points'
for lat, lon in locs:
    print '{} {}'.format(lat, lon)
print '.'

for i in range(0, len(locs) - 1):
    print 'track'
    lat_A, lon_A = locs[i]
    lat_B, lon_B = locs[i + 1]
    g = Geodesic.WGS84.Inverse(lat_A, lon_A, lat_B, lon_B)
    l = Geodesic.WGS84.Line(g['lat1'], g['lon1'], g['azi1'])
    n = int(g['a12'] * 100.0 / 90)
    for s in range(1, n):
        p = l.Position(float(s) / n * g['s12'])
        print '{} {}'.format(p['lat2'], p['lon2'])
    print '.'
