Mercurial Hosting > traffic-intelligence
comparison trafficintelligence/tests/moving.txt @ 1170:b55adb13f262
added functions on line crossing orientation and important reorganization and cleaning of related code
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 27 Sep 2021 14:05:33 -0400 |
parents | 4b2a55d570c1 |
children | aa88acf06876 |
comparison
equal
deleted
inserted
replaced
1169:9f7a4a026dab | 1170:b55adb13f262 |
---|---|
88 | 88 |
89 >>> predictPositionNoLimit(10, Point(0,0), Point(1,1)) # doctest:+ELLIPSIS | 89 >>> predictPositionNoLimit(10, Point(0,0), Point(1,1)) # doctest:+ELLIPSIS |
90 ((1.0...,1.0...), (10.0...,10.0...)) | 90 ((1.0...,1.0...), (10.0...,10.0...)) |
91 | 91 |
92 >>> segmentIntersection(Point(0,0), Point(0,1), Point(1,1), Point(2,3)) | 92 >>> segmentIntersection(Point(0,0), Point(0,1), Point(1,1), Point(2,3)) |
93 (None, None) | |
93 >>> segmentIntersection(Point(0,1), Point(0,3), Point(1,0), Point(3,1)) | 94 >>> segmentIntersection(Point(0,1), Point(0,3), Point(1,0), Point(3,1)) |
95 (None, None) | |
94 >>> segmentIntersection(Point(0.,0.), Point(2.,2.), Point(0.,2.), Point(2.,0.)) | 96 >>> segmentIntersection(Point(0.,0.), Point(2.,2.), Point(0.,2.), Point(2.,0.)) |
95 (1.000000,1.000000) | 97 ((1.000000,1.000000), 0.5) |
96 >>> segmentIntersection(Point(0,0), Point(4,4), Point(0,4), Point(4,0)) | 98 >>> segmentIntersection(Point(0,0), Point(4,4), Point(0,4), Point(4,0)) |
97 (2.000000,2.000000) | 99 ((2.000000,2.000000), 0.5) |
100 >>> segmentIntersection(Point(0,0), Point(0,3), Point(1,1), Point(-1,1)) # doctest:+ELLIPSIS | |
101 ((0.000000,1.000000), 0.333...) | |
98 >>> segmentIntersection(Point(0,1), Point(1,2), Point(2,0), Point(3,2)) | 102 >>> segmentIntersection(Point(0,1), Point(1,2), Point(2,0), Point(3,2)) |
103 (None, None) | |
104 | |
105 >>> segmentOrientationCrossing(Point(0.,0.), Point(2.,2.), Point(0.,2.), Point(2.,0.)) | |
106 False | |
107 >>> segmentOrientationCrossing(Point(0.,0.), Point(2.,2.), Point(2.,0.), Point(0.,2.)) | |
108 True | |
109 >>> segmentOrientationCrossing(Point(0,0), Point(0,3), Point(1,1), Point(-1,1)) | |
110 True | |
111 | |
112 >>> o1 = MovingObject.generate(1, Point(1.,0.), Point(1.,0.), TimeInterval(0,10)) | |
113 >>> instants, intersections, rightToLeftOrientations = o1.getInstantsCrossingLine(Point(0.,3.5), Point(2.,3.5)) | |
114 >>> rightToLeftOrientations == [] | |
115 True | |
116 >>> len(instants) | |
117 0 | |
118 >>> o1 = MovingObject.generate(1, Point(0.,1.), Point(1.,0.), TimeInterval(0,10)) | |
119 >>> instants, intersections, rightToLeftOrientations = o1.getInstantsCrossingLine(Point(3.5,0.), Point(3.5, 2.), False) | |
120 >>> rightToLeftOrientations == [] | |
121 True | |
122 >>> instants[0] | |
123 3.5 | |
124 >>> instants, intersections, rightToLeftOrientations = o1.getInstantsCrossingLine(Point(3.5,0.), Point(3.5, 2.), True) | |
125 >>> len(rightToLeftOrientations) | |
126 1 | |
127 >>> rightToLeftOrientations[0] | |
128 False | |
99 | 129 |
100 >>> t1 = Trajectory.fromPointList([(92.2, 102.9), (56.7, 69.6)]) | 130 >>> t1 = Trajectory.fromPointList([(92.2, 102.9), (56.7, 69.6)]) |
101 >>> t2 = Trajectory.fromPointList([(92.2, 102.9), (56.7, 69.6)]) | 131 >>> t2 = Trajectory.fromPointList([(92.2, 102.9), (56.7, 69.6)]) |
102 >>> t1 == t2 | 132 >>> t1 == t2 |
103 True | 133 True |