Mercurial Hosting > traffic-intelligence
diff python/tests/moving.txt @ 1019:5d2f6afae35b
work on object concatenation
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 04 Jun 2018 23:35:50 -0400 |
parents | d7afc59f6966 |
children |
line wrap: on
line diff
--- a/python/tests/moving.txt Mon Jun 04 17:46:52 2018 -0400 +++ b/python/tests/moving.txt Mon Jun 04 23:35:50 2018 -0400 @@ -200,8 +200,31 @@ True >>> o1 = MovingObject.generate(1, Point(1., 2.), Point(1., 1.), TimeInterval(0,10)) +>>> o1.features = [o1] >>> o2 = MovingObject.generate(2, Point(14., 14.), Point(1., 0.), TimeInterval(14,20)) - +>>> o2.features = [o2] +>>> o3 = MovingObject.generate(3, Point(2., 2.), Point(1., 1.), TimeInterval(2,12)) +>>> o3.features = [o3] +>>> o13 = MovingObject.concatenate(o1, o3, 4) +>>> o13.getNum() +4 +>>> o13.getTimeInterval() == TimeInterval(0,12) +True +>>> t=5 +>>> o13.getPositionAtInstant(t) == (o1.getPositionAtInstant(t)+o3.getPositionAtInstant(t)).divide(2) +True +>>> len(o13.getFeatures()) +2 +>>> o12 = MovingObject.concatenate(o1, o2, 5) +>>> o12.getTimeInterval() == TimeInterval(o1.getFirstInstant(), o2.getLastInstant()) +True +>>> v = o12.getVelocityAtInstant(12) +>>> v == Point(3./4, 2./4) +True +>>> o12.getPositionAtInstant(11) == o1.getPositionAtInstant(10)+v +True +>>> len(o12.getFeatures()) +3 >>> o1 = MovingObject.generate(1, Point(0., 2.), Point(0., 1.), TimeInterval(0,2)) >>> o1.classifyUserTypeSpeedMotorized(0.5, np.median)