Mercurial > hg > nsaunier > traffic-intelligence
comparison python/moving.py @ 583:6ebfb43e938e
added midpoint function (from laurent gauthier)
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Mon, 22 Sep 2014 16:21:53 -0400 |
| parents | 7e1ae4d97f1a |
| children | cf578ba866da 84690dfe5560 |
comparison
equal
deleted
inserted
replaced
| 582:7e1ae4d97f1a | 583:6ebfb43e938e |
|---|---|
| 314 ttc = None | 314 ttc = None |
| 315 else: | 315 else: |
| 316 ttc = None | 316 ttc = None |
| 317 return ttc | 317 return ttc |
| 318 | 318 |
| 319 @staticmethod | |
| 320 def midPoint(p1, p2): | |
| 321 'Returns the middle of the segment [p1, p2]' | |
| 322 return Point(0.5*p1.x+0.5*p2.x, 0.5*p1.y+0.5*p2.y) | |
| 319 | 323 |
| 320 if shapelyAvailable: | 324 if shapelyAvailable: |
| 321 def pointsInPolygon(points, polygon): | 325 def pointsInPolygon(points, polygon): |
| 322 '''Optimized tests of a series of points within (Shapely) polygon ''' | 326 '''Optimized tests of a series of points within (Shapely) polygon ''' |
| 323 prepared_polygon = prep(polygon) | 327 prepared_polygon = prep(polygon) |
