changeset 339:9c1818a71c9c

minor
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 19 Jun 2013 22:56:21 -0400
parents f3aceea2afbb
children 1046b7346886
files python/events.py python/moving.py python/requirements.txt
diffstat 3 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/python/events.py	Mon Jun 17 16:26:11 2013 -0400
+++ b/python/events.py	Wed Jun 19 22:56:21 2013 -0400
@@ -35,7 +35,7 @@
 
     def __init__(self, num = None, timeInterval = None, roaduserNum1 = None, roaduserNum2 = None, roadUser1 = None, roadUser2 = None, categoryNum = None):
         moving.STObject.__init__(self, num, timeInterval)
-        self.roaduserNumbers = set([roaduserNum1, roaduserNum2])
+        self.roadUserNumbers = set([roaduserNum1, roaduserNum2])
         self.roadUser1 = roadUser1
         self.roadUser2 = roadUser2
         self.categoryNum = categoryNum
@@ -90,9 +90,8 @@
     def computeCrossingsCollisions(self, predictionParameters, collisionDistanceThreshold, timeHorizon, computeCZ = False, debug = False, timeInterval = None):
         '''Computes all crossing and collision points at each common instant for two road users. '''
         self.collisionPoints={}
+        self.crossingZones={}
         TTCs = {}
-        if computeCZ:
-            self.crossingZones={}
 
         if timeInterval:
             commonTimeInterval = timeInterval
--- a/python/moving.py	Mon Jun 17 16:26:11 2013 -0400
+++ b/python/moving.py	Wed Jun 19 22:56:21 2013 -0400
@@ -254,6 +254,8 @@
         norm = p.norm2()
         if norm > 0:
             angle = atan2(p.y, p.x)
+        else:
+            angle = 0.
         return NormAngle(norm, angle)
 
     def __add__(self, other):
@@ -458,6 +460,12 @@
             return Trajectory([[a-b for a,b in zip(self.getXCoordinates(),traj2.getXCoordinates())],
                                [a-b for a,b in zip(self.getYCoordinates(),traj2.getYCoordinates())]])
 
+    def differentiate(self):
+        diff = Trajectory()
+        for i in xrange(1, self.length()):
+            diff.addPosition(self[i]-self[i-1])
+        return diff
+
     def norm(self):
         '''Returns the list of the norms at each instant'''
 #        def add(x, y): return x+y
--- a/python/requirements.txt	Mon Jun 17 16:26:11 2013 -0400
+++ b/python/requirements.txt	Wed Jun 19 22:56:21 2013 -0400
@@ -4,7 +4,7 @@
 The following libraries are necessary for (sometimes very) specific classes/functions.
 
 CV functionalities (cvutils.py): opencv
-Image functionalities (cvutils.py): Python Image Library
+Image functionalities (cvutils.py): Python Image Library (new version is called Pillow)
 
 Machine learning (ml.py): scipy