changeset 488:247f403dfed7

merged
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 09 Apr 2014 22:49:34 -0400
parents 46b5cb3f3114 (current diff) e04b22ce2fcd (diff)
children 60735bd452fc
files
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/python/events.py	Wed Apr 09 22:49:03 2014 -0400
+++ b/python/events.py	Wed Apr 09 22:49:34 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]))