Check user is following the route or not (iphone)

前端 未结 2 1834
情深已故
情深已故 2020-12-28 11:11

i am making an navigation based application. In this application i am drawing a route from points selected by the user. I have requirement of recalculating route if user is

2条回答
  •  时光取名叫无心
    2020-12-28 12:01

    For each pair of points in each step, you can calculate the distance between them using the Pythagorean Theorem:

    distance = sqrt(  pow((point1.x - point2.x), 2)   +   pow((point1.y - point2.y), 2)  )
    

    Then, if the distance is greater than 100m, add intermediary points along the line segment.

提交回复
热议问题