Interpolate between 2 GPS locations based on walking speed

前端 未结 5 1617
忘了有多久
忘了有多久 2021-02-15 10:39

Problem:


Given two locations:

L1 = (latitude1, longitude1, timestamp1), L2

5条回答
  •  情话喂你
    2021-02-15 11:16

    Yep. Linear interpolation.

    L1 = (1, 2, 3)
    L2 = (4, 5, 6)
    desired_number_of_interpolation_points = 9
    interpolation_points = []
    
    lat_step = (L2[0] - L1[0]) / (desired_number_of_interpolation_points + 1)
    lon_step = (L2[1] - L1[1]) / (desired_number_of_interpolation_points + 1)
    time_step = (L2[2] - L1[2]) / (desired_number_of_interpolation_points + 1) 
    
    for i in range(1, desired_number_of_interpolation_points + 1)
        interpolation_points.append((lat_step * i, lon_step * i, time_step * i))
    

提交回复
热议问题