Mercurial Hosting > traffic-intelligence
comparison 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 |
comparison
equal
deleted
inserted
replaced
1018:d7afc59f6966 | 1019:5d2f6afae35b |
---|---|
198 >>> t = CurvilinearTrajectory(S = [1.], Y = [0.5], lanes = ['1']) | 198 >>> t = CurvilinearTrajectory(S = [1.], Y = [0.5], lanes = ['1']) |
199 >>> t.differentiate().empty() | 199 >>> t.differentiate().empty() |
200 True | 200 True |
201 | 201 |
202 >>> o1 = MovingObject.generate(1, Point(1., 2.), Point(1., 1.), TimeInterval(0,10)) | 202 >>> o1 = MovingObject.generate(1, Point(1., 2.), Point(1., 1.), TimeInterval(0,10)) |
203 >>> o1.features = [o1] | |
203 >>> o2 = MovingObject.generate(2, Point(14., 14.), Point(1., 0.), TimeInterval(14,20)) | 204 >>> o2 = MovingObject.generate(2, Point(14., 14.), Point(1., 0.), TimeInterval(14,20)) |
204 | 205 >>> o2.features = [o2] |
206 >>> o3 = MovingObject.generate(3, Point(2., 2.), Point(1., 1.), TimeInterval(2,12)) | |
207 >>> o3.features = [o3] | |
208 >>> o13 = MovingObject.concatenate(o1, o3, 4) | |
209 >>> o13.getNum() | |
210 4 | |
211 >>> o13.getTimeInterval() == TimeInterval(0,12) | |
212 True | |
213 >>> t=5 | |
214 >>> o13.getPositionAtInstant(t) == (o1.getPositionAtInstant(t)+o3.getPositionAtInstant(t)).divide(2) | |
215 True | |
216 >>> len(o13.getFeatures()) | |
217 2 | |
218 >>> o12 = MovingObject.concatenate(o1, o2, 5) | |
219 >>> o12.getTimeInterval() == TimeInterval(o1.getFirstInstant(), o2.getLastInstant()) | |
220 True | |
221 >>> v = o12.getVelocityAtInstant(12) | |
222 >>> v == Point(3./4, 2./4) | |
223 True | |
224 >>> o12.getPositionAtInstant(11) == o1.getPositionAtInstant(10)+v | |
225 True | |
226 >>> len(o12.getFeatures()) | |
227 3 | |
205 | 228 |
206 >>> o1 = MovingObject.generate(1, Point(0., 2.), Point(0., 1.), TimeInterval(0,2)) | 229 >>> o1 = MovingObject.generate(1, Point(0., 2.), Point(0., 1.), TimeInterval(0,2)) |
207 >>> o1.classifyUserTypeSpeedMotorized(0.5, np.median) | 230 >>> o1.classifyUserTypeSpeedMotorized(0.5, np.median) |
208 >>> userTypeNames[o1.getUserType()] | 231 >>> userTypeNames[o1.getUserType()] |
209 'car' | 232 'car' |