diff trafficintelligence/tests/moving.txt @ 1222:69b531c7a061

added methods to reset trajectories and change object coordinates (including features)
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 20 Jun 2023 15:42:19 -0400
parents dc28364f34b9
children fe35473acee3
line wrap: on
line diff
--- a/trafficintelligence/tests/moving.txt	Mon Jun 19 22:37:45 2023 -0400
+++ b/trafficintelligence/tests/moving.txt	Tue Jun 20 15:42:19 2023 -0400
@@ -219,6 +219,22 @@
 >>> Point.timeToCollision(p1, p2, v1, v2, 1.)
 4.0
 
+>>> t = Trajectory.generate(Point(0.1,-1.), Point(1.,0.), 22)
+>>> t[0].x == 0.1
+True
+>>> x = 1.
+>>> t.reset(x, x)
+>>> t[0].x == x
+True
+>>> t[10].y == x
+True
+>>> o1 = MovingObject.generate(1, Point(-5.,0.), Point(1.,0.), TimeInterval(0,10))
+>>> o1.getVelocityAt(1).x == 1.
+True
+>>> o1.setStationary()
+>>> o1.getVelocityAt(1).x == 0
+True
+
 >>> objects = storage.loadTrajectoriesFromSqlite('../samples/laurier.sqlite', 'object')
 >>> len(objects)
 5