comparison trafficintelligence/tests/moving.txt @ 1085:7853106677b7

added generate static function for CurvilinearTrajectory and modified how to create them with None list in lanes
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 25 Sep 2018 17:08:37 -0400
parents cbc026dacf0b
children 8734742c08c0
comparison
equal deleted inserted replaced
1084:1a7e0b2c858b 1085:7853106677b7
204 (5.0, 5, 10) 204 (5.0, 5, 10)
205 >>> o2 = MovingObject.generate(2, Point(0.,-5.), Point(0.,1.), TimeInterval(15,30)) 205 >>> o2 = MovingObject.generate(2, Point(0.,-5.), Point(0.,1.), TimeInterval(15,30))
206 >>> MovingObject.computePET(o1, o2, 0.1) 206 >>> MovingObject.computePET(o1, o2, 0.1)
207 (15.0, 5, 20) 207 (15.0, 5, 20)
208 208
209 >>> t = CurvilinearTrajectory.generate(3, 1., 10, 'b')
210 >>> t.length()
211 10
212 >>> t[3]
213 [6.0, 0, 'b']
214 >>> t = CurvilinearTrajectory.generate(3, 1., 10, 'a', 1.)
215 >>> t[4]
216 [7.0, 1.0, 'a']
217
209 >>> t = CurvilinearTrajectory(S = [1., 2., 3., 5.], Y = [0.5, 0.5, 0.6, 0.7], lanes = ['1']*4) 218 >>> t = CurvilinearTrajectory(S = [1., 2., 3., 5.], Y = [0.5, 0.5, 0.6, 0.7], lanes = ['1']*4)
210 >>> t.differentiate() # doctest:+ELLIPSIS 219 >>> t.differentiate() # doctest:+ELLIPSIS
211 [1.0, 0.0, '1'] [1.0, 0.099..., '1'] [2.0, 0.099..., '1'] 220 [1.0, 0.0, None] [1.0, 0.099..., None] [2.0, 0.099..., None]
212 >>> t.differentiate(True) # doctest:+ELLIPSIS 221 >>> t.differentiate(True) # doctest:+ELLIPSIS
213 [1.0, 0.0, '1'] [1.0, 0.099..., '1'] [2.0, 0.099..., '1'] [2.0, 0.099..., '1'] 222 [1.0, 0.0, None] [1.0, 0.099..., None] [2.0, 0.099..., None] [2.0, 0.099..., None]
214 >>> t = CurvilinearTrajectory(S = [1.], Y = [0.5], lanes = ['1']) 223 >>> t = CurvilinearTrajectory(S = [1.], Y = [0.5], lanes = ['1'])
215 >>> t.differentiate().empty() 224 >>> t.differentiate().empty()
216 True 225 True
217 226
218 >>> o1 = MovingObject.generate(1, Point(1., 2.), Point(1., 1.), TimeInterval(0,10)) 227 >>> o1 = MovingObject.generate(1, Point(1., 2.), Point(1., 1.), TimeInterval(0,10))