diff python/moving.py @ 531:f012a8ad7a0e

corrected bug in Point.timeToCollision that might result in negative TTCs
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 27 Jun 2014 17:32:11 -0400
parents 37830a831818
children a3add9f751ef 6c0923f1ce68
line wrap: on
line diff
--- a/python/moving.py	Thu Jun 26 23:20:36 2014 -0400
+++ b/python/moving.py	Fri Jun 27 17:32:11 2014 -0400
@@ -290,13 +290,12 @@
             ttc2 = (-b - deltaRoot)/(2*a)
             if ttc1 >= 0 and ttc2 >= 0:
                 ttc = min(ttc1,ttc2)
-            else:
-                if ttc1 < 0:
-                    ttc = ttc2
-                elif ttc2 < 0:
-                    ttc = ttc1
-                else: # ttc1 < 0 and ttc2 < 0:
-                    ttc = None
+            elif ttc1 >= 0:
+                ttc = ttc1
+            elif ttc2 >= 0:
+                ttc = ttc2
+            else: # ttc1 < 0 and ttc2 < 0:
+                ttc = None
         else:
             ttc = None
         return ttc