Mercurial > hg > nsaunier > traffic-intelligence
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 1221:5a207c838323 | 1222:69b531c7a061 |
|---|---|
| 216 >>> v2 = Point(1.,0.) | 216 >>> v2 = Point(1.,0.) |
| 217 >>> Point.timeToCollision(p1, p2, v1, v2, 0.) | 217 >>> Point.timeToCollision(p1, p2, v1, v2, 0.) |
| 218 5.0 | 218 5.0 |
| 219 >>> Point.timeToCollision(p1, p2, v1, v2, 1.) | 219 >>> Point.timeToCollision(p1, p2, v1, v2, 1.) |
| 220 4.0 | 220 4.0 |
| 221 | |
| 222 >>> t = Trajectory.generate(Point(0.1,-1.), Point(1.,0.), 22) | |
| 223 >>> t[0].x == 0.1 | |
| 224 True | |
| 225 >>> x = 1. | |
| 226 >>> t.reset(x, x) | |
| 227 >>> t[0].x == x | |
| 228 True | |
| 229 >>> t[10].y == x | |
| 230 True | |
| 231 >>> o1 = MovingObject.generate(1, Point(-5.,0.), Point(1.,0.), TimeInterval(0,10)) | |
| 232 >>> o1.getVelocityAt(1).x == 1. | |
| 233 True | |
| 234 >>> o1.setStationary() | |
| 235 >>> o1.getVelocityAt(1).x == 0 | |
| 236 True | |
| 221 | 237 |
| 222 >>> objects = storage.loadTrajectoriesFromSqlite('../samples/laurier.sqlite', 'object') | 238 >>> objects = storage.loadTrajectoriesFromSqlite('../samples/laurier.sqlite', 'object') |
| 223 >>> len(objects) | 239 >>> len(objects) |
| 224 5 | 240 5 |
| 225 >>> objects[0].hasFeatures() | 241 >>> objects[0].hasFeatures() |
