diff trafficintelligence/moving.py @ 1115:cef7aa2f9931

minor shorthand method
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sat, 22 Jun 2019 23:33:01 -0400
parents 7135b5eaa6b4
children a3982d591a61
line wrap: on
line diff
--- a/trafficintelligence/moving.py	Fri Jun 21 15:54:04 2019 -0400
+++ b/trafficintelligence/moving.py	Sat Jun 22 23:33:01 2019 -0400
@@ -879,12 +879,16 @@
             print('Index {} beyond trajectory length {}-1'.format(i, self.length()))
 
     def getCumulativeDistance(self, i):
-        '''Return the cumulative distance between the beginning and point i'''
+        '''Returns the cumulative distance between the beginning and point i'''
         if i < self.length():
             return self.cumulativeDistances[i]
         else:
             print('Index {} beyond trajectory length {}'.format(i, self.length()))
 
+    def getTotalDistance(self):
+        '''Returns the total distance (shorthand for cumulative distance [-1]'''
+        return self.getCumulativeDistance(-1)
+            
     def getMaxDistance(self, metric):
         'Returns the maximum distance between points in the trajectory'
         positions = self.getPositions().asArray().T