Mercurial > hg > nsaunier > traffic-intelligence
comparison python/tests/moving.txt @ 248:571ba5ed22e2
added utils for bus processing
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 18 Jul 2012 02:54:22 -0400 |
| parents | 74b1fc68d4df |
| children | 99173da7afae |
comparison
equal
deleted
inserted
replaced
| 247:8f0ed138d373 | 248:571ba5ed22e2 |
|---|---|
| 27 >>> TimeInterval(2,5).equal(TimeInterval(2,4)) | 27 >>> TimeInterval(2,5).equal(TimeInterval(2,4)) |
| 28 False | 28 False |
| 29 >>> TimeInterval(2,5).equal(TimeInterval(5,2)) | 29 >>> TimeInterval(2,5).equal(TimeInterval(5,2)) |
| 30 False | 30 False |
| 31 | 31 |
| 32 >>> TimeInterval(3,6).distance(TimeInterval(4,6)) | |
| 33 0 | |
| 34 >>> TimeInterval(3,6).distance(TimeInterval(6,10)) | |
| 35 0 | |
| 36 >>> TimeInterval(3,6).distance(TimeInterval(8,10)) | |
| 37 2 | |
| 38 >>> TimeInterval(20,30).distance(TimeInterval(3,15)) | |
| 39 5 | |
| 40 >>> Interval.union([TimeInterval(3,6), TimeInterval(8,10),TimeInterval(11,15)]) | |
| 41 [3,15] | |
| 42 | |
| 32 >>> Point(3,4)-Point(1,7) | 43 >>> Point(3,4)-Point(1,7) |
| 33 (2.000000,-3.000000) | 44 (2.000000,-3.000000) |
| 34 | 45 |
| 35 >>> Point(3,2).norm2Squared() | 46 >>> Point(3,2).norm2Squared() |
| 36 13 | 47 13 |
| 37 | 48 |
| 38 >>> Point.distanceNorm2(Point(3,4),Point(1,7)) | 49 >>> Point.distanceNorm2(Point(3,4),Point(1,7)) |
| 39 3.6055512754639891 | 50 3.605551275463989 |
| 40 | 51 |
| 41 >>> Point(3,2).inPolygon([Point(0,0),Point(1,0),Point(1,1),Point(0,1)]) | 52 >>> Point(3,2).inPolygon([Point(0,0),Point(1,0),Point(1,1),Point(0,1)]) |
| 42 False | 53 False |
| 43 >>> Point(3,2).inPolygon([Point(0,0),Point(4,0),Point(4,3),Point(0,3)]) | 54 >>> Point(3,2).inPolygon([Point(0,0),Point(4,0),Point(4,3),Point(0,3)]) |
| 44 True | 55 True |
| 58 (1.500000,3.500000) | 69 (1.500000,3.500000) |
| 59 >>> t1.getTrajectoryInPolygon(np.array([[0,0],[4,0],[4,3],[0,3]])) | 70 >>> t1.getTrajectoryInPolygon(np.array([[0,0],[4,0],[4,3],[0,3]])) |
| 60 (0.500000,0.500000) | 71 (0.500000,0.500000) |
| 61 >>> t1.getTrajectoryInPolygon(np.array([[10,10],[14,10],[14,13],[10,13]])).length() | 72 >>> t1.getTrajectoryInPolygon(np.array([[10,10],[14,10],[14,13],[10,13]])).length() |
| 62 0 | 73 0 |
| 63 | |
| 64 >>> indic1 = TemporalIndicator('bla', [0,3,-4], TimeInterval(4,6)) | |
| 65 >>> indic1.empty() | |
| 66 False | |
| 67 >>> indic1[5] | |
| 68 3 | |
| 69 >>> indic1[3] | |
| 70 >>> [v for v in indic1] | |
| 71 [0, 3, -4] | |
| 72 >>> indic1 = TemporalIndicator('bla', {2:0,4:3,5:-5}) | |
| 73 >>> indic1[4] | |
| 74 3 | |
| 75 >>> indic1[3] | |
| 76 >>> [v for v in indic1] | |
| 77 [0, 3, -5] | |
| 78 | |
| 79 >>> indicatorMap([1,2,3], t1, 1) | |
| 80 {(1.0, 3.0): 2.0, (2.0, 6.0): 3.0, (0.0, 0.0): 1.0} | |
| 81 >>> indicatorMap([1,2,3], t1, 4) | |
| 82 {(0.0, 1.0): 3.0, (0.0, 0.0): 1.5} |
