Skip to main content
. 2022 Sep 17;22(18):7036. doi: 10.3390/s22187036
Algorithm 2 ODP algorithm
Input: trj(trajectory), eps(threshold)
Output: s_trj(simplified trajectory)
1: function Obstacle_DP(trj,eps,s_trj)
2:   n = trj.size()
3:   index, dmax = PerpendicularGeoDistance (trj, trj[1],trj[n])
4:   if dmax>eps or LineIntersectPoly (trj[1],trj[n])
5:    result1 = Obstacle_DP (trj[1],trj[1]+index)
6:    result2 = Obstacle_DP (trj[1]+index,trj[n])
7:    s_trj = [result1 result2]
8:    else
9:    s_trj = [trj[1] trj[n]]
10:    end if
11: end function