# HG changeset patch # User Nicolas Saunier # Date 1396647836 14400 # Node ID e04b22ce2fcda8c2c07a3f671e3a105f2ef93985 # Parent a5847c0ca27c3de8cfc0e13ba23f8c7944c253c7 generalized createInteractions to 2 lists of objects (for cars and pedestrians for example) diff -r a5847c0ca27c -r e04b22ce2fcd python/events.py --- a/python/events.py Thu Apr 03 17:48:27 2014 -0400 +++ b/python/events.py Fri Apr 04 17:43:56 2014 -0400 @@ -148,14 +148,17 @@ ''' interaction types: conflict or collision if they are known''' self.interactionType= interactionType -def createInteractions(objects): - '''Create all interactions of two co-existing road users +def createInteractions(objects, _others = None): + '''Create all interactions of two co-existing road users''' + if _others != None: + others = _others - todo add test to compute categories?''' interactions = [] num = 0 for i in xrange(len(objects)): - for j in xrange(i): + if _others == None: + others = objects[:i] + for j in xrange(len(others)): commonTimeInterval = objects[i].commonTimeInterval(objects[j]) if not commonTimeInterval.empty(): interactions.append(Interaction(num, commonTimeInterval, objects[i].num, objects[j].num, objects[i], objects[j]))