diff 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
line wrap: on
line diff
--- a/trafficintelligence/tests/moving.txt	Tue Sep 25 17:08:37 2018 -0400
+++ b/trafficintelligence/tests/moving.txt	Tue Oct 16 12:46:29 2018 -0400
@@ -215,6 +215,19 @@
 >>> t[4]
 [7.0, 1.0, 'a']
 
+>>> a = Trajectory.generate(Point(0.,0.), Point(10.,0.), 4)
+>>> t = Trajectory.generate(Point(0.1,-1.), Point(1.,0.), 22)
+>>> prepareAlignments([a])
+>>> ct = CurvilinearTrajectory.fromTrajectoryProjection(t, [a])
+>>> ct[3]
+[3.1, 1.0, 0]
+>>> p = getXYfromSY(ct[3][0], ct[3][1], ct[3][2], [a])
+>>> (Point(p[0], p[1])-t[3]).norm2() < 1e-10
+True
+>>> p = getXYfromSY(ct[21][0], ct[21][1], ct[21][2], [a])
+>>> (Point(p[0], p[1])-t[21]).norm2() < 1e-10
+True
+
 >>> t = CurvilinearTrajectory(S = [1., 2., 3., 5.], Y = [0.5, 0.5, 0.6, 0.7], lanes = ['1']*4)
 >>> t.differentiate() # doctest:+ELLIPSIS
 [1.0, 0.0, None] [1.0, 0.099..., None] [2.0, 0.099..., None]