Mercurial Hosting > traffic-intelligence
changeset 55:88d5ee5ac164
updated comments and added shell for interaction between road users
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 13 Oct 2010 19:19:17 -0400 |
parents | c354d41ef7cd |
children | 61fe73df2d36 |
files | python/moving.py |
diffstat | 1 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/python/moving.py Wed Oct 13 19:08:12 2010 -0400 +++ b/python/moving.py Wed Oct 13 19:19:17 2010 -0400 @@ -301,8 +301,9 @@ self.positions.draw(options) def getInstantPassingLane(self, p1, p2): - '''Returns the instant(s) the object passes from one side of the segment to the other - empty list if not''' + '''Returns the instant(s) + at which the object passes from one side of the segment to the other + empty list if there is no crossing''' instants = [] for i in xrange(self.length()-1): @@ -330,6 +331,20 @@ self.name = name self.values = values +class Interaction(STObject): + '''Class for an interaction between two road users + or a road user and an obstacle + + link to the moving objects + ''' + + def __init__(self, num = None, timeInterval = None, protagonistNum1 = None, protagonistNum2 = None, movingObject1 = None, movingObject2 = None): + STObject.__init__(self, num, timeInterval) + self.protagonistNum1 = protagonistNum1 + self.protagonistNum2 = protagonistNum2 + self.movingObject1 = movingObject1 + self.movingObject2 = movingObject2 + if __name__ == "__main__": import doctest import unittest @@ -338,3 +353,4 @@ unittest.TextTestRunner().run(suite) #doctest.testmod() #doctest.testfile("example.txt") +