comparison python/moving.py @ 527:37830a831818

loading from VISSIM trajectory data works
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sat, 21 Jun 2014 14:46:20 -0400
parents 21bdeb29f855
children f012a8ad7a0e
comparison
equal deleted inserted replaced
526:21bdeb29f855 527:37830a831818
671 the list is empty if there is no crossing''' 671 the list is empty if there is no crossing'''
672 indices = [] 672 indices = []
673 for i in xrange(self.length()-1): 673 for i in xrange(self.length()-1):
674 q1=self.__getitem__(i) 674 q1=self.__getitem__(i)
675 q2=self.__getitem__(i+1) 675 q2=self.__getitem__(i+1)
676 if q1[0] <= S1 <= q2[0] and lane == None or (self.lanes[i] == lane and self.lanes[i+1] == lane): 676 if q1[0] <= S1 < q2[0] and (lane == None or (self.lanes[i] == lane and self.lanes[i+1] == lane)):
677 indices.append(i+(S1-q1[0])/(q2[0]-q1[0])) 677 indices.append(i+(S1-q1[0])/(q2[0]-q1[0]))
678 return indices 678 return indices
679 679
680 ################## 680 ##################
681 # Moving Objects 681 # Moving Objects