comparison python/tests/moving.txt @ 631:2d1d33ae1c69

major work on pPET and pet, issues remain for pPET computed with predicted trajectories
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 17 Feb 2015 03:55:55 +0100
parents 17b02c8054d0
children dc70d9e711f5
comparison
equal deleted inserted replaced
630:69a98f84f3eb 631:2d1d33ae1c69
51 13 51 13
52 52
53 >>> Point.distanceNorm2(Point(3,4),Point(1,7)) 53 >>> Point.distanceNorm2(Point(3,4),Point(1,7))
54 3.605551275463989 54 3.605551275463989
55 55
56 >>> Point(3,2).inPolygonNoShapely(np.array([[0,0],[1,0],[1,1],[0,1]])) 56 >>> Point(3,2).inPolygon(np.array([[0,0],[1,0],[1,1],[0,1]]))
57 False 57 False
58 >>> Point(3,2).inPolygonNoShapely(np.array([[0,0],[4,0],[4,3],[0,3]])) 58 >>> Point(3,2).inPolygon(np.array([[0,0],[4,0],[4,3],[0,3]]))
59 True 59 True
60 60
61 >>> predictPositionNoLimit(10, Point(0,0), Point(1,1)) # doctest:+ELLIPSIS 61 >>> predictPositionNoLimit(10, Point(0,0), Point(1,1)) # doctest:+ELLIPSIS
62 ((1.0...,1.0...), (10.0...,10.0...)) 62 ((1.0...,1.0...), (10.0...,10.0...))
63 63
82 >>> t1 = Trajectory([[0.5,1.5,2.5],[0.5,3.5,6.5]]) 82 >>> t1 = Trajectory([[0.5,1.5,2.5],[0.5,3.5,6.5]])
83 >>> t1.length() == 3. 83 >>> t1.length() == 3.
84 True 84 True
85 >>> t1[1] 85 >>> t1[1]
86 (1.500000,3.500000) 86 (1.500000,3.500000)
87 >>> t1.getTrajectoryInPolygonNoShapely(np.array([[0,0],[4,0],[4,3],[0,3]]))
88 (0.500000,0.500000)
89 >>> t1.getTrajectoryInPolygonNoShapely(np.array([[10,10],[14,10],[14,13],[10,13]])).length()
90 0
91 87
92 >>> t1.differentiate() 88 >>> t1.differentiate()
93 (1.000000,3.000000) (1.000000,3.000000) 89 (1.000000,3.000000) (1.000000,3.000000)
94 >>> t1.differentiate(True) 90 >>> t1.differentiate(True)
95 (1.000000,3.000000) (1.000000,3.000000) (1.000000,3.000000) 91 (1.000000,3.000000) (1.000000,3.000000) (1.000000,3.000000)
139 >>> Point.timeToCollision(p2, p1, v2, v1, 0.) == None 135 >>> Point.timeToCollision(p2, p1, v2, v1, 0.) == None
140 True 136 True
141 >>> Point.midPoint(p1, p2) 137 >>> Point.midPoint(p1, p2)
142 (0.500000,0.500000) 138 (0.500000,0.500000)
143 139
140 >>> o1 = MovingObject.generate(Point(-5.,0.), Point(1.,0.), TimeInterval(0,10))
141 >>> o2 = MovingObject.generate(Point(0.,-5.), Point(0.,1.), TimeInterval(0,10))
142 >>> MovingObject.computePET(o1, o2, 0.1)
143 0.0
144 >>> o2 = MovingObject.generate(Point(0.,-5.), Point(0.,1.), TimeInterval(5,15))
145 >>> MovingObject.computePET(o1, o2, 0.1)
146 5.0
147
144 >>> t = CurvilinearTrajectory(S = [1., 2., 3., 5.], Y = [0.5, 0.5, 0.6, 0.7], lanes = ['1']*4) 148 >>> t = CurvilinearTrajectory(S = [1., 2., 3., 5.], Y = [0.5, 0.5, 0.6, 0.7], lanes = ['1']*4)
145 >>> t.differentiate() # doctest:+ELLIPSIS 149 >>> t.differentiate() # doctest:+ELLIPSIS
146 [1.0, 0.0, '1'] [1.0, 0.099..., '1'] [2.0, 0.099..., '1'] 150 [1.0, 0.0, '1'] [1.0, 0.099..., '1'] [2.0, 0.099..., '1']
147 >>> t.differentiate(True) # doctest:+ELLIPSIS 151 >>> t.differentiate(True) # doctest:+ELLIPSIS
148 [1.0, 0.0, '1'] [1.0, 0.099..., '1'] [2.0, 0.099..., '1'] [2.0, 0.099..., '1'] 152 [1.0, 0.0, '1'] [1.0, 0.099..., '1'] [2.0, 0.099..., '1'] [2.0, 0.099..., '1']