Mercurial Hosting > traffic-intelligence
diff python/tests/moving.txt @ 504:a40c75f04903
optimized direct time to collision computation and added tests
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 02 Jun 2014 17:33:22 -0400 |
parents | cd342a774806 |
children | 1dced8932b08 |
line wrap: on
line diff
--- a/python/tests/moving.txt Tue May 27 17:09:10 2014 -0400 +++ b/python/tests/moving.txt Mon Jun 02 17:33:22 2014 -0400 @@ -85,6 +85,15 @@ >>> Trajectory.lcss(t1, t1, lcss) 3 +>>> p1=Point(0,0) +>>> p2=Point(1,0) +>>> v1 = Point(0.1,0.1) +>>> v2 = Point(-0.1, 0.1) +>>> abs(Point.timeToCollision(p1, p2, v1, v2, 0.)-5.0) < 0.00001 +True +>>> abs(Point.timeToCollision(p1, p2, v1, v2, 0.1)-4.5) < 0.00001 +True + >>> o1 = MovingObject(positions = Trajectory([[0]*3,[2]*3]), velocities = Trajectory([[0]*3,[1]*3])) >>> o1.classifyUserTypeSpeed(0.5, np.median) >>> userTypeNames[o1.getUserType()]