Mercurial Hosting > traffic-intelligence
comparison trafficintelligence/moving.py @ 1122:58efbe18f102
slight modification
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 10 Jul 2019 16:08:41 -0400 |
parents | bb58506c1bfd |
children | 0548a78852b8 |
comparison
equal
deleted
inserted
replaced
1121:6baa915dd8bd | 1122:58efbe18f102 |
---|---|
736 result = result and (p == po) | 736 result = result and (p == po) |
737 return result | 737 return result |
738 else: | 738 else: |
739 return False | 739 return False |
740 | 740 |
741 def append(self,other): | |
742 '''adds positions of other to the trajectory (in-place modification)''' | |
743 for p in other: | |
744 self.addPosition(p) | |
745 | |
741 def setPositionXY(self, i, x, y): | 746 def setPositionXY(self, i, x, y): |
742 if i < self.__len__(): | 747 if i < self.__len__(): |
743 self.positions[0][i] = x | 748 self.positions[0][i] = x |
744 self.positions[1][i] = y | 749 self.positions[1][i] = y |
745 | 750 |
1073 for i in range(nPoints-1): | 1078 for i in range(nPoints-1): |
1074 S.append(S[-1]+v) | 1079 S.append(S[-1]+v) |
1075 Y = [y]*nPoints | 1080 Y = [y]*nPoints |
1076 lanes = [lane]*nPoints | 1081 lanes = [lane]*nPoints |
1077 return CurvilinearTrajectory(S, Y, lanes) | 1082 return CurvilinearTrajectory(S, Y, lanes) |
1078 | |
1079 def append(self,other): | |
1080 '''adds positions of other to the curvilinear trajectory (in-place modification)''' | |
1081 for p in other: | |
1082 self.addPosition(p) | |
1083 | 1083 |
1084 @staticmethod | 1084 @staticmethod |
1085 def fromTrajectoryProjection(t, alignments, halfWidth = 3): | 1085 def fromTrajectoryProjection(t, alignments, halfWidth = 3): |
1086 ''' Add, for every object position, the class 'moving.CurvilinearTrajectory()' | 1086 ''' Add, for every object position, the class 'moving.CurvilinearTrajectory()' |
1087 (curvilinearPositions instance) which holds information about the | 1087 (curvilinearPositions instance) which holds information about the |