Mercurial Hosting > traffic-intelligence
diff python/prediction.py @ 484:6464e4f0cc26
integrated Sohail direct computation of TTC (need to add pPET)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 02 Apr 2014 17:45:18 -0400 |
parents | a84b9ba9631f |
children | 000bddf84ad0 |
line wrap: on
line diff
--- a/python/prediction.py Wed Apr 02 17:25:50 2014 -0400 +++ b/python/prediction.py Wed Apr 02 17:45:18 2014 -0400 @@ -400,12 +400,14 @@ p2 = obj2.getPositionAtInstant(currentInstant) v1 = obj1.getVelocityAtInstant(currentInstant) v2 = obj2.getVelocityAtInstant(currentInstant) - - ttc = moving.Point.timeToCollision(p1, p2, v1, v2, collisionDistanceThreshold) - if ttc: - return [SafetyPoint(moving.Point(), 1., ttc)], [] - else: - return [],[] + intersection = moving.intersection(p1, p2, v1, v2) + + if intersection != None: + ttc = moving.Point.timeToCollision(p1, p2, v1, v2, collisionDistanceThreshold) + if ttc: + return [SafetyPoint(intersection, 1., ttc)], [] # (p1+v1.multiply(ttc)+p2+v2.multiply(ttc)).multiply(0.5) + else: + return [],[] #### # Other Methods