def path_length(p):
  """ Length of a path. """
  res = 0.0
  for (latlng1, latlng2) in zip(p.latlngs[1:], p.latlngs[:-1]):
    res += mm_dis(latlng1, latlng2)
  return res
 def state_features(self, sc, i):
   """ Feature subvector for states.
   """
   state = sc.states[i]
   d = mm_dis(state.gps_pos, sc.gps_pos)
   return [-0.5 * d * d]
Esempio n. 3
0
def path_length(p):
  """ Returns the lenght of a path (meters). """
  res = 0.0
  for (latlng1, latlng2) in zip(p.latlngs[1:], p.latlngs[:-1]):
    res += mm_dis(latlng1, latlng2)
  return res