comparison trafficintelligence/tests/moving.txt @ 1086:8734742c08c0

major refactoring of curvilinear trajectory projections
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 16 Oct 2018 12:46:29 -0400
parents 7853106677b7
children c96388c696ac
comparison
equal deleted inserted replaced
1085:7853106677b7 1086:8734742c08c0
212 >>> t[3] 212 >>> t[3]
213 [6.0, 0, 'b'] 213 [6.0, 0, 'b']
214 >>> t = CurvilinearTrajectory.generate(3, 1., 10, 'a', 1.) 214 >>> t = CurvilinearTrajectory.generate(3, 1., 10, 'a', 1.)
215 >>> t[4] 215 >>> t[4]
216 [7.0, 1.0, 'a'] 216 [7.0, 1.0, 'a']
217
218 >>> a = Trajectory.generate(Point(0.,0.), Point(10.,0.), 4)
219 >>> t = Trajectory.generate(Point(0.1,-1.), Point(1.,0.), 22)
220 >>> prepareAlignments([a])
221 >>> ct = CurvilinearTrajectory.fromTrajectoryProjection(t, [a])
222 >>> ct[3]
223 [3.1, 1.0, 0]
224 >>> p = getXYfromSY(ct[3][0], ct[3][1], ct[3][2], [a])
225 >>> (Point(p[0], p[1])-t[3]).norm2() < 1e-10
226 True
227 >>> p = getXYfromSY(ct[21][0], ct[21][1], ct[21][2], [a])
228 >>> (Point(p[0], p[1])-t[21]).norm2() < 1e-10
229 True
217 230
218 >>> t = CurvilinearTrajectory(S = [1., 2., 3., 5.], Y = [0.5, 0.5, 0.6, 0.7], lanes = ['1']*4) 231 >>> t = CurvilinearTrajectory(S = [1., 2., 3., 5.], Y = [0.5, 0.5, 0.6, 0.7], lanes = ['1']*4)
219 >>> t.differentiate() # doctest:+ELLIPSIS 232 >>> t.differentiate() # doctest:+ELLIPSIS
220 [1.0, 0.0, None] [1.0, 0.099..., None] [2.0, 0.099..., None] 233 [1.0, 0.0, None] [1.0, 0.099..., None] [2.0, 0.099..., None]
221 >>> t.differentiate(True) # doctest:+ELLIPSIS 234 >>> t.differentiate(True) # doctest:+ELLIPSIS